✨ feat(共鸣系统): 新增
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user