guhongwei 4 年之前
父节点
当前提交
9388316632
共有 1 个文件被更改,包括 2 次插入2 次删除
  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;
       }