抽卡:逻辑修复

This commit is contained in:
luying
2022-05-20 13:16:22 +08:00
parent 72739ee9cf
commit 14788c23b5
3 changed files with 25 additions and 12 deletions

View File

@@ -333,8 +333,12 @@ export class GachaHandler {
async getGuideGachaData(msg: {}, session: BackendSession) {
const { } = msg;
const roleId: string = session.get('roleId');
const userGacha = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL);
let { guideCount = 0, guideResultList = [], candidates = [] } = userGacha;
let { gachaHasGuide } = await RoleModel.findByRoleId(roleId, 'gachaHasGuide');
let guideCount = 0, guideResultList = [], candidates = [];
if(!gachaHasGuide) {
const userGacha = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL);
({ guideCount = 0, guideResultList = [], candidates = [] } = userGacha);
}
return resResult(STATUS.SUCCESS, {
guideCount,
@@ -370,7 +374,7 @@ export class GachaHandler {
let userHeroes = await HeroModel.findByRole(roleId);
let gachaPull = new GachaPull(gachaId);
gachaPull.setByUserGacha({...dicGacha, floorReward: 0}, userGacha, true);
gachaPull.setByUserGacha(dicGacha, userGacha, true);
let { resultList } = gachaPull.pull(count, userHeroes);
userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { guideResultList: resultList, guideCount: guideCount + 1 })