修改远征创建记录逻辑
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
import { DailyRecordModel } from '../../../db/DailyRecord';
|
||||
import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||
import { getGamedata } from '../../../pubUtils/gamedata';
|
||||
import { WAR_TYPE, GOLD_COST_RATIO } from '../../../consts/consts';
|
||||
import { GOLD_COST_RATIO } from '../../../consts/consts';
|
||||
import { STATUS } from '../../../consts/statusCode';
|
||||
import { resResult, calculateNum } from '../../../pubUtils/util';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
@@ -20,8 +19,7 @@ export class DailyBattleHandler {
|
||||
async getData(msg: { }, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
|
||||
const BattleRecord = await BattleRecordModel.getBattleList(roleId, WAR_TYPE.DAILY);
|
||||
|
||||
let {warStar} = await RoleModel.findByRoleId(roleId);
|
||||
let dicDaily = getGamedata('dic_zyz_daily');
|
||||
let dicDailyWar = getGamedata('dic_zyz_gk_daily');
|
||||
|
||||
@@ -32,13 +30,13 @@ export class DailyBattleHandler {
|
||||
for(let {war_id, dailyType, cost, gk_name, previousGk } of dicDailyWar) {
|
||||
if(dailyType == type) {
|
||||
let status = 0, star = 0;
|
||||
let curBattle = BattleRecord.find(cur => cur.battleId == war_id);
|
||||
let curBattle = warStar.find(cur => cur.id == war_id);
|
||||
if(curBattle) {
|
||||
status = 2;
|
||||
star = curBattle.star;
|
||||
} else {
|
||||
if (previousGk) {
|
||||
let preBattleRecord = BattleRecord.find(cur => cur.battleId == previousGk);
|
||||
let preBattleRecord = warStar.find(cur => cur.id == previousGk);
|
||||
if(preBattleRecord) {
|
||||
status = 1;
|
||||
} else {
|
||||
@@ -54,6 +52,7 @@ export class DailyBattleHandler {
|
||||
}
|
||||
}
|
||||
let checkDailyResult = await getDailyNum(refreshResult, timesPerDay, timesCanBuy);
|
||||
checkDailyResult['count'] = checkDailyResult.battleCount;
|
||||
result.push({
|
||||
type, name, ...checkDailyResult,
|
||||
wars
|
||||
@@ -94,6 +93,7 @@ export class DailyBattleHandler {
|
||||
let newDailyRecord = await DailyRecordModel.increseBuyCount(roleId, type, count);
|
||||
|
||||
let checkDailyResult = await getDailyNum(newDailyRecord, timesPerDay, timesCanBuy);
|
||||
checkDailyResult['count'] = checkDailyResult.battleCount;
|
||||
return resResult(STATUS.SUCCESS, { type, ...checkDailyResult, buyCost});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user