任务:修复共斗任务达成

This commit is contained in:
luying
2021-04-25 18:10:40 +08:00
parent 5e43bcfe83
commit cbc58f8a7a
7 changed files with 43 additions and 38 deletions

View File

@@ -74,8 +74,8 @@ export class GachaHandler {
if (!dicGacha.count.includes(count)) return resResult(STATUS.WRONG_PARMS);
let userGacha = await UserGachaModel.findByRole(roleId, gachaId, activityId);
let { floor, freeCount, hope, point, pickHero, refFreeTime } = await refreshGacha(dicGacha, userGacha);
if ((gachaId == GACHA_ID.ASSIGN || gachaId == GACHA_ID.TIMELIMIT) && !pickHero) return resResult(STATUS.GACHA_NOT_ASSIGN);
let { floor, freeCount, hope, point, pickHero, refFreeTime, count: historyCount } = await refreshGacha(dicGacha, userGacha);
if((gachaId == GACHA_ID.ASSIGN|| gachaId == GACHA_ID.TIMELIMIT) && !pickHero) return resResult(STATUS.GACHA_NOT_ASSIGN);
let userHeroes = await HeroModel.findByRole(roleId);
@@ -98,7 +98,7 @@ export class GachaHandler {
heroInfo.push({ hid: result.hid, count: 1 })//默认1个英雄
}
} else {
items.push({ id: result.id, count });
items.push({ id: result.id, count: result.count });
}
resultList.push(result);
}
@@ -123,9 +123,9 @@ export class GachaHandler {
let { heroes } = await createHeroes(roleId, roleName, sid, serverId, funcs, heroInfo);
await addItems(roleId, roleName, sid, items);
// 更新数据
point = Math.floor(count / RECRUIT.RECRUIT_BONUS);
point = Math.floor((historyCount + 1)/RECRUIT.RECRUIT_BONUS);
userGacha = await UserGachaModel.updateInfo(roleId, gachaId, activityId, {
freeCount, hope, floor, count, point
freeCount, hope, floor, count: historyCount + 1, point
});
await UserGachaRecModel.createRec(roleId, gachaId, activityId, count, resultList);