From c8a4334c0e14acc94393390c6ba64ad556fd9c5f Mon Sep 17 00:00:00 2001 From: qiaoxin Date: Wed, 2 Jun 2021 09:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=EF=BC=9A=E5=BC=B9=E5=87=BA?= =?UTF-8?q?=E7=A4=BC=E5=8C=85=E6=B7=BB=E5=8A=A0=E5=88=A4=E6=96=AD=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/popUpShopService.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/game-server/app/services/popUpShopService.ts b/game-server/app/services/popUpShopService.ts index 9c6c90fe1..860bd1f06 100644 --- a/game-server/app/services/popUpShopService.ts +++ b/game-server/app/services/popUpShopService.ts @@ -81,22 +81,22 @@ export async function makePopUpShopReward(roleId: string, roleName: string, sid: return STATUS.ACTIVITY_NO_PRODUCT; } let playerData = new PopUpShopData(allTaskData[taskIndex], activityId); - let playerRecords: ActivityPopUpShopModelType = await ActivityPopUpShopModel.addRecord(serverId, activityId, roleId, playerData.id, playerData.taskType); - if (!playerRecords) { + let playerRecord: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOpenDataByTaskId(serverId, activityId, roleId, playerData.id, playerData.taskType); + if (!playerRecord) { return STATUS.APPLY_ORDER_ERROR; } let curDate = new Date(); - if (curDate < playerRecords.beginTime || curDate > playerData.endTime) { + if (curDate < playerRecord.beginTime || curDate > playerRecord.endTime) { return STATUS.ACTIVITY_POP_UP_SHOP_CLOSED; } - if (playerRecords.totalCount < playerData.condition) { + if (playerRecord.totalCount < playerData.condition) { return STATUS.ACTIVITY_TASK_UNCOMPLETED; } - if (!playerRecords.isBuy) { + if (!playerRecord.isBuy) { return STATUS.ACTIVITY_REWARDED; } - - playerData.setPlayerRecords(playerRecords); + playerRecord = await ActivityPopUpShopModel.addRecord(serverId, activityId, roleId, playerData.id, playerData.taskType); + playerData.setPlayerRecords(playerRecord); let rewardParamArr: Array = stringToRewardParam(playerData.reward); let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr)