许愿池bug

This commit is contained in:
mamengke01
2021-02-06 14:35:29 +08:00
parent 75ee4ec9b0
commit 406b833fd6
2 changed files with 7 additions and 5 deletions

View File

@@ -123,7 +123,7 @@ export class WishPoolHandler {
let sid = await getRedis(key); let sid = await getRedis(key);
let goods = await addItems(wishRoleId, role.roleName , sid , [{ id : wishGood.goodId, count: 1 }]); let goods = await addItems(wishRoleId, role.roleName , sid , [{ id : wishGood.goodId, count: 1 }]);
if (!!sid) { 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); 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})=>{ 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'); let userGuild = await getUserGuildWithRefActive(roleId, 'wishDntCnt wishGoods guildCode');
if (!userGuild) if (!userGuild)
return resResult(STATUS.WRONG_PARMS); return resResult(STATUS.WRONG_PARMS);
const { guildCode: code, wishGoods } = userGuild; const { wishGoods } = userGuild;
let index = findIndex(wishGoods, { id }); let index = findIndex(wishGoods, { id });
if (index == -1) if (index == -1)
return resResult(STATUS.WRONG_PARMS); return resResult(STATUS.WRONG_PARMS);
let { drawCnt, goodId } = wishGoods[index]; let { drawCnt, goodId } = wishGoods[index];
if (drawCnt <= 0) if (drawCnt <= 0)
return resResult(STATUS.WRONG_PARMS); return resResult(STATUS.WRONG_PARMS);
let goods = await addItems(roleId, roleName, sid, [{ id : goodId, count: drawCnt }]);
wishGoods[index].drawCnt = 0; 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 }); return resResult(STATUS.SUCCESS, { goods, wishGoods });
} }

View File

@@ -58,7 +58,7 @@ export default class BossInstance extends BaseModel {
} }
public static async openBossInstance(guildCode: string, bossHp: number, warId: number, bossLv: number, lean = true) { 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; return bossInstance;
} }
//记录玩家boss通关后首次查看boss关卡 //记录玩家boss通关后首次查看boss关卡