|
@@ -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 };
|