From 9c32f5aa3e89610194588e0dc1ce16573ce75c92 Mon Sep 17 00:00:00 2001 From: liangtongchuan Date: Mon, 20 Dec 2021 19:49:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E6=8E=89=E6=B3=A8=E9=87=8A=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared/pubUtils/taskUtil.ts | 63 ++----------------------------------- 1 file changed, 2 insertions(+), 61 deletions(-) diff --git a/shared/pubUtils/taskUtil.ts b/shared/pubUtils/taskUtil.ts index 9d61ca4d2..15cc46e49 100644 --- a/shared/pubUtils/taskUtil.ts +++ b/shared/pubUtils/taskUtil.ts @@ -495,6 +495,8 @@ export async function accomplishTask(serverId: number, roleId: string, taskType: if(activities) { let result: ActivityModelType[] = []; for(let activity of activities) { + // getActivities -> activities 获取所有结束时间在当前以后的活动 + // types: 活动类型 if(activityGroupId.includes(activity.groupId) && types.includes(activity.type)) { result.push(activity); } @@ -509,67 +511,6 @@ export async function accomplishTask(serverId: number, roleId: string, taskType: } } let { createTime } = await RoleModel.findByRoleId(roleId); - // //成长活动统计 - // let allActivity: ActivityModelType[] = await ActivityModel.findOpenActivityByType(activityGroupId, ACTIVITY_TYPE.TASK_GROWTH, new Date()); - // for (let activity of allActivity) { - // let growthActivity = new GrowthData(activity); - // let taskArray = growthActivity.findTaskByType(taskType); - // for (let task of taskArray) { - // let taskRecord = await ActivityGrowthModel.findDataByCellIndex(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType) - // let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null; - // let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData); - // if (addCount) { - // if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV) { - // let playerRecord = await ActivityGrowthModel.setTaskCount(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount); - // //推送 - // task.totalCount = playerRecord.totalCount; - // task.receiveRewardCount = playerRecord.receiveRewardCount ? playerRecord.receiveRewardCount : 0; - // pushMessage = pushMessage.concat(Object.assign(task, { activityId: growthActivity.activityId })); - // } else { - // let playerRecord = await ActivityGrowthModel.addTaskCount(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount); - // //推送 - // task.totalCount = playerRecord.totalCount; - // task.receiveRewardCount = playerRecord.receiveRewardCount ? playerRecord.receiveRewardCount : 0; - // pushMessage = pushMessage.concat(Object.assign(task, { activityId: growthActivity.activityId })); - // } - // } - // if (record) { - // await ActivityGrowthModel.addTaskRecord(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, JSON.stringify(record)); - // } - // } - // } - - // //今日挑战统计 - // allActivity = await ActivityModel.findOpenActivityByType(activityGroupId, ACTIVITY_TYPE.TASK_DAILY_CHALLENGES, new Date()); - // for (let activity of allActivity) { - // let growthActivity = new DailyChallengesData(activity); - // let taskArray = growthActivity.findTaskByType(taskType, growthActivity.today()); - // for (let task of taskArray) { - // let taskRecord = await ActivityDailyChallengesModel.findDataByCellIndex(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType) - // let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null - // let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData); - // if (addCount) { - // if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV) { - // let playerRecord = await ActivityDailyChallengesModel.setTaskCount(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount); - // //推送 - // task.totalCount = playerRecord.totalCount; - // task.receiveRewardCount = playerRecord.receiveRewardCount ? playerRecord.receiveRewardCount : 0; - // pushMessage = pushMessage.concat(Object.assign(task, { activityId: growthActivity.activityId })); - // } else { - // let playerRecord = await ActivityDailyChallengesModel.addTaskCount(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount); - // //推送 - // task.totalCount = playerRecord.totalCount; - // task.receiveRewardCount = playerRecord.receiveRewardCount ? playerRecord.receiveRewardCount : 0; - // pushMessage = pushMessage.concat(Object.assign(task, { activityId: growthActivity.activityId })); - // } - // } - // if (record) { - // await ActivityGrowthModel.addTaskRecord(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, JSON.stringify(record)); - // } - // } - // } - - // console.log('***** sevenDay before', Date.now()); //七天乐 let allActivity: ActivityModelType[] = await findActivitiesByTypes([ACTIVITY_TYPE.SEVEN_DAY]); for (let activity of allActivity) {