|
@@ -29,7 +29,7 @@ export class MatchRegistrationController implements BaseController {
|
|
|
async index(@Query() query: object) {
|
|
|
const qobj = omit(query, ['skip', 'limit']);
|
|
|
const others: any = pick(query, ['skip', 'limit']);
|
|
|
- others.order = { order_num: 'ASC' };
|
|
|
+ others.order = { time: 'ASC' };
|
|
|
const result = await this.service.query(qobj, others);
|
|
|
return result;
|
|
|
}
|
|
@@ -70,13 +70,13 @@ export class MatchRegistrationController implements BaseController {
|
|
|
regData = { user_id: dbData.id, ...regData };
|
|
|
}
|
|
|
// 检查是否报名
|
|
|
- const query = { match_id: get(data, 'match_id'), user_id: get(regData, 'user_id') }
|
|
|
- const { total } = await this.service.query(query)
|
|
|
- if (total > 0) throw new ServiceError(ErrorCode.MATCH_USER_HAS_REGISTED)
|
|
|
+ const query = { match_id: get(data, 'match_id'), user_id: get(regData, 'user_id') };
|
|
|
+ const { total } = await this.service.query(query);
|
|
|
+ if (total > 0) throw new ServiceError(ErrorCode.MATCH_USER_HAS_REGISTED);
|
|
|
// 制作项目编号
|
|
|
- const { total: matchRegTotal = 0 } = await this.service.query({ match_id: get(data, 'match_id') })
|
|
|
- const no = `${get(data, 'match_id')}-${get(regData, 'user_id')}-${matchRegTotal + 1}`
|
|
|
- regData = { ...regData, no, time: dayjs().format('YYYY-MM-DD HH:mm:ss') }
|
|
|
+ const { total: matchRegTotal = 0 } = await this.service.query({ match_id: get(data, 'match_id') });
|
|
|
+ const no = `${get(data, 'match_id')}-${get(regData, 'user_id')}-${matchRegTotal + 1}`;
|
|
|
+ regData = { ...regData, no, time: dayjs().format('YYYY-MM-DD HH:mm:ss') };
|
|
|
const result = await this.service.create(regData);
|
|
|
return result;
|
|
|
}
|