lrf402788946 4 سال پیش
والد
کامیت
fedfa144d7
2فایلهای تغییر یافته به همراه19 افزوده شده و 4 حذف شده
  1. 15 4
      app/service/user.js
  2. 4 0
      config/config.default.js

+ 15 - 4
app/service/user.js

@@ -182,10 +182,21 @@ class UserService extends CrudService {
   async delete({ id }) {
     const res = await this.model.update({ _id: ObjectId(id) }, { isdel: '1' });
     if (res) {
-      // const arr = await Product.update({ userid: id }, { isdel: '1' });
-      // if (arr) {
-      //   return arr;
-      // }
+      const { config } = this.app;
+      if (!config) throw new BusinessError(ErrorCode.SERVICE_FAULT, '系统错误,需要检查系统项目设置');
+      const { project } = config;
+      if (!project) throw new BusinessError(ErrorCode.SERVICE_FAULT, '系统错误,需要检查系统中各项目的设置');
+      const { market } = project;
+      if (!market) throw new BusinessError(ErrorCode.SERVICE_FAULT, '系统错误,需要检查系统项目中项目设置的各项目配置');
+      const url = `${market}/product/userdelete`;
+      const r = await this.ctx.curl(url, {
+        method: 'post',
+        headers: {
+          'content-type': 'application/json',
+        },
+        dataType: 'json',
+        data: JSON.stringify(id),
+      });
     }
     return res;
   }

+ 4 - 0
config/config.default.js

@@ -48,6 +48,10 @@ module.exports = appInfo => {
   config.baseUrl = 'http://free.liaoningdoupo.com';
   // 认证回调地址
   config.authUrl = '/api/auth/wxchat';
+  // 项目之间的变量
+  config.project = {
+    market: 'http://localhost:9004/api/market',
+  };
 
   config.mongoose = {
     url: 'mongodb://localhost:27017/platform',