This commit is contained in:
mamengke01
2021-01-23 17:05:26 +08:00
parent 3e6ec77d56
commit bb2f17089e
12 changed files with 275 additions and 114 deletions

View File

@@ -128,12 +128,13 @@ export default class UserGuild extends BaseModel {
const result = await UserGuildModel.findOneAndUpdate({ roleId, status: USER_GUILD_STATUS.ON }, { $inc: { honourWeekly: inc } }, { new: true }).select(select).lean();
return result;
}
public static async receiveTrainRewards(roleId: string, trainId: number, lean = true) {
const result = await UserGuildModel.findOneAndUpdate({ roleId, status: USER_GUILD_STATUS.ON, 'trainRewards':{$ne: trainId }},
{$push:{trainRewards: trainId} }).lean(lean);
{$push:{trainRewards: trainId} },{new: true}).lean(lean);
return result;
}
}
export const UserGuildModel = getModelForClass(UserGuild);