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