From 406b833fd651f1b8b0e8efc4c0fd9ae84cf587da Mon Sep 17 00:00:00 2001 From: mamengke01 <794347210@qq.com> Date: Sat, 6 Feb 2021 14:35:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B8=E6=84=BF=E6=B1=A0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/servers/battle/handler/wishPoolHandler.ts | 10 ++++++---- shared/db/BossInstance.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/game-server/app/servers/battle/handler/wishPoolHandler.ts b/game-server/app/servers/battle/handler/wishPoolHandler.ts index a3a480034..29a620d5a 100644 --- a/game-server/app/servers/battle/handler/wishPoolHandler.ts +++ b/game-server/app/servers/battle/handler/wishPoolHandler.ts @@ -123,7 +123,7 @@ export class WishPoolHandler { let sid = await getRedis(key); let goods = await addItems(wishRoleId, role.roleName , sid , [{ id : wishGood.goodId, count: 1 }]); if (!!sid) { - this.app.channelService.pushMessageByUids('onWishGoodsRecive', resResult(STATUS.SUCCESS, { goods }), [{uid:wishRoleId, sid}]); + this.app.channelService.pushMessageByUids('onWishGoodsRecive', resResult(STATUS.SUCCESS, { wishGoods: resWishGoods }), [{uid:wishRoleId, sid}]); } await WishPoolReportModel.addReport(code, wishRoleId, role.roleName , dntRoleId, dntRoleName, wishGood.goodId, 1); return resResult(STATUS.SUCCESS, { wishDntCnt, updateWishGoods: resWishGoods.map(({type, goodId, count, receiveCnt, drawCnt, id})=>{ @@ -140,16 +140,18 @@ export class WishPoolHandler { let userGuild = await getUserGuildWithRefActive(roleId, 'wishDntCnt wishGoods guildCode'); if (!userGuild) return resResult(STATUS.WRONG_PARMS); - const { guildCode: code, wishGoods } = userGuild; + const { wishGoods } = userGuild; let index = findIndex(wishGoods, { id }); if (index == -1) return resResult(STATUS.WRONG_PARMS); let { drawCnt, goodId } = wishGoods[index]; if (drawCnt <= 0) return resResult(STATUS.WRONG_PARMS); - let goods = await addItems(roleId, roleName, sid, [{ id : goodId, count: drawCnt }]); wishGoods[index].drawCnt = 0; - await UserGuildModel.updateInfo(code, { wishGoods }, {}); + let result = await UserGuildModel.updateInfo(roleId, { wishGoods }, {}); + if (!result) + resResult(STATUS.INTERNAL_ERR); + let goods = await addItems(roleId, roleName, sid, [{ id : goodId, count: drawCnt }]); return resResult(STATUS.SUCCESS, { goods, wishGoods }); } diff --git a/shared/db/BossInstance.ts b/shared/db/BossInstance.ts index 3f5398102..8df436192 100644 --- a/shared/db/BossInstance.ts +++ b/shared/db/BossInstance.ts @@ -58,7 +58,7 @@ export default class BossInstance extends BaseModel { } public static async openBossInstance(guildCode: string, bossHp: number, warId: number, bossLv: number, lean = true) { - const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ guildCode },{ranks:[], time: nowSeconds(), bossHp, bossLv, warId, $inc: { recordNum: 1 }}, {new: true, upsert: true}).lean(lean); + const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ guildCode },{ranks:[], time: nowSeconds(), bossHp, bossLv, warId, $inc: { num: 1 }}, {new: true, upsert: true}).lean(lean); return bossInstance; } //记录玩家boss通关后首次查看boss关卡