From f37a29d2b2d2dca785fd6830af2accb150565767 Mon Sep 17 00:00:00 2001 From: qiaoxin Date: Wed, 9 Jun 2021 20:59:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=EF=BC=9A=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=86=9B=E5=9B=A2=E6=B4=BB=E5=8A=A8=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../servers/activity/handler/popUpShopHandler.ts | 12 ++++++------ game-server/app/services/popUpShopService.ts | 2 +- shared/pubUtils/taskUtil.ts | 13 +++++++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/game-server/app/servers/activity/handler/popUpShopHandler.ts b/game-server/app/servers/activity/handler/popUpShopHandler.ts index 2e1704752..76fbbfe37 100644 --- a/game-server/app/servers/activity/handler/popUpShopHandler.ts +++ b/game-server/app/servers/activity/handler/popUpShopHandler.ts @@ -40,19 +40,19 @@ export class PopUpShopHandler { /** * @description 购买礼包 - * @param {{ activityId: number, id: number, beginTime: Date}} msg + * @param {{ activityId: number, id: number, beginTimeStamp: number}} msg * @param {BackendSession} session * @memberof PopUpShopHandler */ - async buyGift(msg: { activityId: number, id: number, beginTime: Date }, session: BackendSession) { - const { activityId, id, beginTime } = msg; + async buyGift(msg: { activityId: number, id: number, beginTimeStamp: number }, session: BackendSession) { + const { activityId, id, beginTimeStamp } = msg; const roleId = session.get('roleId'); const serverId = session.get('serverId'); const sid = session.get('sid'); const roleName = session.get('roleName'); const funcs: number[] = session.get('funcs'); + let beginTime = moment(beginTimeStamp).toDate(); - let beginDate = moment(beginTime).toDate(); let activityData: ActivityModelType = await ActivityModel.findActivity(activityId); if (!activityData) { return resResult(STATUS.ACTIVITY_MISSING); @@ -74,7 +74,7 @@ export class PopUpShopHandler { return resResult(STATUS.ACTIVITY_NEED_PAY); } - let playerRecords: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findDataByBeginTime(serverId, activityId, roleId, id, playerData.taskType, beginDate); + let playerRecords: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findDataByBeginTime(serverId, activityId, roleId, id, playerData.taskType, beginTime); if (!playerRecords) { return resResult(STATUS.ACTIVITY_POP_UP_SHOP_EXPIRE); } @@ -98,7 +98,7 @@ export class PopUpShopHandler { let rewardParamArr: Array = stringToRewardParam(playerData.reward); let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr) - await ActivityPopUpShopModel.addRecord(serverId, activityId, roleId, id, playerData.taskType, 1, beginDate); + await ActivityPopUpShopModel.addRecord(serverId, activityId, roleId, id, playerData.taskType, 1, beginTime); playerData.buyCount += 1; return resResult(STATUS.SUCCESS, Object.assign(result, { diff --git a/game-server/app/services/popUpShopService.ts b/game-server/app/services/popUpShopService.ts index e27fd1d11..28fa69a47 100644 --- a/game-server/app/services/popUpShopService.ts +++ b/game-server/app/services/popUpShopService.ts @@ -72,7 +72,7 @@ export async function makePopUpShopReward(roleId: string, roleName: string, sid: return STATUS.ORDER_PARAM_ERROR; } let paramObj = JSON.parse(paramStr); - let beginTime = moment(paramObj.beginTime).toDate(); + let beginTime = moment(paramObj.beginTimeStamp).toDate(); let activityData: ActivityModelType = await ActivityModel.findActivity(activityId); if (!activityData) { diff --git a/shared/pubUtils/taskUtil.ts b/shared/pubUtils/taskUtil.ts index 10897673c..c7d851433 100644 --- a/shared/pubUtils/taskUtil.ts +++ b/shared/pubUtils/taskUtil.ts @@ -750,13 +750,13 @@ export async function accomplishTask(serverId: number, roleId: string, taskType: let playerRecord = await ActivityPopUpShopModel.addTaskPushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, count, beginTime, endTime); popShopData.setPlayerRecords(playerRecord) pushMessage = pushMessage.concat(popShopData); - } else if (taskType == TASK_TYPE.EQUIP_QUALITY_COUNT || taskType == TASK_TYPE.GACHA_QUALITY_COUNT) {//每天统计 + } else if (taskType == TASK_TYPE.EQUIP_QUALITY_COUNT || taskType == TASK_TYPE.GACHA_QUALITY_COUNT || taskType == TASK_TYPE.GUILD_ACTIVITY) {//每天统计 let recordDate = moment(new Date()).startOf('d').toDate() let recordData: ActivityPopUpShopRecordModelType = await ActivityPopUpShopRecordModel.findRecordData(serverId, activity.activityId, roleId, task.id, task.taskType, recordDate) let { addCount } = isComplete(roleId, task.taskType, task.taskParam, count, parma, null); let oldCount = (recordData && recordData.count) ? recordData.count : 0; if (oldCount < task.condition && (oldCount + addCount >= task.condition)) {//完成当天任务 - let playerRecord = await ActivityPopUpShopModel.addTaskPushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, addCount, beginTime, endTime); + let playerRecord = await ActivityPopUpShopModel.addTaskPushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, oldCount + addCount, beginTime, endTime); popShopData.setPlayerRecords(playerRecord) pushMessage = pushMessage.concat(popShopData); } @@ -947,8 +947,13 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin addCount = count; break; case TASK_TYPE.GUILD_ACTIVITY: - addCount = count; - break; + { + let aid = paramObj.aid; + if (param[0] == 0 || aid == param[0]) { + addCount = count; + } + break; + } case TASK_TYPE.EQUIP_SUM: addCount = count; break;