训练场宝箱展示bug

This commit is contained in:
mamengke01
2021-02-06 11:55:36 +08:00
parent d9bea0444c
commit d9458ede5f
22 changed files with 246 additions and 108 deletions

View File

@@ -85,13 +85,14 @@ export class GuildTrainHandler {
let { trainInstances: instances } = getArmyTrainJuDian(trainId);
let flag = false;
let boxRewards = [];
let isComplete = false;
trainInstances.map(({hid, progress, endTime, trainBoxs})=>{
let instance = findWhere(instances, { hid });
let isComplete = false;
if ( progress >= instance.progress)
if ( progress >= instance.progress) {
isComplete = true;
if (endTime > nowSeconds())
flag = true;
if (endTime > nowSeconds())
flag = true;
}
boxRewards.push({hid, recordBoxs: trainBoxs, trainId, endTime, isComplete});
});
if (flag) {
@@ -150,13 +151,13 @@ export class GuildTrainHandler {
return resResult(STATUS.WRONG_PARMS);
const { guildCode: code } = userGuild;
const battleRecord = await BattleRecordModel.getBattleRecordByCode(battleCode, true);
// if (!battleRecord || battleRecord.status != 0 || roleId != battleRecord.roleId || battleRecord.record.guildCode != code) {
// return resResult(STATUS.WRONG_PARMS);
// }
if (!battleRecord || battleRecord.status != 0 || roleId != battleRecord.roleId || battleRecord.record.guildCode != code) {
return resResult(STATUS.WRONG_PARMS);
}
let time = Math.floor(battleRecord.createdAt.getTime()/1000);
// if (userGuild.trainCount - 1 < 0) {
// return resResult(STATUS.WRONG_PARMS);
// }
if (userGuild.trainCount - 1 < 0) {
return resResult(STATUS.WRONG_PARMS);
}
if (time < getCurHourPoint(REFRESH_HOUR) && nowSeconds() > getCurHourPoint(REFRESH_HOUR)) {
return resResult(STATUS.GUILD_TRAIN_IS_RESETED);//关卡已经重置