Browse Source

管理员修改

lrf 3 years ago
parent
commit
cc7f2227d5
1 changed files with 10 additions and 10 deletions
  1. 10 10
      app/service/user/admin.js

+ 10 - 10
app/service/user/admin.js

@@ -28,14 +28,14 @@ class AdminService extends CrudService {
     return data;
   }
 
-  async fetch({ id }) {
-    let object = await this.model.findById(id);
-    if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
-    object = JSON.parse(JSON.stringify(object));
-    const menus = await this.ctx.model.System.Menu.find({ _id: object.menus.map(i => ObjectId(i)) }).sort({ sort: 1 });
-    object.menus = menus;
-    return object;
-  }
+  // async fetch({ id }) {
+  //   let object = await this.model.findById(id);
+  //   if (!object) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到用户的信息');
+  //   object = JSON.parse(JSON.stringify(object));
+  //   // const menus = await this.ctx.model.System.Menu.find({ _id: object.menus.map(i => ObjectId(i)) }).sort({ sort: 1 });
+  //   // object.menus = menus;
+  //   return object;
+  // }
 
   /**
    * 创建用户
@@ -96,8 +96,8 @@ class AdminService extends CrudService {
     if (secret !== password) throw new BusinessError(ErrorCode.BAD_PASSWORD, '密码错误');
     const data = _.omit(JSON.parse(JSON.stringify(object)), [ 'meta', 'password', '__v' ]);
     const { secret: secrets } = this.config.jwt;
-    const menus = await this.ctx.model.System.Menu.find({ _id: object.menus.map(i => ObjectId(i)) }).sort({ sort: 1 });
-    data.menus = menus;
+    // const menus = await this.ctx.model.System.Menu.find({ _id: object.menus.map(i => ObjectId(i)) }).sort({ sort: 1 });
+    // data.menus = menus;
     const token = jwt.sign(data, secrets);
     return token;
   }