签到记录增加字段: 最大连续签到
This commit is contained in:
parent
6d60ff88d7
commit
3fd2cf6f6b
@ -30,6 +30,9 @@ export class CheckInClass extends BaseModule {
|
|||||||
// 连签天数
|
// 连签天数
|
||||||
@prop({ default: 1 })
|
@prop({ default: 1 })
|
||||||
public count: number
|
public count: number
|
||||||
|
// 最大连签天数
|
||||||
|
@prop({ default: 1 })
|
||||||
|
public maxSeq: number
|
||||||
@prop({ default: 1 })
|
@prop({ default: 1 })
|
||||||
public total: number
|
public total: number
|
||||||
@prop()
|
@prop()
|
||||||
@ -45,6 +48,7 @@ export class CheckInClass extends BaseModule {
|
|||||||
}
|
}
|
||||||
const total = await CheckIn.countDocuments({ from: event.from })
|
const total = await CheckIn.countDocuments({ from: event.from })
|
||||||
event.total = total + 1
|
event.total = total + 1
|
||||||
|
event.maxSeq = Math.max(event.count, event.maxSeq || 1)
|
||||||
try {
|
try {
|
||||||
await CheckIn.insertOrUpdate({ from: event.from, dateTag: event.dateTag }, event)
|
await CheckIn.insertOrUpdate({ from: event.from, dateTag: event.dateTag }, event)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user