lrf преди 2 години
родител
ревизия
a9c7162904
променени са 4 файла, в които са добавени 12 реда и са изтрити 7 реда
  1. 6 1
      app/controller/.schedule.js
  2. 4 4
      app/service/schedule.js
  3. 1 1
      app/z_router/schedule.js
  4. 1 1
      config/config.default.js

+ 6 - 1
app/controller/.schedule.js

@@ -89,7 +89,12 @@ module.exports = {
     },
   },
   getByTeamCreater: {
-    params: ['!id'],
+    parameters: {
+      query: {
+        user_id: 'user_id',
+        status: 'status',
+      },
+    },
     options: {
       query: ['skip', 'limit'],
     },

+ 4 - 4
app/service/schedule.js

@@ -14,14 +14,14 @@ class ScheduleService extends CrudService {
   }
   /**
    * 通过团队创建人id查询赛程信息
-   * @param {String} id 团队创建人id
+   * @param {String} user_id 团队创建人id
    * @param {Object} options 查询附加参数
    */
-  async getByTeamCreater({ id }, { skip = 0, limit = 0 } = {}) {
+  async getByTeamCreater({ user_id, ...query }, { skip = 0, limit = 0 } = {}) {
     // 用 id 查团队表 create_id:id; 获取团队id去查红方和蓝方的赛程信息
-    const team = await this.ctx.model.Team.findOne({ create_id: id }, { _id: 1 });
+    const team = await this.ctx.model.Team.findOne({ create_id: user_id }, { _id: 1 });
     if (!team) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到该用户的团队信息');
-    const condition = { $or: [{ red_id: team._id }, { blue_id: team._id }] };
+    const condition = { $or: [{ red_id: team._id }, { blue_id: team._id }], ...query };
     const data = await this.model.find(condition).skip(parseInt(skip)).limit(parseInt(limit));
     const total = await this.model.count(condition);
     return { data, total };

+ 1 - 1
app/z_router/schedule.js

@@ -6,7 +6,7 @@ const keyZh = '赛程信息';
 const routes = [
   {
     method: 'get',
-    path: `${rkey}/getByTeamCreater/:id`,
+    path: `${rkey}/getByTeamCreater`,
     middleware: [ 'noControllerList' ],
     controller: `${ckey}.getByTeamCreater`,
     name: `${ckey}GetByTeamCreater`,

+ 1 - 1
config/config.default.js

@@ -75,7 +75,7 @@ module.exports = appInfo => {
   // 数据库设置
   config.dbName = 'courtAdmin';
   config.mongoose = {
-    url: `mongodb://localhost:27017/${config.dbName}`,
+    url: `mongodb://101.36.221.66:27017/${config.dbName}`,
     options: {
       user: 'admin',
       pass: 'admin',