添加天梯排行榜,修复setHour有时差的bug
This commit is contained in:
@@ -92,7 +92,6 @@ export class DailyBattleHandler {
|
||||
await RoleModel.costGold(roleId, buyCost);
|
||||
let newDailyRecord = await DailyRecordModel.increseBuyCount(roleId, type, count);
|
||||
|
||||
console.log(buyCost);
|
||||
let checkDailyResult = await getDailyNum(newDailyRecord, timesPerDay, timesCanBuy);
|
||||
return resResult(STATUS.SUCCESS, { type, ...checkDailyResult, buyCost});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ExpeditionRecordModel } from '../../../db/ExpeditionRecord';
|
||||
import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord';
|
||||
import { ExpeditionPointModel } from '../../../db/ExpeditionPoint';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { calculateSumCE, genCode } from '../../../pubUtils/util';
|
||||
import { calculateSumCE, genCode, setLocalHours } from '../../../pubUtils/util';
|
||||
import { matchPlayers, matchRobots, getPointRewardStatus, getCEScaleAndRange } from '../../../services/expeditionService';
|
||||
import { EXPEDITION_INCREASE_POINT } from '../../../consts/consts';
|
||||
import { WarReward } from '../../../services/warRewardService';
|
||||
@@ -33,7 +33,7 @@ export class ExpeditionBattleHandler {
|
||||
|
||||
// 每日刷新,刷新关卡进度,宝箱进度,武将状态
|
||||
let now = new Date();
|
||||
let today = now.setHours(0, 0, 0, 0);
|
||||
let today = setLocalHours(0, now);
|
||||
let expeditionRecord = await ExpeditionRecordModel.getTodayRecord(roleId, today);
|
||||
if(!expeditionRecord) { // 每天新建一条记录
|
||||
let code = genCode(8);
|
||||
|
||||
@@ -252,7 +252,6 @@ export class NormalBattleHandler {
|
||||
if(!warInfo) {
|
||||
return resResult(STATUS.BATTLE_MISS_INFO);
|
||||
}
|
||||
console.log(warInfo)
|
||||
// 校验是否三星通关过
|
||||
let condition1 = await BattleRecordModel.getBattleRecordByIdAndStar(roleId, battleId, 3);
|
||||
if(!condition1) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TowerRecordModel } from './../../../db/TowerRecord';
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
import { getTaskById, getTowerDataByLv } from '../../../pubUtils/gamedata';
|
||||
import { decodeArrayStr, resResult, shouldRefresh, calculateNum } from '../../../pubUtils/util';
|
||||
import { calcuHangUpReward, checkTaskConditions, checkHangUpSpdUpCnt, createCurTasks, treatTask, getRemainTime } from '../../../services/battleService';
|
||||
import { calcuHangUpReward, checkTaskConditions, checkHangUpSpdUpCnt, createCurTasks, treatTask, getRemainTime, getTasksReward } from '../../../services/battleService';
|
||||
import { handleFixedReward, handleReward } from '../../../services/rewardService';
|
||||
|
||||
export default function(app: Application) {
|
||||
@@ -109,12 +109,10 @@ export class TowerBattleHandler {
|
||||
let {data: {hangUpSpdUpCnt, gold}} = result;
|
||||
|
||||
const costGold = this.getHangUpCost(hangUpSpdUpCnt, msg.speedUpCnt);
|
||||
console.log(costGold, gold)
|
||||
if(costGold > gold) {
|
||||
return resResult(STATUS.TOWER_GOLD_NOT_ENOUGH);
|
||||
}
|
||||
await RoleModel.costGold(roleId, costGold);
|
||||
console.log(costGold);
|
||||
|
||||
const spdUpResult = await RoleModel.hangUpSpdUp(roleId, msg.speedUpCnt, curTime);
|
||||
if (!spdUpResult) {
|
||||
@@ -170,7 +168,12 @@ export class TowerBattleHandler {
|
||||
}
|
||||
await RoleModel.increaseTowerRefCnt(roleId, needRefresh, curTime);
|
||||
|
||||
// tmp: 将刷掉的旧任务的奖励发送到邮件中
|
||||
let oldReward = await getTasksReward(roleId, curTime);
|
||||
console.log(JSON.stringify(oldReward));
|
||||
await TowerTaskRecModel.refreshTask(roleId); // 刷掉旧的任务
|
||||
|
||||
|
||||
let curTasks = await createCurTasks(towerLv, roleId, roleName); // 刷出新的任务
|
||||
|
||||
let nextCostGold = calculateNum(GOLD_COST_RATIO.TPWER_TASK_REF, {num: towerTaskReCnt + 1}, 200);
|
||||
@@ -255,4 +258,11 @@ export class TowerBattleHandler {
|
||||
const rec = await TowerTaskRecModel.finishTask(msg.batchCode, compTasks);
|
||||
return resResult(STATUS.SUCCESS, { compTasks: treatTask(rec, curTime), goods });
|
||||
}
|
||||
|
||||
|
||||
async getTowerRank(msg: {}, session: BackendSession) {
|
||||
let ranks = await RoleModel.getRank('tower', ['roleId', 'roleName', 'towerLv', 'lv', 'vLv']);
|
||||
|
||||
return resResult(STATUS.SUCCESS, { ranks });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user