活动:寻宝骑兵活动添加推送任务

This commit is contained in:
qiaoxin
2021-06-08 21:29:09 +08:00
parent 63845d09c7
commit f64bd7bdd2
4 changed files with 102 additions and 0 deletions

View File

@@ -10,6 +10,8 @@ export default class Activity_Treasure_Hunt_Task extends ActivityGrowth {
@prop({ required: true })
roundIndex: number; // 周期
@prop({ required: true })
isPush: boolean; // 是否推送过
//任务领取记录
@@ -25,6 +27,34 @@ export default class Activity_Treasure_Hunt_Task extends ActivityGrowth {
return result;
}
//查询活动数据
public static async findDataByCellIndex(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number) {
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOne({ serverId, roleId, activityId, roundIndex, cellIndex }).lean(true);
return result;
}
//根据活动统计完成任务次数
public static async addTreasureHuntTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, addCount: number) {
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex },
{ $inc: { totalCount: addCount } }, { upsert: true, new: true }).lean(true);
return result;
}
//根据活动记录统计数据
public static async addTreasureHuntTaskRecord(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, data: string,) {
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex },
{ $set: { data: data } }, { upsert: true, new: true }).lean(true);
return result;
}
//推送标记
public static async pushMessage(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number,) {
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex },
{ $set: { isPush: true, } }, { upsert: true, new: true }).lean(true);
return result;
}
//删除活动领取记录
public static async deleteActivity(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number) {
await ActivityTreasureHuntTaskModel.deleteMany({ serverId, roleId, activityId, roundIndex, cellIndex });