活动:糜家商店挑战统计

This commit is contained in:
qiaoxin
2021-06-09 17:07:35 +08:00
parent 9209378b9d
commit 7ed630f85e
7 changed files with 70 additions and 12 deletions

View File

@@ -39,8 +39,8 @@ export default class Activity_Self_Service extends BaseModel {
//添加挑战记录
public static async addChallengeRecord(serverId: number, activityId: number, roleId: string, roundIndex: number, count: number, time: Date) {
let result: ActivitySelfServiceModelType = await ActivitySelfServiceModel.findOneAndUpdate(
{ serverId, roleId, activityId, roundIndex, challengeRecords: { $elemMatch: { time } } },
{ $inc: { "challengeRecords.$.count": count } }, { upsert: true, new: true }).lean(true);
{ serverId, roleId, activityId, roundIndex, },
{ $push: { challengeRecords: { count, time: new Date() } } }, { upsert: true, new: true }).lean(true);
return result;
}