guhongwei %!s(int64=4) %!d(string=hai) anos
pai
achega
9388316632
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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;
       }