This commit is contained in:
2025-09-01 20:46:56 +08:00
parent 5d5372e359
commit 5c5c2abfcd
8 changed files with 1370 additions and 1187 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1035,11 +1035,42 @@ definitions:
view_count:
type: integer
type: object
responses.ArticleListItemResponse:
properties:
category:
$ref: '#/definitions/tyapi-server_internal_application_article_dto_responses.CategoryInfoResponse'
category_id:
type: string
cover_image:
type: string
created_at:
type: string
id:
type: string
is_featured:
type: boolean
published_at:
type: string
status:
type: string
summary:
type: string
tags:
items:
$ref: '#/definitions/responses.TagInfoResponse'
type: array
title:
type: string
updated_at:
type: string
view_count:
type: integer
type: object
responses.ArticleListResponse:
properties:
items:
items:
$ref: '#/definitions/responses.ArticleInfoResponse'
$ref: '#/definitions/responses.ArticleListItemResponse'
type: array
page:
type: integer
@@ -2320,7 +2351,7 @@ paths:
- Bearer: []
summary: 创建分类
tags:
- 文章分类管理
- 文章分类-管理
/api/v1/admin/article-categories/{id}:
delete:
consumes:
@@ -2364,7 +2395,7 @@ paths:
- Bearer: []
summary: 删除分类
tags:
- 文章分类管理
- 文章分类-管理
put:
consumes:
- application/json
@@ -2413,7 +2444,7 @@ paths:
- Bearer: []
summary: 更新分类
tags:
- 文章分类管理
- 文章分类-管理
/api/v1/admin/article-tags:
post:
consumes:
@@ -2453,7 +2484,7 @@ paths:
- Bearer: []
summary: 创建标签
tags:
- 文章标签管理
- 文章标签-管理
/api/v1/admin/article-tags/{id}:
delete:
consumes:
@@ -2497,7 +2528,7 @@ paths:
- Bearer: []
summary: 删除标签
tags:
- 文章标签管理
- 文章标签-管理
put:
consumes:
- application/json
@@ -2546,7 +2577,278 @@ paths:
- Bearer: []
summary: 更新标签
tags:
- 文章标签管理
- 文章标签-管理
/api/v1/admin/articles:
post:
consumes:
- application/json
description: 创建新的文章
parameters:
- description: 创建文章请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/commands.CreateArticleCommand'
produces:
- application/json
responses:
"201":
description: 文章创建成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 创建文章
tags:
- 文章管理-管理端
/api/v1/admin/articles/{id}:
delete:
consumes:
- application/json
description: 删除指定文章
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 文章删除成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 删除文章
tags:
- 文章管理-管理端
put:
consumes:
- application/json
description: 更新文章信息
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
- description: 更新文章请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/commands.UpdateArticleCommand'
produces:
- application/json
responses:
"200":
description: 文章更新成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 更新文章
tags:
- 文章管理-管理端
/api/v1/admin/articles/{id}/archive:
post:
consumes:
- application/json
description: 将已发布文章归档
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 文章归档成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 归档文章
tags:
- 文章管理-管理端
/api/v1/admin/articles/{id}/featured:
put:
consumes:
- application/json
description: 设置文章的推荐状态
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
- description: 设置推荐状态请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/commands.SetFeaturedCommand'
produces:
- application/json
responses:
"200":
description: 设置推荐状态成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 设置推荐状态
tags:
- 文章管理-管理端
/api/v1/admin/articles/{id}/publish:
post:
consumes:
- application/json
description: 将草稿文章发布
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 文章发布成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 发布文章
tags:
- 文章管理-管理端
/api/v1/admin/articles/{id}/schedule-publish:
post:
consumes:
@@ -2596,7 +2898,7 @@ paths:
- Bearer: []
summary: 定时发布文章
tags:
- 文章管理
- 文章管理-管理端
/api/v1/admin/articles/stats:
get:
consumes:
@@ -2623,7 +2925,7 @@ paths:
- Bearer: []
summary: 获取文章统计
tags:
- 文章管理
- 文章管理-管理端
/api/v1/admin/invoices/{application_id}/approve:
post:
consumes:
@@ -4256,7 +4558,7 @@ paths:
type: object
summary: 获取分类列表
tags:
- 文章分类
- 文章分类-用户端
/api/v1/article-categories/{id}:
get:
consumes:
@@ -4292,7 +4594,7 @@ paths:
type: object
summary: 获取分类详情
tags:
- 文章分类
- 文章分类-用户端
/api/v1/article-tags:
get:
consumes:
@@ -4312,7 +4614,7 @@ paths:
type: object
summary: 获取标签列表
tags:
- 文章标签
- 文章标签-用户端
/api/v1/article-tags/{id}:
get:
consumes:
@@ -4348,7 +4650,7 @@ paths:
type: object
summary: 获取标签详情
tags:
- 文章标签
- 文章标签-用户端
/api/v1/articles:
get:
consumes:
@@ -4416,90 +4718,8 @@ paths:
type: object
summary: 获取文章列表
tags:
- 文章管理
post:
consumes:
- application/json
description: 创建新的文章
parameters:
- description: 创建文章请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/commands.CreateArticleCommand'
produces:
- application/json
responses:
"201":
description: 文章创建成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 创建文章
tags:
- 文章管理
- 文章管理-用户端
/api/v1/articles/{id}:
delete:
consumes:
- application/json
description: 删除指定文章
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 文章删除成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 删除文章
tags:
- 文章管理
get:
consumes:
- application/json
@@ -4522,11 +4742,6 @@ paths:
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
@@ -4537,198 +4752,9 @@ paths:
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 获取文章详情
tags:
- 文章管理
put:
consumes:
- application/json
description: 更新文章信息
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
- description: 更新文章请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/commands.UpdateArticleCommand'
produces:
- application/json
responses:
"200":
description: 文章更新成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 更新文章
tags:
- 文章管理
/api/v1/articles/{id}/archive:
post:
consumes:
- application/json
description: 将已发布文章归档
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 文章归档成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 归档文章
tags:
- 文章管理
/api/v1/articles/{id}/featured:
put:
consumes:
- application/json
description: 设置文章的推荐状态
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
- description: 设置推荐状态请求
in: body
name: request
required: true
schema:
$ref: '#/definitions/commands.SetFeaturedCommand'
produces:
- application/json
responses:
"200":
description: 设置推荐状态成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 设置推荐状态
tags:
- 文章管理
/api/v1/articles/{id}/publish:
post:
consumes:
- application/json
description: 将草稿文章发布
parameters:
- description: 文章ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: 文章发布成功
schema:
additionalProperties: true
type: object
"400":
description: 请求参数错误
schema:
additionalProperties: true
type: object
"401":
description: 未认证
schema:
additionalProperties: true
type: object
"404":
description: 文章不存在
schema:
additionalProperties: true
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties: true
type: object
security:
- Bearer: []
summary: 发布文章
tags:
- 文章管理
- 文章管理-用户端
/api/v1/categories:
get:
consumes:

