lrf 2 سال پیش
والد
کامیت
3d4e69e944
3فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 3 0
      app/controller/config/.match.js
  2. 1 0
      app/model/race/match.js
  3. 10 0
      app/service/matchSign.js

+ 3 - 0
app/controller/config/.match.js

@@ -1,6 +1,7 @@
 module.exports = {
   create: {
     requestBody: [
+      'format',
       'money',
       'belong_id',
       'type',
@@ -26,6 +27,7 @@ module.exports = {
     params: ['!id'],
     requestBody: [
       'money',
+      'format',
       'belong_id',
       'type',
       'logo',
@@ -61,6 +63,7 @@ module.exports = {
         status: 'status',
         belong_id: 'belong_id',
         type: 'type',
+        format: 'format',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 1 - 0
app/model/race/match.js

@@ -18,6 +18,7 @@ const match = {
   explain: { type: String, required: false, zh: '报名说明' }, // 报名说明
   regular: { type: String, required: false, zh: '赛事规程' }, // 赛事规程
   status: { type: String, required: true, default: '0', zh: '比赛状态' }, // 字典表中的标签
+  format: { type: String, zh: '赛事赛制' },
 };
 const schema = new Schema(match, { toJSON: { getters: true, virtuals: true } });
 schema.index({ id: 1 });

+ 10 - 0
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.baseUserModel = this.ctx.model.Base.User;
   }
   /**
    * 检查是否已经有该赛事,该组别,该项目的报名
@@ -27,6 +28,15 @@ class MatchSignService extends CrudService {
     return { filter, update };
   }
 
+  async afterQuery(filter, data) {
+    for (const i of data) {
+      const { user_id } = data;
+      const user = await this.baseUserModel.findById(user_id);
+      if (user) i.user_name = user.name;
+    }
+    return data;
+  }
+
   // 退赛
   async afterUpdate(filter, body, data) {
     const { pay_status } = data;