fix bug 升级更新错误

This commit is contained in:
luying
2020-12-14 21:10:35 +08:00
parent 763b61b867
commit 2a268b2158
4 changed files with 29 additions and 21 deletions

View File

@@ -32,7 +32,7 @@ export default class Item extends BaseModel {
}
public static async findByRoleAndType(roleId: string, type: number, lean = true) {
const items = await ItemModel.find({ roleId, type }).select('id count type').lean(lean);
const items = await ItemModel.find({ roleId, type }).select('id count type').sort({id: 1}).lean(lean);
return items;
}

View File

@@ -382,7 +382,7 @@ export default class Role extends BaseModel {
public static async updateRoleInfo(roleId: string, roleUpdate:roleUpdate, lean = true) {
delete roleUpdate._id;
let result = await HeroModel.findOneAndUpdate({roleId}, {$set:roleUpdate}).lean(lean);
let result = await RoleModel.findOneAndUpdate({roleId}, {$set:roleUpdate}).lean(lean);
return result||{};
}
}