lrf 2 years ago
parent
commit
ece377e80b
1 changed files with 2 additions and 6 deletions
  1. 2 6
      app/service/match.js

+ 2 - 6
app/service/match.js

@@ -20,11 +20,6 @@ class MatchService extends CrudService {
   async getAll({ id }) {
     let data = await this.model.findById(id);
     if (!data) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到赛事信息');
-    // 基础模块 user表文档
-    const conn = this.app.mongooseDB.get('base');
-    const schema = _.get(this.ctx.model, 'Base.User.schema');
-    const m = conn.model('User', schema);
-
     data = JSON.parse(JSON.stringify(data));
     const match_id = data._id;
     let groups = await this.matchGroupModel.find({ match_id });
@@ -37,9 +32,10 @@ class MatchService extends CrudService {
         const { _id: project_id } = project;
         let signs = await this.matchSignModel.find({ match_id, group_id, project_id }).populate({
           path: 'user_id',
+          model: this.ctx.model.Race.User,
           populate: {
             path: 'user_id',
-            model: m,
+            model: this.ctx.model.Base.User,
           },
         });
         signs = JSON.parse(JSON.stringify(signs));