任务:修复任务很多问题
This commit is contained in:
@@ -59,11 +59,20 @@ export default class UserTaskRec extends BaseModel {
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
||||
public static async recordTaskRec(roleId: string, type: number, taskType: number, group: string, records?: string[]) {
|
||||
let condition = this.getRefreshCondition(type);
|
||||
let rec: UserTaskRecType = await UserTaskRecModel.findOneAndUpdate({ roleId, group, taskType, ...condition }, { $setOnInsert: { code: genCode(8), received: [] }, $set: { records: records||[] } }, { new: true, upsert: true }).lean();
|
||||
return rec;
|
||||
}
|
||||
|
||||
public static async setOrIncTask(roleId: string, type: number, taskType: number, group: string, param: UpdateTaskParam) {
|
||||
if(param.set) {
|
||||
return await this.setTaskRec(roleId, type, taskType, group, param.set, param.records);
|
||||
} else if (param.inc) {
|
||||
return await this.incTaskRec(roleId, type, taskType, group, param.inc, param.records);
|
||||
} else if (param.records) {
|
||||
return await this.recordTaskRec(roleId, type, taskType, group, param.records);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user