lrf 2 年之前
父節點
當前提交
49b9ed028f
共有 2 個文件被更改,包括 8 次插入4 次删除
  1. 6 2
      app/service/matchSign.js
  2. 2 2
      config/config.default.js

+ 6 - 2
app/service/matchSign.js

@@ -13,6 +13,7 @@ class MatchSignService extends CrudService {
     this.matchGroupModel = this.ctx.model.Race.MatchGroup;
     this.matchProjectModel = this.ctx.model.Race.MatchProject;
     this.billModel = this.ctx.model.Race.Bill;
+    this.userModel = this.ctx.model.Race.User;
     this.baseUserModel = this.ctx.model.Base.User;
   }
   /**
@@ -30,9 +31,12 @@ class MatchSignService extends CrudService {
 
   async afterQuery(filter, data) {
     for (const i of data) {
-      const { user_id } = data;
+      const { user_id: raceUser_id } = i;
+      const raceUser = await this.userModel.findById(raceUser_id);
+      if (!raceUser) continue;
+      const { user_id } = raceUser;
       const user = await this.baseUserModel.findById(user_id);
-      if (user) i.user_name = user.name;
+      if (user)i.user_name = user.name;
     }
     return data;
   }

+ 2 - 2
config/config.default.js

@@ -112,7 +112,7 @@ module.exports = appInfo => {
   config.mongoose = {
     clients: {
       base: {
-        url: `mongodb://127.0.0.1:27017/${config.baseDbName}`, // 120.48.146.1 127.0.0.1
+        url: `mongodb://120.48.146.1:27017/${config.baseDbName}`, // 120.48.146.1 127.0.0.1
         options: {
           user: 'admin',
           pass: 'admin',
@@ -122,7 +122,7 @@ module.exports = appInfo => {
         },
       },
       race: {
-        url: `mongodb://127.0.0.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
+        url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
         options: {
           user: 'admin',
           pass: 'admin',