View File

@@ -210,7 +210,7 @@ func (s *ArticleApplicationServiceImpl) ListArticles(ctx context.Context, query
}
// 3. 转换为响应对象
items := responses.FromArticleEntities(articles)
items := responses.FromArticleEntitiesToListItemList(articles)
response := &responses.ArticleListResponse{
Total: total,

View File

@@ -23,12 +23,29 @@ type ArticleInfoResponse struct {
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
}
// ArticleListItemResponse 文章列表项响应不包含content
type ArticleListItemResponse struct {
ID string `json:"id" comment:"文章ID"`
Title string `json:"title" comment:"文章标题"`
Summary string `json:"summary" comment:"文章摘要"`
CoverImage string `json:"cover_image" comment:"封面图片"`
CategoryID string `json:"category_id" comment:"分类ID"`
Category *CategoryInfoResponse `json:"category,omitempty" comment:"分类信息"`
Status string `json:"status" comment:"文章状态"`
IsFeatured bool `json:"is_featured" comment:"是否推荐"`
PublishedAt *time.Time `json:"published_at" comment:"发布时间"`
ViewCount int `json:"view_count" comment:"阅读量"`
Tags []TagInfoResponse `json:"tags" comment:"标签列表"`
CreatedAt time.Time `json:"created_at" comment:"创建时间"`
UpdatedAt time.Time `json:"updated_at" comment:"更新时间"`
}
// ArticleListResponse 文章列表响应
type ArticleListResponse struct {
Total int64 `json:"total" comment:"总数"`
Page int `json:"page" comment:"页码"`
Size int `json:"size" comment:"每页数量"`
Items []ArticleInfoResponse `json:"items" comment:"文章列表"`
Total int64 `json:"total" comment:"总数"`
Page int `json:"page" comment:"页码"`
Size int `json:"size" comment:"每页数量"`
Items []ArticleListItemResponse `json:"items" comment:"文章列表"`
}
// CategoryInfoResponse 分类信息响应
@@ -118,6 +135,53 @@ func FromArticleEntity(article *entities.Article) *ArticleInfoResponse {
return response
}
// FromArticleEntityToListItem 从文章实体转换为列表项响应对象不包含content
func FromArticleEntityToListItem(article *entities.Article) *ArticleListItemResponse {
if article == nil {
return nil
}
response := &ArticleListItemResponse{
ID: article.ID,
Title: article.Title,
Summary: article.Summary,
CoverImage: article.CoverImage,
CategoryID: article.CategoryID,
Status: string(article.Status),
IsFeatured: article.IsFeatured,
PublishedAt: article.PublishedAt,
ViewCount: article.ViewCount,
CreatedAt: article.CreatedAt,
UpdatedAt: article.UpdatedAt,
}
// 转换分类信息
if article.Category != nil {
response.Category = &CategoryInfoResponse{
ID: article.Category.ID,
Name: article.Category.Name,
Description: article.Category.Description,
SortOrder: article.Category.SortOrder,
CreatedAt: article.Category.CreatedAt,
}
}
// 转换标签信息
if len(article.Tags) > 0 {
response.Tags = make([]TagInfoResponse, len(article.Tags))
for i, tag := range article.Tags {
response.Tags[i] = TagInfoResponse{
ID: tag.ID,
Name: tag.Name,
Color: tag.Color,
CreatedAt: tag.CreatedAt,
}
}
}
return response
}
// FromArticleEntities 从文章实体列表转换为响应对象列表
func FromArticleEntities(articles []*entities.Article) []ArticleInfoResponse {
if len(articles) == 0 {
@@ -133,3 +197,19 @@ func FromArticleEntities(articles []*entities.Article) []ArticleInfoResponse {
return responses
}
// FromArticleEntitiesToListItemList 从文章实体列表转换为列表项响应对象列表不包含content
func FromArticleEntitiesToListItemList(articles []*entities.Article) []ArticleListItemResponse {
if len(articles) == 0 {
return []ArticleListItemResponse{}
}
responses := make([]ArticleListItemResponse, len(articles))
for i, article := range articles {
if response := FromArticleEntityToListItem(article); response != nil {
responses[i] = *response
}
}
return responses
}

View File

@@ -261,7 +261,8 @@ func (r *GormArticleRepository) ListArticles(ctx context.Context, query *repoQue
var articles []entities.Article
var total int64
dbQuery := r.db.WithContext(ctx).Model(&entities.Article{})
dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}).
Select("id, title, summary, cover_image, category_id, status, is_featured, published_at, view_count, created_at, updated_at, scheduled_at")
// 应用筛选条件
if query.Status != "" {

View File

@@ -38,7 +38,7 @@ func NewArticleHandler(
// CreateArticle 创建文章
// @Summary 创建文章
// @Description 创建新的文章
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -47,7 +47,7 @@ func NewArticleHandler(
// @Failure 400 {object} map[string]interface{} "请求参数错误"
// @Failure 401 {object} map[string]interface{} "未认证"
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
// @Router /api/v1/articles [post]
// @Router /api/v1/admin/articles [post]
func (h *ArticleHandler) CreateArticle(c *gin.Context) {
var cmd commands.CreateArticleCommand
if err := h.validator.BindAndValidate(c, &cmd); err != nil {
@@ -72,14 +72,12 @@ func (h *ArticleHandler) CreateArticle(c *gin.Context) {
// GetArticleByID 获取文章详情
// @Summary 获取文章详情
// @Description 根据ID获取文章详情
// @Tags 文章管理
// @Tags 文章管理-用户端
// @Accept json
// @Produce json
// @Security Bearer
// @Param id path string true "文章ID"
// @Success 200 {object} responses.ArticleInfoResponse "获取文章详情成功"
// @Failure 400 {object} map[string]interface{} "请求参数错误"
// @Failure 401 {object} map[string]interface{} "未认证"
// @Failure 404 {object} map[string]interface{} "文章不存在"
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
// @Router /api/v1/articles/{id} [get]
@@ -104,7 +102,7 @@ func (h *ArticleHandler) GetArticleByID(c *gin.Context) {
// ListArticles 获取文章列表
// @Summary 获取文章列表
// @Description 分页获取文章列表,支持多种筛选条件
// @Tags 文章管理
// @Tags 文章管理-用户端
// @Accept json
// @Produce json
// @Param page query int false "页码" default(1)
@@ -153,7 +151,7 @@ func (h *ArticleHandler) ListArticles(c *gin.Context) {
// UpdateArticle 更新文章
// @Summary 更新文章
// @Description 更新文章信息
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -164,7 +162,7 @@ func (h *ArticleHandler) ListArticles(c *gin.Context) {
// @Failure 401 {object} map[string]interface{} "未认证"
// @Failure 404 {object} map[string]interface{} "文章不存在"
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
// @Router /api/v1/articles/{id} [put]
// @Router /api/v1/admin/articles/{id} [put]
func (h *ArticleHandler) UpdateArticle(c *gin.Context) {
var cmd commands.UpdateArticleCommand
cmd.ID = c.Param("id")
@@ -188,7 +186,7 @@ func (h *ArticleHandler) UpdateArticle(c *gin.Context) {
// DeleteArticle 删除文章
// @Summary 删除文章
// @Description 删除指定文章
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -198,7 +196,7 @@ func (h *ArticleHandler) UpdateArticle(c *gin.Context) {
// @Failure 401 {object} map[string]interface{} "未认证"
// @Failure 404 {object} map[string]interface{} "文章不存在"
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
// @Router /api/v1/articles/{id} [delete]
// @Router /api/v1/admin/articles/{id} [delete]
func (h *ArticleHandler) DeleteArticle(c *gin.Context) {
var cmd commands.DeleteArticleCommand
if err := h.validator.ValidateParam(c, &cmd); err != nil {
@@ -217,7 +215,7 @@ func (h *ArticleHandler) DeleteArticle(c *gin.Context) {
// PublishArticle 发布文章
// @Summary 发布文章
// @Description 将草稿文章发布
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -227,7 +225,7 @@ func (h *ArticleHandler) DeleteArticle(c *gin.Context) {
// @Failure 401 {object} map[string]interface{} "未认证"
// @Failure 404 {object} map[string]interface{} "文章不存在"
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
// @Router /api/v1/articles/{id}/publish [post]
// @Router /api/v1/admin/articles/{id}/publish [post]
func (h *ArticleHandler) PublishArticle(c *gin.Context) {
var cmd commands.PublishArticleCommand
if err := h.validator.ValidateParam(c, &cmd); err != nil {
@@ -246,7 +244,7 @@ func (h *ArticleHandler) PublishArticle(c *gin.Context) {
// SchedulePublishArticle 定时发布文章
// @Summary 定时发布文章
// @Description 设置文章的定时发布时间
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -279,7 +277,7 @@ func (h *ArticleHandler) SchedulePublishArticle(c *gin.Context) {
// ArchiveArticle 归档文章
// @Summary 归档文章
// @Description 将已发布文章归档
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -289,7 +287,7 @@ func (h *ArticleHandler) SchedulePublishArticle(c *gin.Context) {
// @Failure 401 {object} map[string]interface{} "未认证"
// @Failure 404 {object} map[string]interface{} "文章不存在"
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
// @Router /api/v1/articles/{id}/archive [post]
// @Router /api/v1/admin/articles/{id}/archive [post]
func (h *ArticleHandler) ArchiveArticle(c *gin.Context) {
var cmd commands.ArchiveArticleCommand
if err := h.validator.ValidateParam(c, &cmd); err != nil {
@@ -308,7 +306,7 @@ func (h *ArticleHandler) ArchiveArticle(c *gin.Context) {
// SetFeatured 设置推荐状态
// @Summary 设置推荐状态
// @Description 设置文章的推荐状态
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -319,7 +317,7 @@ func (h *ArticleHandler) ArchiveArticle(c *gin.Context) {
// @Failure 401 {object} map[string]interface{} "未认证"
// @Failure 404 {object} map[string]interface{} "文章不存在"
// @Failure 500 {object} map[string]interface{} "服务器内部错误"
// @Router /api/v1/articles/{id}/featured [put]
// @Router /api/v1/admin/articles/{id}/featured [put]
func (h *ArticleHandler) SetFeatured(c *gin.Context) {
var cmd commands.SetFeaturedCommand
if err := h.validator.ValidateParam(c, &cmd); err != nil {
@@ -341,7 +339,7 @@ func (h *ArticleHandler) SetFeatured(c *gin.Context) {
// GetArticleStats 获取文章统计
// @Summary 获取文章统计
// @Description 获取文章相关统计数据
// @Tags 文章管理
// @Tags 文章管理-管理端
// @Accept json
// @Produce json
// @Security Bearer
@@ -366,7 +364,7 @@ func (h *ArticleHandler) GetArticleStats(c *gin.Context) {
// ListCategories 获取分类列表
// @Summary 获取分类列表
// @Description 获取所有文章分类
// @Tags 文章分类
// @Tags 文章分类-用户端
// @Accept json
// @Produce json
// @Success 200 {object} responses.CategoryListResponse "获取分类列表成功"
@@ -386,7 +384,7 @@ func (h *ArticleHandler) ListCategories(c *gin.Context) {
// GetCategoryByID 获取分类详情
// @Summary 获取分类详情
// @Description 根据ID获取分类详情
// @Tags 文章分类
// @Tags 文章分类-用户端
// @Accept json
// @Produce json
// @Param id path string true "分类ID"
@@ -416,7 +414,7 @@ func (h *ArticleHandler) GetCategoryByID(c *gin.Context) {
// CreateCategory 创建分类
// @Summary 创建分类
// @Description 创建新的文章分类
// @Tags 文章分类管理
// @Tags 文章分类-管理
// @Accept json
// @Produce json
// @Security Bearer
@@ -444,7 +442,7 @@ func (h *ArticleHandler) CreateCategory(c *gin.Context) {
// UpdateCategory 更新分类
// @Summary 更新分类
// @Description 更新分类信息
// @Tags 文章分类管理
// @Tags 文章分类-管理
// @Accept json
// @Produce json
// @Security Bearer
@@ -479,7 +477,7 @@ func (h *ArticleHandler) UpdateCategory(c *gin.Context) {
// DeleteCategory 删除分类
// @Summary 删除分类
// @Description 删除指定分类
// @Tags 文章分类管理
// @Tags 文章分类-管理
// @Accept json
// @Produce json
// @Security Bearer
@@ -510,7 +508,7 @@ func (h *ArticleHandler) DeleteCategory(c *gin.Context) {
// ListTags 获取标签列表
// @Summary 获取标签列表
// @Description 获取所有文章标签
// @Tags 文章标签
// @Tags 文章标签-用户端
// @Accept json
// @Produce json
// @Success 200 {object} responses.TagListResponse "获取标签列表成功"
@@ -530,7 +528,7 @@ func (h *ArticleHandler) ListTags(c *gin.Context) {
// GetTagByID 获取标签详情
// @Summary 获取标签详情
// @Description 根据ID获取标签详情
// @Tags 文章标签
// @Tags 文章标签-用户端
// @Accept json
// @Produce json
// @Param id path string true "标签ID"
@@ -560,7 +558,7 @@ func (h *ArticleHandler) GetTagByID(c *gin.Context) {
// CreateTag 创建标签
// @Summary 创建标签
// @Description 创建新的文章标签
// @Tags 文章标签管理
// @Tags 文章标签-管理
// @Accept json
// @Produce json
// @Security Bearer
@@ -588,7 +586,7 @@ func (h *ArticleHandler) CreateTag(c *gin.Context) {
// UpdateTag 更新标签
// @Summary 更新标签
// @Description 更新标签信息
// @Tags 文章标签管理
// @Tags 文章标签-管理
// @Accept json
// @Produce json
// @Security Bearer
@@ -623,7 +621,7 @@ func (h *ArticleHandler) UpdateTag(c *gin.Context) {
// DeleteTag 删除标签
// @Summary 删除标签
// @Description 删除指定标签
// @Tags 文章标签管理
// @Tags 文章标签-管理
// @Accept json
// @Produce json
// @Security Bearer

View File

@@ -66,8 +66,8 @@ func (r *ArticleRoutes) Register(router *sharedhttp.GinRouter) {
adminArticleGroup.Use(r.admin.Handle())
{
// 统计信息
adminArticleGroup.GET("/stats", r.handler.GetArticleStats) // 获取文章统计
adminArticleGroup.GET("/stats", r.handler.GetArticleStats) // 获取文章统计
// 文章管理
adminArticleGroup.POST("", r.handler.CreateArticle) // 创建文章
adminArticleGroup.PUT("/:id", r.handler.UpdateArticle) // 更新文章