|
@@ -15,12 +15,11 @@ export class MatchExtController implements BaseController {
|
|
|
@Inject()
|
|
|
service: MatchExtService;
|
|
|
@Inject()
|
|
|
- matchRegService: MatchRegistrationService
|
|
|
+ matchRegService: MatchRegistrationService;
|
|
|
@Inject()
|
|
|
- userService: UserService
|
|
|
+ userService: UserService;
|
|
|
@Inject()
|
|
|
- smsService: AliyunSmsService
|
|
|
-
|
|
|
+ smsService: AliyunSmsService;
|
|
|
|
|
|
@Get('/')
|
|
|
@ApiTags('列表查询')
|
|
@@ -70,35 +69,33 @@ export class MatchExtController implements BaseController {
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @Get('/firstStep/:match_id', { routerName: `进入初赛阶段` })
|
|
|
+ @Get('/firstStep/:match_id', { routerName: '进入初赛阶段' })
|
|
|
async toFirstStep(@Param('match_id') match_id: string, @Body() data: object) {
|
|
|
// 进入初赛阶段,查询选手名单(未被退回的),根据选手名单的报名顺序,排列名单,并赋予开始时间
|
|
|
/**赛事拓展数据 */
|
|
|
- const extData = await this.service.fetch({ match_id })
|
|
|
+ const extData = await this.service.fetch({ match_id });
|
|
|
if (extData) {
|
|
|
// 修改流程进度为下一步----初赛
|
|
|
- await this.service.update({ match_id }, { status: '1' })
|
|
|
+ await this.service.update({ match_id }, { status: '1' });
|
|
|
}
|
|
|
- const start_time = get(data, 'start_time')
|
|
|
- const regQuery = { match_id, status: '0' }
|
|
|
- await this.matchRegService.update(regQuery, { start_time })
|
|
|
+ const start_time = get(data, 'start_time');
|
|
|
+ const regQuery = { match_id, status: '0' };
|
|
|
+ await this.matchRegService.update(regQuery, { start_time });
|
|
|
/**赛事报名数据 */
|
|
|
- const { data: list } = await this.matchRegService.query(regQuery)
|
|
|
+ const { data: list } = await this.matchRegService.query(regQuery);
|
|
|
// 发送短信通知
|
|
|
- const msg = `您参加的赛事: ${get(extData, 'name')} 将于 ${start_time}开始初赛,具体安排请通过网页或小程序查看.请您提前做好准备.`
|
|
|
+ const msg = `您参加的赛事: ${get(extData, 'name')} 将于 ${start_time}开始初赛,具体安排请通过网页或小程序查看.请您提前做好准备.`;
|
|
|
for (const i of list) {
|
|
|
- const user_id = get(i, 'user_id')
|
|
|
- if (!user_id) continue
|
|
|
- const user = await this.userService.fetch({ id: user_id })
|
|
|
+ const user_id = get(i, 'user_id');
|
|
|
+ if (!user_id) continue;
|
|
|
+ const user = await this.userService.fetch({ id: user_id });
|
|
|
if (!user) continue;
|
|
|
- const phone = get(user, 'phone')
|
|
|
+ const phone = get(user, 'phone');
|
|
|
try {
|
|
|
- await this.smsService.send(phone, msg)
|
|
|
+ await this.smsService.send(phone, msg);
|
|
|
} catch (error) {
|
|
|
- console.error('matchExt - toFirstStep:发送短信发生错误')
|
|
|
+ console.error('matchExt - toFirstStep:发送短信发生错误');
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|