活动:修改老接口
This commit is contained in:
@@ -9,6 +9,8 @@ import { ActivityThirtyDaysPointRewardModel } from '../../../db/ActivityThirtyDa
|
||||
import moment = require('moment');
|
||||
import { ActivityModel, ActivityModelType } from '../../../db/Activity';
|
||||
import { ServerlistModel } from '../../../db/Serverlist';
|
||||
import { addReward, stringToRewardParam } from '../../../services/giftPackageService';
|
||||
import { RewardParam } from '../../../domain/activityField/rewardField';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new ThirtyDaysHandler(app);
|
||||
@@ -94,17 +96,15 @@ export class ThirtyDaysHandler {
|
||||
}
|
||||
|
||||
await ActivityThirtyDaysModel.addRecord(serverId, activityId, roleId, pageIndex, cellIndex);
|
||||
let reward = thirtyDaysItemData.goodReward();
|
||||
let goods = await addItems(roleId, roleName, sid, reward);
|
||||
let heroReward = thirtyDaysItemData.heroReward();
|
||||
let addHeros = [];
|
||||
if (heroReward.length > 0) {
|
||||
let heroResult = await createHeroes(roleId, roleName, sid, serverId, funcs, heroReward);
|
||||
goods = goods.concat(heroResult.goods)
|
||||
addHeros = addHeros.concat(heroResult.heroes);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, { goods, addHeros });
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(thirtyDaysItemData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr)
|
||||
|
||||
thirtyDaysItemData.isReceive = true;
|
||||
return resResult(STATUS.SUCCESS, Object.assign(result, {
|
||||
param: { activityId, pageIndex, cellIndex },
|
||||
item: thirtyDaysItemData,
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,16 +136,19 @@ export class ThirtyDaysHandler {
|
||||
}
|
||||
|
||||
await ActivityThirtyDaysPointRewardModel.addRecord(activityId, roleId, cellIndex);
|
||||
let reward = thirtyDaysPointItemData.goodReward();
|
||||
let goods = await addItems(roleId, roleName, sid, reward);
|
||||
let heroReward = thirtyDaysPointItemData.heroReward();
|
||||
let addHeros = [];
|
||||
if (heroReward.length > 0) {
|
||||
let heroResult = await createHeroes(roleId, roleName, sid, serverId, funcs, heroReward);
|
||||
goods = goods.concat(heroResult.goods)
|
||||
addHeros = addHeros.concat(heroResult.heroes);
|
||||
|
||||
let reward = thirtyDaysPointItemData.reward
|
||||
if (thirtyDaysPointItemData.isExpired && thirtyDaysPointItemData.expiredReward && thirtyDaysPointItemData.expiredReward != '') {//过期奖励
|
||||
reward = thirtyDaysPointItemData.expiredReward;
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, { goods, addHeros });
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr)
|
||||
|
||||
thirtyDaysPointItemData.isReceive = true;
|
||||
return resResult(STATUS.SUCCESS, Object.assign(result, {
|
||||
param: { activityId, cellIndex },
|
||||
item: thirtyDaysPointItemData,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user