活动:弹出商店添加条件判断
This commit is contained in:
@@ -15,6 +15,7 @@ import moment = require('moment');
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { playerThirtyDaysActivityDays, thirtyDaysActivity } from '../../../services/thirtyDaysService';
|
||||
import { dailyRMBGiftsActivity } from '../../../services/dailyRMBGiftsService';
|
||||
import { popUpShopActivity } from '../../../services/popUpShopService';
|
||||
// import { ActivityDailyChallengesModel } from '../../../db/ActivityDailyChallenges';
|
||||
// import { isComplete } from '../../../pubUtils/taskUtil';
|
||||
|
||||
@@ -332,6 +333,18 @@ export class ActivityHandler {
|
||||
}
|
||||
}
|
||||
|
||||
//弹出商店 24
|
||||
{
|
||||
let data = await popUpShopActivity(serverId, roleId);
|
||||
if (data) {
|
||||
playerActivityArray.push({
|
||||
type: ACTIVITY_TYPE.POP_UP_SHOP,
|
||||
activityId: 0,
|
||||
data,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, { playerActivityArray });
|
||||
}
|
||||
|
||||
|
||||
@@ -55,13 +55,6 @@ export class PopUpShopHandler {
|
||||
if (!activityData) {
|
||||
return resResult(STATUS.ACTIVITY_MISSING);
|
||||
}
|
||||
let playerRecords: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOpenDataByTaskId(serverId, activityId, roleId, id);
|
||||
if (!playerRecords) {
|
||||
return resResult(STATUS.ACTIVITY_POP_UP_SHOP_EXPIRE);
|
||||
}
|
||||
if (playerRecords.isBuy) {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
}
|
||||
|
||||
let allTaskData: any[] = JSON.parse(activityData.data);
|
||||
let taskIndex = allTaskData.findIndex(obj => { return obj && obj.id == id });
|
||||
@@ -69,7 +62,7 @@ export class PopUpShopHandler {
|
||||
return resResult(STATUS.ACTIVITY_DATA_ERROR);
|
||||
}
|
||||
|
||||
let playerData = new PopUpShopData(allTaskData[taskIndex]);
|
||||
let playerData = new PopUpShopData(allTaskData[taskIndex], activityId);
|
||||
|
||||
if (playerData.price) {
|
||||
return resResult(STATUS.ACTIVITY_NEED_PAY);
|
||||
@@ -79,6 +72,18 @@ export class PopUpShopHandler {
|
||||
return resResult(STATUS.ACTIVITY_NEED_PAY);
|
||||
}
|
||||
|
||||
let playerRecords: ActivityPopUpShopModelType = await ActivityPopUpShopModel.findOpenDataByTaskId(serverId, activityId, roleId, id, playerData.taskType);
|
||||
if (!playerRecords) {
|
||||
return resResult(STATUS.ACTIVITY_POP_UP_SHOP_EXPIRE);
|
||||
}
|
||||
if (playerRecords.isBuy) {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
}
|
||||
|
||||
if (playerData.condition > playerRecords.totalCount) {
|
||||
return resResult(STATUS.ACTIVITY_TASK_UNCOMPLETED);
|
||||
}
|
||||
|
||||
//元宝消费
|
||||
let arr = splitString(playerData.consume, '&')
|
||||
if (arr[0] != ACTIVITY_RESOURCES_TYPE.GOODS || arr[1] != CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD)) {
|
||||
@@ -90,7 +95,12 @@ export class PopUpShopHandler {
|
||||
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(playerData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr)
|
||||
return resResult(STATUS.SUCCESS, result);
|
||||
|
||||
playerData.isBuy = true;
|
||||
return resResult(STATUS.SUCCESS, Object.assign(result, {
|
||||
param: { activityId, id },
|
||||
item: playerData
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
import { deltaDays, resResult } from '../../../pubUtils/util';
|
||||
import { STATUS, ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../../consts';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { STATUS, ACTIVITY_TYPE } from '../../../consts';
|
||||
import { getPlayerThirtyDaysData, playerThirtyDaysActivityDays, thirtyDaysActivity } from '../../../services/thirtyDaysService';
|
||||
import { ThirtyDaysData, ThirtyDaysItem, ThirtyDaysPointItem } from '../../../domain/activityField/thirtyDaysField';
|
||||
import { addItems, createHeroes } from '../../../services/rewardService';
|
||||
import { ActivityThirtyDaysModel } from '../../../db/ActivityThirtyDays';
|
||||
import { ActivityThirtyDaysPointRewardModel } from '../../../db/ActivityThirtyDaysPointReward';
|
||||
import moment = require('moment');
|
||||
import { ActivityModel, ActivityModelType } from '../../../db/Activity';
|
||||
import { ServerlistModel } from '../../../db/Serverlist';
|
||||
import { addReward, stringToRewardParam } from '../../../services/giftPackageService';
|
||||
|
||||
Reference in New Issue
Block a user