feat(gvg): 备战期结束发放未领取邮件

This commit is contained in:
luying
2023-03-07 19:23:37 +08:00
parent 6b79612a5e
commit 129f232e84
8 changed files with 88 additions and 7 deletions

View File

@@ -69,6 +69,17 @@ export default class GVGVestigeLeagueRank extends BaseModel {
public static async receiveRanks(_ids: string[], roleId: string) {
await GVGVestigeLeagueRankModel.updateMany({ _id: { $in: _ids } }, { $push: { receiveMembers: roleId } });
}
public static async receiveManyRanks(arr: { _id: string, roleIds: string[]}[]) {
await GVGVestigeLeagueRankModel.bulkWrite(arr.map(({ _id, roleIds}) => {
return { updateOne: { filter: { _id }, update: { $push: { receiveMembers: roleIds } } } }
}));
}
public static async getAllCanReceiveRanks(configId: number, leagueCodes: string[]) {
let result: GVGVestigeLeagueRankType[] = await GVGVestigeLeagueRankModel.find({ configId, rank: { $gt: 0 }, leagueCode: { $in: leagueCodes } }).lean();
return result;
}
}
export const GVGVestigeLeagueRankModel = getModelForClass(GVGVestigeLeagueRank);