活动:修复问题

This commit is contained in:
陆莹
2022-03-22 11:47:30 +08:00
parent 4f5edb7386
commit 4f924eae4d
13 changed files with 64 additions and 82 deletions

View File

@@ -29,25 +29,25 @@ export default class Activity_Treasure_Hunt_Task extends ActivityGrowth {
}
// 更新任务
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, param: UpdateTaskParam) {
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, taskType: number, param: UpdateTaskParam) {
if(param.set) {
return await this.setTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, param.set, param.records);
return await this.setTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, taskType, param.set, param.records);
} else if (param.inc) {
return await this.addTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, param.inc, param.records);
return await this.addTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, taskType, param.inc, param.records);
}
}
//根据活动统计完成任务次数
public static async setTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, count: number, records?: string[]) {
public static async setTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, taskType: number, count: number, records?: string[]) {
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex },
{ $set: { totalCount: count, records: records||[] } }, { upsert: true, new: true }).lean();
{ $set: { totalCount: count, records: records||[], taskType } }, { upsert: true, new: true }).lean();
return result;
}
//根据活动统计完成任务次数
public static async addTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, count: number, records?: string[]) {
public static async addTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, taskType: number, count: number, records?: string[]) {
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex },
{ $inc: { totalCount: count }, $set: { records: records||[] } }, { upsert: true, new: true }).lean();
{ $inc: { totalCount: count }, $set: { records: records||[], taskType } }, { upsert: true, new: true }).lean();
return result;
}