guhongwei 4 years ago
parent
commit
9388316632
1 changed files with 2 additions and 2 deletions
  1. 2 2
      app/service/user.js

+ 2 - 2
app/service/user.js

@@ -12,6 +12,7 @@ class UserService extends CrudService {
     super(ctx, 'user');
     this.model = this.ctx.model.User;
     this.rmodel = this.ctx.model.Role;
+    this.productmodel = this.ctx.app.config.axios.product;
   }
 
   // 重写创建方法
@@ -182,8 +183,7 @@ class UserService extends CrudService {
   async delete({ id }) {
     const res = await this.model.update({ _id: ObjectId(id) }, { isdel: '1' });
     if (res) {
-      const url = this.ctx.app.config.axios.product;
-      const arr = await url.model.updateMany({ userid: ObjectId(id) }, { isdel: '1' });
+      const arr = await this.productmodel.updateMany({ userid: ObjectId(id) }, { isdel: '1' });
       if (arr) {
         return arr;
       }