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)