48 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package commands
 | |
| 
 | |
| // CreateArticleCommand 创建文章命令
 | |
| type CreateArticleCommand struct {
 | |
| 	Title       string   `json:"title" binding:"required" comment:"文章标题"`
 | |
| 	Content     string   `json:"content" binding:"required" comment:"文章内容"`
 | |
| 	Summary     string   `json:"summary" comment:"文章摘要"`
 | |
| 	CoverImage  string   `json:"cover_image" comment:"封面图片"`
 | |
| 	CategoryID  string   `json:"category_id" comment:"分类ID"`
 | |
| 	TagIDs      []string `json:"tag_ids" comment:"标签ID列表"`
 | |
| 	IsFeatured  bool     `json:"is_featured" comment:"是否推荐"`
 | |
| }
 | |
| 
 | |
| // UpdateArticleCommand 更新文章命令
 | |
| type UpdateArticleCommand struct {
 | |
| 	ID          string   `json:"-" uri:"id" binding:"required" comment:"文章ID"`
 | |
| 	Title       string   `json:"title" comment:"文章标题"`
 | |
| 	Content     string   `json:"content" comment:"文章内容"`
 | |
| 	Summary     string   `json:"summary" comment:"文章摘要"`
 | |
| 	CoverImage  string   `json:"cover_image" comment:"封面图片"`
 | |
| 	CategoryID  string   `json:"category_id" comment:"分类ID"`
 | |
| 	TagIDs      []string `json:"tag_ids" comment:"标签ID列表"`
 | |
| 	IsFeatured  bool     `json:"is_featured" comment:"是否推荐"`
 | |
| }
 | |
| 
 | |
| // DeleteArticleCommand 删除文章命令
 | |
| type DeleteArticleCommand struct {
 | |
| 	ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"`
 | |
| }
 | |
| 
 | |
| // PublishArticleCommand 发布文章命令
 | |
| type PublishArticleCommand struct {
 | |
| 	ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"`
 | |
| }
 | |
| 
 | |
| // ArchiveArticleCommand 归档文章命令
 | |
| type ArchiveArticleCommand struct {
 | |
| 	ID string `json:"-" uri:"id" binding:"required" comment:"文章ID"`
 | |
| }
 | |
| 
 | |
| // SetFeaturedCommand 设置推荐状态命令
 | |
| type SetFeaturedCommand struct {
 | |
| 	ID         string `json:"-" uri:"id" binding:"required" comment:"文章ID"`
 | |
| 	IsFeatured bool   `json:"is_featured" binding:"required" comment:"是否推荐"`
 | |
| }
 | |
| 
 | |
| 
 |