liuyu 4 years ago
parent
commit
3cf159d9cf
3 changed files with 21 additions and 0 deletions
  1. 5 0
      app/controller/dock.js
  2. 1 0
      app/router.js
  3. 15 0
      app/service/dock.js

+ 5 - 0
app/controller/dock.js

@@ -18,6 +18,11 @@ class DockController extends Controller {
     const res = await this.service.myapply(this.ctx.query);
     this.ctx.ok({ ...res });
   }
+
+  async updatevipuser() {
+    const res = await this.service.updatevipuser(this.ctx.params, this.ctx.request.body);
+    this.ctx.ok({ ...res });
+  }
 }
 
 module.exports = CrudController(DockController, meta);

+ 1 - 0
app/router.js

@@ -47,6 +47,7 @@ module.exports = app => {
     '/api/live/dock/apply/:dock_id/check/:id',
     controller.dock.check
   );
+  router.post('dock', '/api/live/dock/updatevipuser/:id', controller.dock.updatevipuser);
 
   // 栏目表设置路由
   router.resources('column', '/api/live/column', controller.column); // index、create、show、destroy

+ 15 - 0
app/service/dock.js

@@ -89,6 +89,21 @@ class ChatService extends CrudService {
     const result = { total, data };
     return result;
   }
+
+  async updatevipuser({ id }, info) {
+    const dock = await this.model.findById(id);
+    if (!dock) {
+      throw new BusinessError('没有查询到该对接会');
+    }
+    const vipuser = await dock.vipuser.id(info.id);
+    vipuser.vipname = info.vipname;
+    vipuser.vipphone = info.vipphone;
+    vipuser.role = info.role;
+    vipuser.company = info.company;
+    vipuser.email = info.email;
+    vipuser.content = info.content;
+    return await dock.save();
+  }
 }
 
 module.exports = ChatService;