🐞 fix(guild): 试炼挑战奖励领取过的不允许再领
This commit is contained in:
@@ -4,7 +4,7 @@ import { DEBUG_MAGIC_WORD, ITEM_CHANGE_REASON, STATUS, TASK_TYPE, TRAIN_REWARD_T
|
||||
import { GuildTrainModel } from '../../../db/GuildTrain';
|
||||
import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||
import { nowSeconds, getTimeFun, getZeroPoint } from '../../../pubUtils/timeUtil';
|
||||
import { refreshTrain, getGuildTrainInfo, unlockTrain, getGuildTrainRewards, getGuildTrainInstance, getTrainBoxRewardsResult, resetTrain } from '../../../services/guildTrainService';
|
||||
import { refreshTrain, getGuildTrainInfo, unlockTrain, getGuildTrainRewards, getGuildTrainInstance, getTrainBoxRewardsResult, resetTrain, getTrainBoxRewardsResultWithoutAlreadyGeted } from '../../../services/guildTrainService';
|
||||
import { findIndex, findWhere } from 'underscore'
|
||||
import { lockData } from '../../../services/redLockService';
|
||||
import { GUILD_REPORT_NUM, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
||||
@@ -79,8 +79,8 @@ export class GuildTrainHandler {
|
||||
let userGuild = await refreshTrain(myUserGuild, roleId, serverId);
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let resTrainBoxs = await getTrainBoxRewardsResult(code);
|
||||
const { guildCode: code, trainBoxRewards} = userGuild;
|
||||
let resTrainBoxs = await getTrainBoxRewardsResultWithoutAlreadyGeted(code, trainBoxRewards);
|
||||
return resResult(STATUS.SUCCESS, { trainBoxRewards: resTrainBoxs });
|
||||
}
|
||||
/**
|
||||
@@ -309,9 +309,10 @@ export class GuildTrainHandler {
|
||||
let goods = await addItems(roleId, roleName, sid, [good], ITEM_CHANGE_REASON.TRAIN_BOX_REWARD);
|
||||
|
||||
let resGuildTrain = await GuildTrainModel.receiveBoxByIndex(code, roleId, trainId, hid, index, good);
|
||||
let resUserGuild = await UserGuildModel.receiveTrainBoxRewards(roleId, trainId);
|
||||
res.releaseCallback();//解锁
|
||||
|
||||
if (!resGuildTrain) {
|
||||
if (!resGuildTrain || !resUserGuild) {
|
||||
return resResult(STATUS.GUILD_GET_TRAIN_BOX_FAIL);
|
||||
}
|
||||
let result: any = getGuildTrainRewards(resGuildTrain);
|
||||
|
||||
Reference in New Issue
Block a user