抽卡:修复转盘积分bug

This commit is contained in:
luying
2021-04-26 11:02:15 +08:00
parent 4fe0b6d145
commit 15d9bf099e
2 changed files with 17 additions and 11 deletions

View File

@@ -123,9 +123,8 @@ export class GachaHandler {
let { heroes } = await createHeroes(roleId, roleName, sid, serverId, funcs, heroInfo);
await addItems(roleId, roleName, sid, items);
// 更新数据
point = Math.floor((historyCount + count)/RECRUIT.RECRUIT_BONUS);
userGacha = await UserGachaModel.updateInfo(roleId, gachaId, activityId, {
freeCount, hope, floor, count: historyCount + count, point
freeCount, hope, floor, count: historyCount + count
});
await UserGachaRecModel.createRec(roleId, gachaId, activityId, count, resultList);
@@ -139,7 +138,7 @@ export class GachaHandler {
}
return resResult(STATUS.SUCCESS, {
gachaId, activityId,
freeCount, refFreeTime: resultRefFreeTime, count: userGacha.count, point, floor, hope,
freeCount, refFreeTime: resultRefFreeTime, count: userGacha.count, point: userGacha.point, floor, hope,
heroes, result: resultList
});
}
@@ -184,7 +183,8 @@ export class GachaHandler {
const funcs: number[] = session.get('funcs');
let userGacha = await UserGachaModel.findByRole(roleId, gachaId, 0);
let { point, turntable } = userGacha;
let { point, turntable, costPoint } = userGacha;
console.log('***drawTurnTable', point)
if (point < RECRUIT.RECRUIT_BONUS_RECRUIT) return resResult(STATUS.GACHA_TURNTABLE_POINT_NOT_ENOUGH);
let turntablePool: { quality: number, count: number }[] = [];
@@ -233,7 +233,7 @@ export class GachaHandler {
}
myTurntable.hasGet = true;
// 扣除积分
userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { point: point - 1, turntable });
userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { turntable, costPoint: costPoint + 1 });
return resResult(STATUS.SUCCESS, {
gachaId,