领取训练场进阶奖励
This commit is contained in:
@@ -107,7 +107,7 @@ export class GuildTrainHandler {
|
||||
// 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)) {
|
||||
@@ -242,11 +242,20 @@ export class GuildTrainHandler {
|
||||
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)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
const { guildCode: code } = userGuild;
|
||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId);
|
||||
if (!guildTrain||!guildTrain.isComplete)
|
||||
return resResult(STATUS.GUILD_TRAIN_IS_NOT_COMPLETE);
|
||||
let { jinjieReward } = getArmyTrainJuDian(trainId);
|
||||
let userGuild = await UserGuildModel.receiveTrainRewards(roleId, trainId);
|
||||
if (userGuild.trainRewards.indexOf(trainId) != -1)
|
||||
return resResult(STATUS.GUILD_TRAIN_QUALITY_REWARD_IS_GOT);
|
||||
userGuild = await UserGuildModel.receiveTrainRewards(roleId, trainId);
|
||||
if (!userGuild) {
|
||||
return resResult(STATUS.GUILD_GET_TRAIN_REWARD_FAIL);
|
||||
return resResult(STATUS.INTERNAL_ERR);
|
||||
}
|
||||
let goods = await addItems(roleId, roleName, sid, jinjieReward);
|
||||
let { trainRewards } = userGuild;
|
||||
|
||||
Reference in New Issue
Block a user