增加离开时间

main
rustdreamer 2 years ago
parent 6f1399cb56
commit 5012d3d7bf

@ -60,6 +60,13 @@ export class UpdateVisitorNumber {
public card_number: string; public card_number: string;
} }
export class UpdateVisitorEnd {
@ApiProperty({ description: "id" })
@IsString()
@IsNotEmpty()
public id: string;
}
export class CreateVisitor { export class CreateVisitor {
@ApiProperty({ description: "申请人" }) @ApiProperty({ description: "申请人" })
@IsString() @IsString()
@ -371,6 +378,28 @@ export class AppController {
return result; return result;
} }
@Put("/visitor/end")
async updateVisitorEnd(@Body() data: UpdateVisitorEnd) {
const node_other_visitor = await this.nodeOtherVisitorRepository.findOne({ where: { id: data.id } })
if (!node_other_visitor) {
throw new BadRequestException("数据不存在")
}
node_other_visitor.end_time= new Date();
const result = await this.nodeOtherVisitorRepository.save(node_other_visitor);
return result;
}
@Put("/visitor/start")
async updateVisitorStart(@Body() data: UpdateVisitorEnd) {
const node_other_visitor = await this.nodeOtherVisitorRepository.findOne({ where: { id: data.id } })
if (!node_other_visitor) {
throw new BadRequestException("数据不存在")
}
node_other_visitor.start_time = new Date();
const result = await this.nodeOtherVisitorRepository.save(node_other_visitor);
return result;
}
@Post('upload/base64') @Post('upload/base64')
async louploadBase64Filegin( async louploadBase64Filegin(
@Body() input: any, @Body() input: any,

@ -33,4 +33,12 @@ export class NodeOtherVisitorEntity extends Base {
@ApiProperty({ description: "" }) @ApiProperty({ description: "" })
@Column({ length: 36, nullable: true, type: 'char' }) @Column({ length: 36, nullable: true, type: 'char' })
public node_visitor_id: string; public node_visitor_id: string;
@ApiProperty({ description: "进入时间" })
@Column({ nullable: true })
public start_time: Date;
@ApiProperty({ description: "离开时间" })
@Column({ nullable: true })
public end_time: Date;
} }

Loading…
Cancel
Save