🐞 fix(重阳集会): 添加购买消耗
This commit is contained in:
@@ -4,8 +4,8 @@ import { ITEM_CHANGE_REASON, STATUS } from '../../../consts';
|
||||
import { getPlayerChongYangData, getPlayerChongYangDataShow } from '../../../services/activity/chongyangService';
|
||||
import { ActivityChongYangRecModel } from '../../../db/ActivityChongYangRec';
|
||||
import { RewardInter } from '../../../pubUtils/interface';
|
||||
import { stringToRewardParam } from '../../../services/activity/giftPackageService';
|
||||
import { addItems } from '../../../services/role/rewardService';
|
||||
import { stringToConsumeParam, stringToRewardParam } from '../../../services/activity/giftPackageService';
|
||||
import { addItems, handleCost } from '../../../services/role/rewardService';
|
||||
import { getZeroPoint } from '../../../pubUtils/timeUtil';
|
||||
|
||||
|
||||
@@ -109,6 +109,9 @@ export class ChongYangHandler {
|
||||
// 检测解锁
|
||||
if (dayIndex > playerData.dayIndexUnlock) return resResult(STATUS.ACTIVITY_CHONGYANG_LOCK);
|
||||
|
||||
// 扣材料
|
||||
let costResult = await handleCost(roleId, sid, stringToConsumeParam(scene.buyCost), ITEM_CHANGE_REASON.ACT_ENTERTAIN_BUY_COST);
|
||||
if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
// 保存数据
|
||||
let playerRecord = await ActivityChongYangRecModel.buyCnt(serverId, activityId, playerData.roundIndex, roleId, { dayIndex, buyCnt: count }, scene.isPushBuyRecord);
|
||||
if (!playerRecord) return resResult(STATUS.ACTIVITY_CHONGYANG_GAMECODE_NOT_FOUND);
|
||||
@@ -136,7 +139,7 @@ export class ChongYangHandler {
|
||||
// 检测解锁
|
||||
if (dayIndex > playerData.dayIndexUnlock) return resResult(STATUS.ACTIVITY_CHONGYANG_LOCK);
|
||||
// 检测通关
|
||||
let isHasPass = playerData.gameRecords.find(cur => cur.dayIndex == dayIndex && cur.isSuccess && !cur.isSkip && (getZeroPoint()*1000 <= cur.time.getTime()));
|
||||
let isHasPass = playerData.gameRecords.find(cur => cur.dayIndex == dayIndex && cur.isSuccess && !cur.isSkip && (getZeroPoint() * 1000 <= cur.time.getTime()));
|
||||
if (!isHasPass) return resResult(STATUS.ACTIVITY_CHONGYANG_GAMESWEEP_LOCK);
|
||||
|
||||
let rewards: RewardInter[] = [];
|
||||
|
||||
Reference in New Issue
Block a user