zs преди 4 месеца
родител
ревизия
3058d49553
променени са 3 файла, в които са добавени 19 реда и са изтрити 22 реда
  1. 17 20
      src/controller/match/matchExt.controller.ts
  2. 1 1
      src/controller/match/matchRegistration.controller.ts
  3. 1 1
      src/entity/match/matchRegistration.entity.ts

+ 17 - 20
src/controller/match/matchExt.controller.ts

@@ -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:发送短信发生错误');
       }
     }
-
   }
 }

+ 1 - 1
src/controller/match/matchRegistration.controller.ts

@@ -169,7 +169,7 @@ export class MatchRegistrationController implements BaseController {
     return list;
   }
 
-  @Get('/export/:match_id', { routerName: `导出初赛名单` })
+  @Get('/export/:match_id', { routerName: '导出初赛名单' })
   @ApiTags('导出初赛名单')
   async exportList(@Param('match_id') match_id: string) {
     // 查询所有未被退回的报名信息

+ 1 - 1
src/entity/match/matchRegistration.entity.ts

@@ -22,4 +22,4 @@ export class MatchRegistration extends BaseModel {
   score: number;
   @Column({ type: 'timestamp without time zone', nullable: true, comment: '初赛开始时间', transformer: { from: value => (value ? dayjs(value).format('YYYY-MM-DD HH:mm:ss') : value), to: value => value } })
   start_time: Date;
-}
+}