整理代码结构,使用service
This commit is contained in:
@@ -5,9 +5,12 @@ import { ExpeditionRecordModel } from '../../../db/ExpeditionRecord';
|
||||
import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord';
|
||||
import { ExpeditionPointModel } from '../../../db/ExpeditionPoint';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { calculateSumCE, genCode, Reward, decodeStr } from '../../../util/util';
|
||||
import { matchPlayers, matchRobots, getAp, setAp, WarReward, getPointRewardStatus, getCEScaleAndRange } from './battleUtils';
|
||||
import { calculateSumCE, genCode } from '../../../util/util';
|
||||
import { matchPlayers, matchRobots, getPointRewardStatus, getCEScaleAndRange } from '../../../services/expeditionService';
|
||||
import { EXPEDITION_INCREASE_POINT } from '../../../consts/consts';
|
||||
import { WarReward } from '../../../services/warRewardService';
|
||||
import { handleFixedReward } from '../../../services/rewardService';
|
||||
import { getAp, setAp } from '../../../services/actionPointService';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new ExpeditionBattleHandler(app);
|
||||
@@ -275,9 +278,7 @@ export class ExpeditionBattleHandler {
|
||||
let result = await ExpeditionWarRecordModel.updateBoxStatus(expeditionCode, expeditionId, true, curDicExpedition.reward);
|
||||
let { battleId, battleCode, battleStatus, received } = result;
|
||||
// 获取东西
|
||||
let rewards = decodeStr('fixReward', curDicExpedition.reward);
|
||||
let rewardObject = new Reward(roleId, roleName, rewards);
|
||||
let goods = await rewardObject.saveReward();
|
||||
let goods = await handleFixedReward(roleId, roleName, curDicExpedition.reward, 1);
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
@@ -323,10 +324,7 @@ export class ExpeditionBattleHandler {
|
||||
// 标记状态
|
||||
await ExpeditionPointModel.updatePointStatus(roleId, point, curDicExpeditionPoint.reward);
|
||||
let pointRewards = await getPointRewardStatus(roleId);
|
||||
|
||||
let rewards = decodeStr('fixReward', curDicExpeditionPoint.reward);
|
||||
let rewardObject = new Reward(roleId, roleName, rewards);
|
||||
let goods = await rewardObject.saveReward();
|
||||
let goods = await handleFixedReward(roleId, roleName, curDicExpeditionPoint.reward, 1);
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
|
||||
Reference in New Issue
Block a user