🐞 fix(军团): 军团补发邮件有可能因为并发发出多封

This commit is contained in:
luying
2022-11-08 17:35:33 +08:00
parent 4e205b47bb
commit f92d1336ac
6 changed files with 28 additions and 31 deletions

View File

@@ -225,6 +225,14 @@ export default class UserGuild extends BaseModel {
const result: UserGuildType = await UserGuildModel.findOneAndUpdate({ roleId, status: USER_GUILD_STATUS.ON, 'wishGoods.id': id }, { $inc: { 'wishGoods.$.receiveCnt': 1, 'wishGoods.$.drawCnt': 1}, $push:{'wishGoods.$.donateNames': dntRoleName} }, { new: true }).select(select).lean();
return result;
}
public static async resetDailyInfo(roleId: string) {
const result: UserGuildType = await UserGuildModel.findOneAndUpdate({ roleId, status: USER_GUILD_STATUS.ON }, { $set: {
receivedActive: [], refTimeDaily: new Date(), activeDaily: 0, activeRecord: [], wishGoods: [], receivedWishPool: [], receiveBoxs: [], wishDntCnt: 0, donateCnt: 0
} }, { new: true }).lean();
return result;
}
}
export const UserGuildModel = getModelForClass(UserGuild);