训练场宝箱展示bug
This commit is contained in:
@@ -20,6 +20,8 @@ import { lockData } from '../../../services/redLockService';
|
||||
import { DATA_NAME } from '../../../consts/dataName';
|
||||
import { openGuildRefine } from '../../../services/guildRefineService';
|
||||
import { unlockTrain } from '../../../services/guildTrainService';
|
||||
import { removeBossRank } from '../../../services/guildBossService';
|
||||
import { removeTrainRank } from '../../../services/guildTrainService';
|
||||
export default function (app: Application) {
|
||||
return new GuildHandler(app);
|
||||
}
|
||||
@@ -601,7 +603,9 @@ export class GuildHandler {
|
||||
|
||||
const guild = await GuildModel.quit(code, roleId, serverId, role.ce, userGuild.auth == GUILD_AUTH.MANAGER);
|
||||
if(!guild) return resResult(STATUS.GUILD_QUIT_ERROR);
|
||||
|
||||
//删除排名信息
|
||||
await removeBossRank(code, roleId);
|
||||
await removeTrainRank(code, roleId, guild.trainId);
|
||||
// 添加动态
|
||||
const rec = await GuildRecModel.createGuildRec(roleId, code, GUILD_REC_TYPE.QUIT_GUILD, [roleName]);
|
||||
this.app.rpc.chat.guildRemote.addRec.toServer(CHAT_SERVER,rec);
|
||||
@@ -635,6 +639,10 @@ export class GuildHandler {
|
||||
|
||||
const guild = await GuildModel.quit(code, memberRoleId, serverId, role.ce, userGuild.auth == GUILD_AUTH.MANAGER);
|
||||
if(!guild) return resResult(STATUS.GUILD_KICK_ERROR);
|
||||
|
||||
//删除排名信息
|
||||
await removeBossRank(code, roleId);
|
||||
await removeTrainRank(code, roleId, guild.trainId);
|
||||
|
||||
this.app.rpc.chat.guildRemote.memberQuit.toServer(CHAT_SERVER,code, roleId, guild);
|
||||
|
||||
|
||||
@@ -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);//关卡已经重置
|
||||
|
||||
@@ -87,7 +87,7 @@ export class WishPoolHandler {
|
||||
count = wishGoodsHero.count;
|
||||
}
|
||||
const id = genCode(6);
|
||||
let { wishGoods: resWishGoods } = await UserGuildModel.pushAndUpdate(roleId, {}, { wishGoods: { type, goodId, count, receiveCnt: 0, drawCnt: 0, id} }, 'wishGoods');
|
||||
let { wishGoods: resWishGoods } = await UserGuildModel.pushAndUpdate(roleId, {}, { wishGoods: { type, goodId, count, receiveCnt: 0, drawCnt: 0, id, donateNames:[]} }, 'wishGoods');
|
||||
return resResult(STATUS.SUCCESS, { wishGoods: resWishGoods });
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ export class WishPoolHandler {
|
||||
if (wishGood.receiveCnt >= wishGood.count)
|
||||
return resResult(STATUS.HAS_RECEIVE_WISH_GOOD);//已经收到
|
||||
let { wishDntCnt } = await UserGuildModel.donateGoods(dntRoleId, 1, 'wishDntCnt');
|
||||
let { wishGoods: resWishGoods } = await UserGuildModel.donateUpdate(wishRoleId, id, 'wishGoods');
|
||||
let { wishGoods: resWishGoods } = await UserGuildModel.donateUpdate(wishRoleId, dntRoleName, id, 'wishGoods');
|
||||
let key = 'login_roleId_' + wishRoleId;
|
||||
let sid = await getRedis(key);
|
||||
let goods = await addItems(wishRoleId, role.roleName , sid , [{ id : wishGood.goodId, count: 1 }]);
|
||||
|
||||
Reference in New Issue
Block a user