新增文章阅读数功能,包括在控制器和服务中添加增加阅读数的方法,并更新相关路由以支持该功能。

This commit is contained in:
richarjiang
2025-08-14 16:11:22 +08:00
parent b4dfdcfe70
commit 96a1190f74
3 changed files with 173 additions and 172 deletions

View File

@@ -32,6 +32,14 @@ export class ArticlesController {
async getOne(@Param('id') id: string): Promise<CreateArticleResponseDto> {
return this.articlesService.getAndIncreaseReadCount(id);
}
// 增加阅读数
@Post(':id/read-count')
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: '增加文章阅读数' })
async increaseReadCount(@Param('id') id: string): Promise<CreateArticleResponseDto> {
return this.articlesService.increaseReadCount(id);
}
}