fix,修复后台批量添加武将bug

This commit is contained in:
luying
2020-11-11 16:46:54 +08:00
parent b792f22f94
commit 7ad1b703d3
2 changed files with 9 additions and 13 deletions

View File

@@ -77,6 +77,7 @@ export default class Hero extends BaseModel {
public static async createHero(heroInfo: {roleId: string, roleName: string, hid: number, hName: string, seqId: number, lv?:number, ce: number}, lean = true) {
const doc = new HeroModel();
const update = Object.assign(doc.toJSON(), heroInfo);
delete update._id;
const hero = await HeroModel.findOneAndUpdate({roleId: heroInfo.roleId, hid: heroInfo.hid}, update, {upsert: true, new: true}).lean(lean);
return hero;
}