fix 本地运行端口占用问题

This commit is contained in:
luying
2020-10-23 18:05:46 +08:00
parent 94c632649b
commit 79ca79a6f4
3 changed files with 7 additions and 3 deletions

View File

@@ -190,7 +190,7 @@ export default class Role extends BaseModel {
public static async addItems(roleId: string, field: string, id: number, cnt: number, lean = true) {
try {
let role = await RoleModel.findOne({roleId}).lean(lean);
let item = role[field];
let item = role?role[field]:[];
let curItem = item.find(cur => cur.id == id);
if(!curItem) {
let addToSet = {};