2026-03-27 22:20:25 +08:00
|
|
|
import {
|
|
|
|
|
Controller, Get, Post, Param, Query, Body,
|
|
|
|
|
ParseIntPipe, UseGuards, Request,
|
|
|
|
|
} from '@nestjs/common';
|
|
|
|
|
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
|
|
|
|
import { ContentReviewService } from './content-review.service';
|
|
|
|
|
|
|
|
|
|
@Controller('content-review')
|
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
|
|
|
export class ContentReviewController {
|
|
|
|
|
constructor(private readonly reviewService: ContentReviewService) {}
|
|
|
|
|
|
|
|
|
|
// ========== 作品审核 ==========
|
|
|
|
|
|
|
|
|
|
@Get('works/stats')
|
|
|
|
|
getWorkStats() {
|
|
|
|
|
return this.reviewService.getWorkStats();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('works')
|
|
|
|
|
getWorkQueue(
|
|
|
|
|
@Query('page') page?: string,
|
|
|
|
|
@Query('pageSize') pageSize?: string,
|
|
|
|
|
@Query('status') status?: string,
|
|
|
|
|
@Query('keyword') keyword?: string,
|
|
|
|
|
@Query('startTime') startTime?: string,
|
|
|
|
|
@Query('endTime') endTime?: string,
|
2026-03-31 15:21:21 +08:00
|
|
|
@Query('sortBy') sortBy?: string,
|
|
|
|
|
@Query('isRecommended') isRecommended?: string,
|
2026-03-27 22:20:25 +08:00
|
|
|
) {
|
|
|
|
|
return this.reviewService.getWorkQueue({
|
|
|
|
|
page: page ? parseInt(page) : 1,
|
|
|
|
|
pageSize: pageSize ? parseInt(pageSize) : 10,
|
|
|
|
|
status,
|
|
|
|
|
keyword,
|
|
|
|
|
startTime,
|
|
|
|
|
endTime,
|
2026-03-31 15:21:21 +08:00
|
|
|
sortBy,
|
|
|
|
|
isRecommended: isRecommended === '1',
|
2026-03-27 22:20:25 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('works/:id')
|
|
|
|
|
getWorkDetail(@Param('id', ParseIntPipe) id: number) {
|
|
|
|
|
return this.reviewService.getWorkDetail(id);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 15:21:21 +08:00
|
|
|
@Post('works/batch-approve')
|
|
|
|
|
batchApprove(@Request() req, @Body() dto: { ids: number[] }) {
|
|
|
|
|
return this.reviewService.batchApprove(dto.ids || [], req.user.userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('works/batch-reject')
|
|
|
|
|
batchReject(@Request() req, @Body() dto: { ids: number[]; reason: string }) {
|
|
|
|
|
return this.reviewService.batchReject(dto.ids || [], req.user.userId, dto.reason);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-27 22:20:25 +08:00
|
|
|
@Post('works/:id/approve')
|
|
|
|
|
approveWork(
|
|
|
|
|
@Param('id', ParseIntPipe) id: number,
|
|
|
|
|
@Request() req,
|
|
|
|
|
@Body() dto: { note?: string },
|
|
|
|
|
) {
|
|
|
|
|
return this.reviewService.approve(id, req.user.userId, dto.note);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('works/:id/reject')
|
|
|
|
|
rejectWork(
|
|
|
|
|
@Param('id', ParseIntPipe) id: number,
|
|
|
|
|
@Request() req,
|
|
|
|
|
@Body() dto: { reason: string; note?: string },
|
|
|
|
|
) {
|
|
|
|
|
return this.reviewService.reject(id, req.user.userId, dto.reason, dto.note);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-31 15:21:21 +08:00
|
|
|
@Post('works/:id/revoke')
|
|
|
|
|
revokeWork(@Param('id', ParseIntPipe) id: number, @Request() req) {
|
|
|
|
|
return this.reviewService.revoke(id, req.user.userId);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-27 22:20:25 +08:00
|
|
|
@Post('works/:id/takedown')
|
|
|
|
|
takedownWork(
|
|
|
|
|
@Param('id', ParseIntPipe) id: number,
|
|
|
|
|
@Request() req,
|
|
|
|
|
@Body() dto: { reason: string },
|
|
|
|
|
) {
|
|
|
|
|
return this.reviewService.takedown(id, req.user.userId, dto.reason);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('works/:id/restore')
|
|
|
|
|
restoreWork(@Param('id', ParseIntPipe) id: number, @Request() req) {
|
|
|
|
|
return this.reviewService.restore(id, req.user.userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('works/:id/recommend')
|
|
|
|
|
toggleRecommend(@Param('id', ParseIntPipe) id: number) {
|
|
|
|
|
return this.reviewService.toggleRecommend(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ========== 作品管理 ==========
|
|
|
|
|
|
|
|
|
|
@Get('management/stats')
|
|
|
|
|
getManagementStats() {
|
|
|
|
|
return this.reviewService.getManagementStats();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ========== 审核日志 ==========
|
|
|
|
|
|
|
|
|
|
@Get('logs')
|
|
|
|
|
getLogs(
|
|
|
|
|
@Query('page') page?: string,
|
|
|
|
|
@Query('pageSize') pageSize?: string,
|
|
|
|
|
@Query('workId') workId?: string,
|
|
|
|
|
) {
|
|
|
|
|
return this.reviewService.getLogs({
|
|
|
|
|
page: page ? parseInt(page) : 1,
|
|
|
|
|
pageSize: pageSize ? parseInt(pageSize) : 20,
|
|
|
|
|
workId: workId ? parseInt(workId) : undefined,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|