fix;提交、
This commit is contained in:
@@ -143,7 +143,7 @@ export class CreateEventDto {
|
||||
|
||||
export class CreateTicketDto {
|
||||
@IsString()
|
||||
@IsIn(['REFUND', 'RESHIPMENT', 'ALERT'])
|
||||
@IsIn(['REFUND', 'RESHIPMENT', 'ALERT', 'DAMAGE_RETURN', 'RETURN_REFUND'])
|
||||
ticketType: string;
|
||||
|
||||
@IsString()
|
||||
@@ -165,6 +165,9 @@ export class CreateTicketDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
param1Desc?: string;
|
||||
|
||||
@IsOptional()
|
||||
extraJson?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export class UpdateTicketStatusDto {
|
||||
|
||||
@@ -10,7 +10,9 @@ import { AssignTicketDto, CreateTicketDto, UpdateTicketStatusDto } from './dto/c
|
||||
export class TicketController {
|
||||
constructor(private readonly service: TicketService) {}
|
||||
|
||||
/** 总部建单;用户售后请走 /trade/orders/:id/after-sale-tickets */
|
||||
@Post()
|
||||
@UseGuards(HqAuthGuard)
|
||||
create(@Body() dto: CreateTicketDto) {
|
||||
return this.service.create(dto);
|
||||
}
|
||||
@@ -26,6 +28,7 @@ export class TicketController {
|
||||
}
|
||||
|
||||
@Put(':id/status')
|
||||
@UseGuards(HqAuthGuard)
|
||||
updateStatus(@Param('id') id: string, @Body() dto: UpdateTicketStatusDto) {
|
||||
return this.service.updateStatus(BigInt(id), dto);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ export class TicketService {
|
||||
remark: dto.remark,
|
||||
param1: dto.param1,
|
||||
param1Desc: dto.param1Desc,
|
||||
extraJson: dto.extraJson ? (dto.extraJson as Prisma.InputJsonValue) : undefined,
|
||||
},
|
||||
});
|
||||
return serializeBigInt(ticket);
|
||||
@@ -69,6 +70,24 @@ export class TicketService {
|
||||
return serializeBigInt(ticket);
|
||||
}
|
||||
|
||||
async updateExtraJson(id: bigint, extraJson: Record<string, unknown>, status?: string, remark?: string) {
|
||||
await this.detail(id);
|
||||
const ticket = await this.prisma.commonTicket.update({
|
||||
where: { id },
|
||||
data: {
|
||||
extraJson: extraJson as Prisma.InputJsonValue,
|
||||
...(status
|
||||
? {
|
||||
status,
|
||||
completedAt: ['COMPLETED', 'CLOSED', 'RESOLVED'].includes(status) ? new Date() : undefined,
|
||||
}
|
||||
: {}),
|
||||
...(remark !== undefined ? { remark } : {}),
|
||||
},
|
||||
});
|
||||
return serializeBigInt(ticket);
|
||||
}
|
||||
|
||||
async assign(id: bigint, dto: AssignTicketDto) {
|
||||
await this.detail(id);
|
||||
const ticket = await this.prisma.commonTicket.update({
|
||||
|
||||
Reference in New Issue
Block a user