lrf 2 gadi atpakaļ
vecāks
revīzija
ba1b4f98e3

+ 1 - 1
app/model/race/matchAddress.js

@@ -4,7 +4,7 @@ const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
 
 // 赛事场地
 const match_address = {
-  belong_id: { type: String, required: true, zh: '归属id', ref: 'user', getProp: [ 'name' ] }, // 用户表中的名称
+  belong_id: { type: String, required: true, zh: '归属id', ref: 'User', getProp: [ 'name' ] }, // 用户表中的名称
   name: { type: String, required: true, zh: '名称' }, //
   remark: { type: String, required: false, zh: '备注' }, //
   is_use: { type: String, required: false, default: '0', zh: '是否使用' }, // 0:启用,1:禁用

+ 1 - 0
app/service/matchSmallGroupSchedule.js

@@ -10,6 +10,7 @@ class MatchSmallGroupScheduleService extends CrudService {
     super(ctx, 'matchsmallgroupschedule');
     this.model = this.ctx.model.Race.MatchSmallGroupSchedule;
   }
+
 }
 
 module.exports = MatchSmallGroupScheduleService;

+ 12 - 2
app/service/matchTeamGroup.js

@@ -12,10 +12,20 @@ class MatchTeamGroupService extends CrudService {
     this.matchProjectModel = this.ctx.model.Race.MatchProject;
     this.teamApplyModel = this.ctx.model.Race.TeamApply;
     this.matchSignModel = this.ctx.model.Race.MatchSign;
+    this.baseUserModel = this.ctx.model.Base.User;
   }
 
-  // TODO query 需要自己改,将选手的信息换出来
-
+  // 将选手的信息换出来
+  async afterQuery(filter, data) {
+    for (const i of data) {
+      const { person_type } = i;
+      if (person_type === 'User') {
+        const users = await this.baseUserModel.find({ _id: i.person });
+        i.person = users;
+      }
+    }
+    return data;
+  }
 
   async saveAll(data) {
     for (const i of data) {