活动:成长活动统计任务,领取奖励接口
This commit is contained in:
@@ -4,12 +4,12 @@ import { STATUS, TASK_TYPE } from '../../../consts';
|
||||
import { GuildTrainModel } from '../../../db/GuildTrain';
|
||||
import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||
import { nowSeconds, getHourPoint, getCurHourPoint } from '../../../pubUtils/timeUtil';
|
||||
import { getUserGuild, getGuildTrainInfo, unlockTrain, resetTrain, getGuildTrainRewards} from '../../../services/guildTrainService';
|
||||
import { getUserGuild, getGuildTrainInfo, unlockTrain, resetTrain, getGuildTrainRewards } from '../../../services/guildTrainService';
|
||||
import { findIndex, findWhere, indexBy } from 'underscore'
|
||||
import { lockData } from '../../../services/redLockService';
|
||||
import { lockData } from '../../../services/redLockService';
|
||||
import { REFRESH_HOUR, GUILD_REPORT_NUM, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
||||
import { UserGuildModel } from '../../../db/UserGuild';
|
||||
import { GuildModel } from '../../../db/Guild';
|
||||
import { UserGuildModel } from '../../../db/UserGuild';
|
||||
import { GuildModel } from '../../../db/Guild';
|
||||
import { getArmyTrainJuDian, getTrainSoloReward, getTrainBaseByLv } from '../../../pubUtils/data';
|
||||
import { CURRENCY_BY_TYPE, CURRENCY_TYPE } from '../../../consts/constModules/itemConst';
|
||||
import { handleCost, addItems } from '../../../services/rewardService';
|
||||
@@ -19,6 +19,7 @@ import { GuildTrainReportModel } from '../../../db/GuildTrainReport';
|
||||
import { DATA_NAME } from '../../../consts/dataName';
|
||||
import { pushGuildTrainSucMsg } from '../../../services/chatService';
|
||||
import { checkTask } from '../../../services/taskService';
|
||||
import { accomplishTask } from '../../../pubUtils/taskUtil';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new GuildTrainHandler(app);
|
||||
@@ -34,17 +35,17 @@ export class GuildTrainHandler {
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let { trainId, trainLv } = await GuildModel.findGuild(code, serverId, 'trainId trainLv');
|
||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId);
|
||||
if (!guildTrain ) {
|
||||
if (!guildTrain) {
|
||||
guildTrain = await unlockTrain(code, trainId);
|
||||
}
|
||||
let { trainCount, trainRewards, buyTrainCount } = userGuild;
|
||||
let result:any = getGuildTrainInfo(guildTrain, roleId, trainCount, trainRewards);
|
||||
result.buyTrainCount = buyTrainCount||0;
|
||||
let result: any = getGuildTrainInfo(guildTrain, roleId, trainCount, trainRewards);
|
||||
result.buyTrainCount = buyTrainCount || 0;
|
||||
result.trainLv = trainLv;
|
||||
return resResult(STATUS.SUCCESS, result);
|
||||
}
|
||||
@@ -53,7 +54,7 @@ export class GuildTrainHandler {
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let trainIds = [];
|
||||
@@ -63,11 +64,11 @@ export class GuildTrainHandler {
|
||||
trainIds.push(trainId - 1);
|
||||
let trainReports = await GuildTrainReportModel.findGuildTrainByTrainIds(code, trainIds);
|
||||
let reports = [];
|
||||
trainReports.map(({ reports: resReports, trainId: resTrainId})=>{
|
||||
trainReports.map(({ reports: resReports, trainId: resTrainId }) => {
|
||||
if (resTrainId != trainId) {
|
||||
let lenNum = resReports.length;
|
||||
resReports = resReports.splice(lenNum - GUILD_REPORT_NUM - 1, GUILD_REPORT_NUM);//获得上场的战报的信息与本次战报合并
|
||||
}
|
||||
}
|
||||
reports.push(...resReports);
|
||||
});
|
||||
return resResult(STATUS.SUCCESS, { reports });
|
||||
@@ -78,30 +79,30 @@ export class GuildTrainHandler {
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let guildTrains = await GuildTrainModel.findGuildTrain(code);//获得未失效的宝箱奖励
|
||||
let resTrainBoxs = [];
|
||||
guildTrains.forEach(({trainInstances, trainId}) =>{
|
||||
guildTrains.forEach(({ trainInstances, trainId }) => {
|
||||
let { trainInstances: instances } = getArmyTrainJuDian(trainId);
|
||||
let flag = false;
|
||||
let boxRewards = [];
|
||||
trainInstances.map(({hid, progress, endTime, trainBoxs})=>{
|
||||
trainInstances.map(({ hid, progress, endTime, trainBoxs }) => {
|
||||
let isComplete = false;
|
||||
let instance = findWhere(instances, { hid });
|
||||
if ( progress >= instance.progress) {
|
||||
if (progress >= instance.progress) {
|
||||
isComplete = true;
|
||||
if (endTime > nowSeconds())
|
||||
if (endTime > nowSeconds())
|
||||
flag = true;
|
||||
}
|
||||
boxRewards.push({hid, recordBoxs: trainBoxs, trainId, endTime, isComplete});
|
||||
boxRewards.push({ hid, recordBoxs: trainBoxs, trainId, endTime, isComplete });
|
||||
});
|
||||
if (flag) {
|
||||
resTrainBoxs.push({ trainId, boxRewards });
|
||||
}
|
||||
})
|
||||
return resResult(STATUS.SUCCESS, {trainBoxRewards: resTrainBoxs});
|
||||
return resResult(STATUS.SUCCESS, { trainBoxRewards: resTrainBoxs });
|
||||
}
|
||||
/**
|
||||
* 挑战练兵副本
|
||||
@@ -114,35 +115,35 @@ export class GuildTrainHandler {
|
||||
const roleName = session.get('roleName');
|
||||
const serverId = parseInt(session.get('serverId'));
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
if (userGuild.trainCount <= 0)
|
||||
if (userGuild.trainCount <= 0)
|
||||
return resResult(STATUS.GUILD_TRAIN_BATTLE_COUNT_NOT_ENOUGH);
|
||||
let { trainId: curTeainId } = await GuildModel.findGuild(code, serverId, 'trainId');
|
||||
if (curTeainId !== trainId)
|
||||
if (curTeainId !== trainId)
|
||||
return resResult(STATUS.GUILD_TRAIN_LEVEL_IS_COMPLETE);
|
||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId, 'trainId isComplete trainInstances');
|
||||
if (!guildTrain && guildTrain.isComplete)
|
||||
if (!guildTrain && guildTrain.isComplete)
|
||||
return resResult(STATUS.GUILD_TRAIN_SCRIPT_NOT_OPENED);
|
||||
let { trainInstances } = getArmyTrainJuDian(trainId);
|
||||
let instance = findWhere(trainInstances, { hid });
|
||||
if (!instance)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
let trainInstance = findWhere(guildTrain.trainInstances, { hid });
|
||||
if (!trainInstance)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (!trainInstance)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (trainInstance.progress >= instance.progress) {
|
||||
return resResult(STATUS.GUILD_TRAIN_IS_COMPLETE);
|
||||
}
|
||||
return resResult(STATUS.GUILD_TRAIN_IS_COMPLETE);
|
||||
}
|
||||
const battleCode = genCode(8); // 关卡唯一值
|
||||
await BattleRecordModel.updateBattleRecordByCode(battleCode, {
|
||||
$set: {
|
||||
roleId, roleName, battleId: instance.warId,
|
||||
status: 0,
|
||||
record: { heroes:[], trainId, hid, guildCode: code, difficulty},
|
||||
record: { heroes: [], trainId, hid, guildCode: code, difficulty },
|
||||
}
|
||||
}, true);
|
||||
}, true);
|
||||
return resResult(STATUS.SUCCESS, { battleCode });
|
||||
}
|
||||
/**
|
||||
@@ -150,7 +151,7 @@ export class GuildTrainHandler {
|
||||
* @param msg
|
||||
* @param session
|
||||
*/
|
||||
async trainBattleEnd(msg: { battleCode: string, isSuccess: boolean}, session: BackendSession) {
|
||||
async trainBattleEnd(msg: { battleCode: string, isSuccess: boolean }, session: BackendSession) {
|
||||
const { battleCode, isSuccess } = msg;
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
@@ -158,33 +159,33 @@ export class GuildTrainHandler {
|
||||
const sid: string = session.get('sid');
|
||||
const funcs: number[] = session.get('funcs');
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
const battleRecord = await BattleRecordModel.getBattleRecordByCode(battleCode, true);
|
||||
if (!battleRecord || battleRecord.status != 0 || roleId != battleRecord.roleId || battleRecord.record.guildCode != code) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
let time = Math.floor(battleRecord.createdAt.getTime()/1000);
|
||||
}
|
||||
let time = Math.floor(battleRecord.createdAt.getTime() / 1000);
|
||||
if (userGuild.trainCount - 1 < 0) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
|
||||
if (time < getCurHourPoint(REFRESH_HOUR) && nowSeconds() > getCurHourPoint(REFRESH_HOUR)) {
|
||||
}
|
||||
|
||||
if (time < getCurHourPoint(REFRESH_HOUR) && nowSeconds() > getCurHourPoint(REFRESH_HOUR)) {
|
||||
return resResult(STATUS.GUILD_TRAIN_IS_RESETED);//重置前进入战斗,重置后回调该接口
|
||||
}
|
||||
if (time > getHourPoint(REFRESH_HOUR)) {
|
||||
userGuild = await UserGuildModel.updateInfo(roleId, {}, { trainCount: -1 });//扣除一次挑战次数
|
||||
}
|
||||
await BattleRecordModel.updateBattleRecordByCode(battleCode, {
|
||||
$set: { status: isSuccess?1:2 }
|
||||
$set: { status: isSuccess ? 1 : 2 }
|
||||
}, true);//设置战斗状态
|
||||
|
||||
|
||||
let trainId = battleRecord.record.trainId;
|
||||
let hid = battleRecord.record.hid;
|
||||
let res:any = await lockData(serverId, DATA_NAME.TRAIN, code + '_' + trainId);//加锁
|
||||
if (!!res.err)
|
||||
return resResult(STATUS.REDLOCK_ERR);
|
||||
let res: any = await lockData(serverId, DATA_NAME.TRAIN, code + '_' + trainId);//加锁
|
||||
if (!!res.err)
|
||||
return resResult(STATUS.REDLOCK_ERR);
|
||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId);
|
||||
if (!guildTrain) {
|
||||
res.releaseCallback();//解锁
|
||||
@@ -193,7 +194,7 @@ export class GuildTrainHandler {
|
||||
let trainInstance = findWhere(guildTrain.trainInstances, { hid });
|
||||
if (!trainInstance) {
|
||||
res.releaseCallback();//解锁
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
|
||||
let { trainInstances, soloRewardRatio } = getArmyTrainJuDian(trainId);
|
||||
@@ -205,28 +206,28 @@ export class GuildTrainHandler {
|
||||
let trainSoloReward = getTrainSoloReward(battleRecord.record.difficulty);
|
||||
if (!trainSoloReward) {//获得个人奖励信息
|
||||
res.releaseCallback();//解锁
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
let addScore = Math.floor((isSuccess?trainSoloReward.winScore:trainSoloReward.failScore));//个人获得积分,也是压制进度
|
||||
let addScore = Math.floor((isSuccess ? trainSoloReward.winScore : trainSoloReward.failScore));//个人获得积分,也是压制进度
|
||||
//个人功勋奖励
|
||||
let goods = await addItems(roleId, roleName, sid, [{id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.HONOUR), count: Math.floor((isSuccess?trainSoloReward.winHonour:trainSoloReward.failHonour) * (soloRewardRatio + 100 ) / 100)}]);
|
||||
let goods = await addItems(roleId, roleName, sid, [{ id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.HONOUR), count: Math.floor((isSuccess ? trainSoloReward.winHonour : trainSoloReward.failHonour) * (soloRewardRatio + 100) / 100) }]);
|
||||
let { isComplete, ranks } = guildTrain;
|
||||
let reports = [];
|
||||
let index = findIndex(ranks, {roleId});
|
||||
let index = findIndex(ranks, { roleId });
|
||||
if (index !== -1) {
|
||||
ranks[index].score += addScore;//更新原有的排名信息
|
||||
} else {
|
||||
ranks.push({score: addScore, roleId});//新增排名
|
||||
ranks.push({ score: addScore, roleId });//新增排名
|
||||
}
|
||||
let needLockNext = false;
|
||||
let report = {roleName, trainId, hid, score: addScore, time: nowSeconds(), type: isSuccess?2:1, difficulty: battleRecord.record.difficulty};//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
||||
let report = { roleName, trainId, hid, score: addScore, time: nowSeconds(), type: isSuccess ? 2 : 1, difficulty: battleRecord.record.difficulty };//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
||||
reports.push(report);
|
||||
if (trainInstance.progress < instance.progress ) {
|
||||
if (trainInstance.progress < instance.progress) {
|
||||
if (trainInstance.progress + addScore >= instance.progress) {
|
||||
//压制成功
|
||||
if (!isComplete) {
|
||||
isComplete = true;
|
||||
guildTrain.trainInstances.forEach(({hid: otherHid, progress})=>{
|
||||
guildTrain.trainInstances.forEach(({ hid: otherHid, progress }) => {
|
||||
if (hid != otherHid && progress != instance.progress) {
|
||||
isComplete = false;
|
||||
}
|
||||
@@ -237,12 +238,12 @@ export class GuildTrainHandler {
|
||||
}
|
||||
let progress = instance.progress;
|
||||
guildTrain = await GuildTrainModel.updateGuildTrainProgress(code, trainId, hid, progress, ranks, isComplete);
|
||||
|
||||
|
||||
//type 1:失败, 2:成功,3:表示系统战报即:被成功压制
|
||||
reports.push({ type: 3, time:nowSeconds(), score: addScore, roleName, trainId, hid, difficulty: battleRecord.record.difficulty });
|
||||
reports.push({ type: 3, time: nowSeconds(), score: addScore, roleName, trainId, hid, difficulty: battleRecord.record.difficulty });
|
||||
pushGuildTrainSucMsg(roleId, roleName, code, hid);
|
||||
|
||||
if (needLockNext) {
|
||||
|
||||
if (needLockNext) {
|
||||
guildTrain = await unlockTrain(code, trainId + 1);
|
||||
}
|
||||
res.releaseCallback();//解锁
|
||||
@@ -254,20 +255,22 @@ export class GuildTrainHandler {
|
||||
}
|
||||
} else {
|
||||
//玩家结算前已经完成进度,修改玩家的排名
|
||||
guildTrain = await GuildTrainModel.updateGuildTrain(code, trainId, { ranks});
|
||||
guildTrain = await GuildTrainModel.updateGuildTrain(code, trainId, { ranks });
|
||||
res.releaseCallback();//解锁
|
||||
}
|
||||
await GuildTrainReportModel.pushGuildTrainReports(code, trainId, reports);//增加战报
|
||||
let { trainCount, trainRewards } = userGuild;
|
||||
let result:any = getGuildTrainInfo(guildTrain, roleId, trainCount, trainRewards);//战斗后更新练兵场信息
|
||||
let result: any = getGuildTrainInfo(guildTrain, roleId, trainCount, trainRewards);//战斗后更新练兵场信息
|
||||
result.battleGoods = goods;
|
||||
await addActive(roleId, serverId, GUILD_POINT_WAYS.TRAIN);
|
||||
|
||||
// 任务
|
||||
if(isSuccess) {
|
||||
if (isSuccess) {
|
||||
await checkTask(roleId, sid, funcs, TASK_TYPE.GUILD_TRAIN_SUCESS, 1, true, {});
|
||||
}
|
||||
await checkTask(roleId, sid, funcs, TASK_TYPE.GUILD_TRAIN, 1, true, {});
|
||||
//成长任务
|
||||
await accomplishTask(roleId, TASK_TYPE.GUILD_TRAIN, 1)
|
||||
|
||||
return resResult(STATUS.SUCCESS, result);
|
||||
}
|
||||
@@ -276,19 +279,19 @@ export class GuildTrainHandler {
|
||||
* @param msg
|
||||
* @param session
|
||||
*/
|
||||
async getTrainInstanceBox(msg: { trainId: number , hid: number, index: number}, session: BackendSession) {
|
||||
async getTrainInstanceBox(msg: { trainId: number, hid: number, index: number }, session: BackendSession) {
|
||||
let { trainId, hid, index } = msg;
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
const roleName: string = session.get('roleName');
|
||||
const sid = session.get('sid');
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let { trainLv } = await GuildModel.findGuild(code, serverId, 'trainLv');
|
||||
let res:any = await lockData(serverId, DATA_NAME.TRAIN_BOX, code + '_' + trainId + '_' + index);//加锁
|
||||
if (!!res.err)
|
||||
let res: any = await lockData(serverId, DATA_NAME.TRAIN_BOX, code + '_' + trainId + '_' + index);//加锁
|
||||
if (!!res.err)
|
||||
return resResult(STATUS.REDLOCK_ERR);
|
||||
|
||||
let { shilianRewardRatio } = getTrainBaseByLv(trainLv);
|
||||
@@ -317,16 +320,16 @@ export class GuildTrainHandler {
|
||||
return resResult(STATUS.GUILD_TRAIN_BOX_IS_GOT);
|
||||
}
|
||||
let good = getRandomByLen(heroRewards);
|
||||
good.count = Math.floor((100 + shilianRewardRatio) * good.count/100);
|
||||
good.count = Math.floor((100 + shilianRewardRatio) * good.count / 100);
|
||||
let goods = await addItems(roleId, roleName, sid, [good]);
|
||||
|
||||
let resGuildTrain = await GuildTrainModel.receiveBoxByIndex(code, roleId, trainId, hid, index, good);
|
||||
res.releaseCallback();//解锁
|
||||
|
||||
|
||||
if (!resGuildTrain) {
|
||||
return resResult(STATUS.GUILD_GET_TRAIN_BOX_FAIL);
|
||||
}
|
||||
let result:any = getGuildTrainRewards(resGuildTrain);
|
||||
let result: any = getGuildTrainRewards(resGuildTrain);
|
||||
|
||||
result.goods = goods;
|
||||
return resResult(STATUS.SUCCESS, result);
|
||||
@@ -336,22 +339,22 @@ export class GuildTrainHandler {
|
||||
* @param msg
|
||||
* @param session
|
||||
*/
|
||||
async getTrainLvUpRewards(msg: {trainId: number }, session: BackendSession) {
|
||||
async getTrainLvUpRewards(msg: { trainId: number }, session: BackendSession) {
|
||||
let { trainId } = msg;
|
||||
const roleId: string = session.get('roleId');
|
||||
const roleName: string = session.get('roleName');
|
||||
const sid: string = session.get('sid');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId);
|
||||
if (!guildTrain||!guildTrain.isComplete)
|
||||
if (!guildTrain || !guildTrain.isComplete)
|
||||
return resResult(STATUS.GUILD_TRAIN_IS_NOT_COMPLETE);
|
||||
let { jinjieReward } = getArmyTrainJuDian(trainId);
|
||||
if (userGuild.trainRewards.indexOf(trainId) != -1)
|
||||
return resResult(STATUS.GUILD_TRAIN_QUALITY_REWARD_IS_GOT);
|
||||
return resResult(STATUS.GUILD_TRAIN_QUALITY_REWARD_IS_GOT);
|
||||
userGuild = await UserGuildModel.receiveTrainRewards(roleId, trainId);
|
||||
if (!userGuild) {
|
||||
return resResult(STATUS.INTERNAL_ERR);
|
||||
@@ -360,20 +363,20 @@ export class GuildTrainHandler {
|
||||
let { trainRewards } = userGuild;
|
||||
return resResult(STATUS.SUCCESS, { trainRewards, goods });
|
||||
}
|
||||
|
||||
|
||||
//购买挑战次数
|
||||
async purchaseTrainCount(msg: {count: number}, session: BackendSession) {
|
||||
async purchaseTrainCount(msg: { count: number }, session: BackendSession) {
|
||||
let { count } = msg;
|
||||
const roleId:string = session.get('roleId');
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
const sid:string = session.get('sid');
|
||||
const sid: string = session.get('sid');
|
||||
let userGuild = await getUserGuild(roleId, serverId);
|
||||
if (!userGuild)
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (userGuild.buyTrainCount >= ARMY.ARMY_TRAIN_BUYTIMES)
|
||||
return resResult(STATUS.GUILD_BUY_TRAIN_COUNT_REACH_MAX);
|
||||
let result = await handleCost(roleId, sid, [{id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD), count: ARMY.ARMY_TRAIN_TIMESCOST}]);
|
||||
if(!result)
|
||||
let result = await handleCost(roleId, sid, [{ id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD), count: ARMY.ARMY_TRAIN_TIMESCOST }]);
|
||||
if (!result)
|
||||
return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
|
||||
let { trainCount, buyTrainCount } = await UserGuildModel.addTrainCount(roleId, count);
|
||||
return resResult(STATUS.SUCCESS, { trainCount, buyTrainCount });
|
||||
|
||||
Reference in New Issue
Block a user