活动:弹出礼包添加判断条件
This commit is contained in:
@@ -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<RewardParam> = stringToRewardParam(playerData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr)
|
||||
|
||||
Reference in New Issue
Block a user