活动:月卡权限
This commit is contained in:
@@ -36,13 +36,10 @@ export class DailyBattleHandler {
|
||||
|
||||
const curDaily = gameData.daily.find(cur => cur.dailyType == type);
|
||||
if(!curDaily) return resResult(STATUS.DAILY_TYPE_NOT_FOUND);
|
||||
let { timesPerDay, timesCanBuy } = curDaily;
|
||||
|
||||
let { buyCount = 0 } = await DailyRecordModel.refreshRecord(roleId, type);
|
||||
let { vLv } = await RoleModel.findByRoleId(roleId);
|
||||
if(vLv > 0) {
|
||||
timesCanBuy += 0; // 暂留,用于处理vip等级增加最大购买次数
|
||||
}
|
||||
if(buyCount + count > timesCanBuy ) {
|
||||
|
||||
if(buyCount + count > curDaily.timesCanBuy ) {
|
||||
return resResult(STATUS.DAILY_REFRESH_TIMES_LACK)
|
||||
}
|
||||
let buyCost = 0;
|
||||
@@ -50,15 +47,15 @@ export class DailyBattleHandler {
|
||||
let num = buyCount + i;
|
||||
buyCost += getDailyBuyCountCost(num);
|
||||
}
|
||||
let {gold} = await RoleModel.findByRoleId(roleId);
|
||||
if(buyCost > gold) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
if(buyCost > role.gold) {
|
||||
return resResult(STATUS.DAILY_REFRESH_GOLD_LACK);
|
||||
}
|
||||
|
||||
await handleCost(roleId, sid, [getGoldObject(buyCost)], ITEM_CHANGE_REASON.DAILY_BATTLE_BUY_CNT);
|
||||
let newDailyRecord = await DailyRecordModel.increseBuyCount(roleId, type, count);
|
||||
|
||||
let checkDailyResult = await getDailyNum(newDailyRecord, timesPerDay, timesCanBuy);
|
||||
let checkDailyResult = await getDailyNum(newDailyRecord, role);
|
||||
return resResult(STATUS.SUCCESS, { type, ...checkDailyResult, buyCost});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user