lrf 3 bulan lalu
induk
melakukan
e2fb8c7dd1

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

@@ -8,6 +8,7 @@ import { BaseController } from '../../frame/BaseController';
 import { MatchRegistrationService } from '../../service/match/matchRegistration.service';
 import { UserService } from '../../service/system/user.service';
 import * as bcrypt from 'bcryptjs';
+import dayjs = require('dayjs');
 const namePrefix = '创新大赛-赛事报名';
 @ApiTags(['创新大赛-赛事报名'])
 @Controller('/matchReg', { tagName: namePrefix })
@@ -70,7 +71,7 @@ export class MatchRegistrationController implements BaseController {
     // 制作项目编号
     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 }
+    regData = { ...regData, no, time: dayjs().format('YYYY-MM-DD HH:mm:ss') }
     const result = await this.service.create(regData);
     return result;
   }

+ 3 - 0
src/entity/match/matchRegistration.entity.ts

@@ -1,5 +1,6 @@
 import { Entity, Column } from 'typeorm';
 import { BaseModel } from '../../frame/BaseModel';
+import dayjs = require('dayjs');
 //赛事
 @Entity('matchRegistration', { comment: '赛事报名' })
 export class MatchRegistration extends BaseModel {
@@ -13,4 +14,6 @@ export class MatchRegistration extends BaseModel {
   status: string;
   @Column({ type: 'character varying', nullable: true, comment: '项目编号: ${match_id}-${user_id}-${该赛事第x位}' })
   no: string;
+  @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 } })
+  time: Date;
 }