✨ feat(共鸣系统): 新增

This commit is contained in:
zhangxk
2023-10-09 15:11:54 +08:00
parent cd87b9e74c
commit 53a0b0f340
18 changed files with 1195 additions and 14 deletions
+14
View File
@@ -362,6 +362,20 @@ export default class Hero extends BaseModel {
const result = await HeroModel.count(searchObj);
return result;
}
public static async bulkWriteUpdate(updateArr: HeroUpdate[]) {
if (updateArr.length == 0) return;
await HeroModel.bulkWrite(updateArr.map((param) => {
const { roleId, hid } = param;
return { updateOne: { filter: { roleId, hid }, update: { $set: param }, upsert: true } }
}))
}
public static async getHidCountByRoleId(roleId:string){
let result: number = await HeroModel.countDocuments({roleId});
return result;
}
}
export const HeroModel = getModelForClass(Hero);