🐞 fix(军团): 练兵场登录时有并发问题
This commit is contained in:
@@ -182,6 +182,7 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
|
||||
case 'train':
|
||||
if (hasGuild) {
|
||||
let trainInstance = await getGuildTrainInstance(roleId, guild, userGuild);
|
||||
if(!trainInstance) return null;
|
||||
let trainBoxRewards = await getTrainBoxRewardsResult(guildCode);
|
||||
return { trainInstance, trainBoxRewards }
|
||||
}
|
||||
|
||||
@@ -283,9 +283,7 @@ export async function removeTrainRank(guildCode: string, roleId: string, trainId
|
||||
export async function getGuildTrainInstance(roleId: string, guild: GuildType, userGuild: UserGuildType) {
|
||||
let { trainId, trainLv, code } = guild;
|
||||
let guildTrain = await GuildTrainModel.findTrainByTrainIdNotLock(code, trainId);
|
||||
if (!guildTrain) {
|
||||
guildTrain = await unlockTrain(code, trainId);
|
||||
}
|
||||
if (!guildTrain) return null
|
||||
let { trainCount, trainRewards, buyTrainCount } = userGuild;
|
||||
let result: any = getGuildTrainInfo(guildTrain, roleId, trainCount, trainRewards);
|
||||
result.buyTrainCount = buyTrainCount || 0;
|
||||
|
||||
Reference in New Issue
Block a user