Files
nl-video-api/api/v1/comment.go
2025-08-03 00:11:15 +08:00

157 lines
6.7 KiB
Go

package v1
import (
"github.com/gogf/gf/v2/frame/g"
)
// CommentAddReq 添加评论请求
type CommentAddReq struct {
g.Meta `path:"/comment/add" method:"post" summary:"添加评论" tags:"评论管理"`
MovieId int `json:"movie_id" v:"required|min:1#影片ID不能为空|影片ID必须大于0" dc:"影片ID"`
ParentId int `json:"parent_id" v:"min:0#父评论ID必须大于等于0" dc:"父评论ID" default:"0"`
Content string `json:"content" v:"required|length:1,500#评论内容不能为空|评论内容长度为1-500字符" dc:"评论内容"`
}
// CommentAddRes 添加评论响应
type CommentAddRes struct {
g.Meta `mime:"application/json"`
Id uint `json:"id" dc:"评论ID"`
}
// CommentListReq 评论列表请求
type CommentListReq struct {
g.Meta `path:"/comment/list" method:"get" summary:"评论列表" tags:"评论管理"`
MovieId int `json:"movie_id" v:"required|min:1#影片ID不能为空|影片ID必须大于0" dc:"影片ID"`
ParentId int `json:"parent_id" v:"min:0#父评论ID必须大于等于0" dc:"父评论ID" default:"0"`
Page int `json:"page" v:"min:1#页码必须大于0" dc:"页码" default:"1"`
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100" dc:"每页数量" default:"10"`
}
// CommentListRes 评论列表响应
type CommentListRes struct {
g.Meta `mime:"application/json"`
List []CommentItem `json:"list" dc:"评论列表"`
Total int `json:"total" dc:"总数"`
Page int `json:"page" dc:"当前页"`
Size int `json:"size" dc:"每页数量"`
}
// CommentItem 评论项目
type CommentItem struct {
Id uint `json:"id" dc:"评论ID"`
UserId int `json:"user_id" dc:"用户ID"`
Username string `json:"username" dc:"用户名"`
UserAvatar string `json:"user_avatar" dc:"用户头像"`
MovieId int `json:"movie_id" dc:"影片ID"`
ParentId int `json:"parent_id" dc:"父评论ID"`
Content string `json:"content" dc:"评论内容"`
LikeCount int `json:"like_count" dc:"点赞数"`
IsLiked bool `json:"is_liked" dc:"是否已点赞"`
Status int `json:"status" dc:"状态"`
CreatedAt string `json:"created_at" dc:"创建时间"`
Replies []CommentItem `json:"replies,omitempty" dc:"回复列表"`
}
// CommentDeleteReq 删除评论请求
type CommentDeleteReq struct {
g.Meta `path:"/comment/delete" method:"post" summary:"删除评论" tags:"评论管理"`
Id uint `json:"id" v:"required|min:1#评论ID不能为空|评论ID必须大于0" dc:"评论ID"`
}
// CommentDeleteRes 删除评论响应
type CommentDeleteRes struct {
g.Meta `mime:"application/json"`
}
// CommentLikeReq 点赞评论请求
type CommentLikeReq struct {
g.Meta `path:"/comment/like" method:"post" summary:"点赞评论" tags:"评论管理"`
Id uint `json:"id" v:"required|min:1#评论ID不能为空|评论ID必须大于0" dc:"评论ID"`
}
// CommentLikeRes 点赞评论响应
type CommentLikeRes struct {
g.Meta `mime:"application/json"`
}
// CommentUnlikeReq 取消点赞请求
type CommentUnlikeReq struct {
g.Meta `path:"/comment/unlike" method:"post" summary:"取消点赞" tags:"评论管理"`
Id uint `json:"id" v:"required|min:1#评论ID不能为空|评论ID必须大于0" dc:"评论ID"`
}
// CommentUnlikeRes 取消点赞响应
type CommentUnlikeRes struct {
g.Meta `mime:"application/json"`
}
// CommentReportReq 举报评论请求
type CommentReportReq struct {
g.Meta `path:"/comment/report" method:"post" summary:"举报评论" tags:"评论管理"`
Id uint `json:"id" v:"required|min:1#评论ID不能为空|评论ID必须大于0" dc:"评论ID"`
Reason string `json:"reason" v:"required|length:1,200#举报原因不能为空|举报原因长度为1-200字符" dc:"举报原因"`
}
// CommentReportRes 举报评论响应
type CommentReportRes struct {
g.Meta `mime:"application/json"`
}
// AdminCommentListReq 管理员评论列表请求
type AdminCommentListReq struct {
g.Meta `path:"/admin/comment/list" method:"get" summary:"管理员评论列表" tags:"评论管理"`
MovieId int `json:"movie_id" v:"min:0#影片ID必须大于等于0" dc:"影片ID"`
UserId int `json:"user_id" v:"min:0#用户ID必须大于等于0" dc:"用户ID"`
Status int `json:"status" v:"in:-1,0,1,2#状态值错误" dc:"状态(-1:全部,0:待审核,1:已通过,2:已拒绝)" default:"-1"`
Keyword string `json:"keyword" dc:"关键词搜索"`
Page int `json:"page" v:"min:1#页码必须大于0" dc:"页码" default:"1"`
Size int `json:"size" v:"min:1|max:100#每页数量必须大于0|每页数量不能超过100" dc:"每页数量" default:"10"`
}
// AdminCommentListRes 管理员评论列表响应
type AdminCommentListRes struct {
g.Meta `mime:"application/json"`
List []AdminCommentItem `json:"list" dc:"评论列表"`
Total int `json:"total" dc:"总数"`
Page int `json:"page" dc:"当前页"`
Size int `json:"size" dc:"每页数量"`
}
// AdminCommentItem 管理员评论项目
type AdminCommentItem struct {
Id uint `json:"id" dc:"评论ID"`
UserId int `json:"user_id" dc:"用户ID"`
Username string `json:"username" dc:"用户名"`
MovieId int `json:"movie_id" dc:"影片ID"`
MovieName string `json:"movie_name" dc:"影片名称"`
ParentId int `json:"parent_id" dc:"父评论ID"`
Content string `json:"content" dc:"评论内容"`
LikeCount int `json:"like_count" dc:"点赞数"`
Status int `json:"status" dc:"状态"`
CreatedAt string `json:"created_at" dc:"创建时间"`
UpdatedAt string `json:"updated_at" dc:"更新时间"`
}
// AdminCommentUpdateStatusReq 管理员更新评论状态请求
type AdminCommentUpdateStatusReq struct {
g.Meta `path:"/admin/comment/status" method:"post" summary:"更新评论状态" tags:"评论管理"`
Id uint `json:"id" v:"required|min:1#评论ID不能为空|评论ID必须大于0" dc:"评论ID"`
Status int `json:"status" v:"required|in:0,1,2#状态不能为空|状态值错误" dc:"状态(0:待审核,1:已通过,2:已拒绝)"`
}
// AdminCommentUpdateStatusRes 管理员更新评论状态响应
type AdminCommentUpdateStatusRes struct {
g.Meta `mime:"application/json"`
}
// AdminCommentBatchDeleteReq 管理员批量删除评论请求
type AdminCommentBatchDeleteReq struct {
g.Meta `path:"/admin/comment/batch-delete" method:"post" summary:"批量删除评论" tags:"评论管理"`
Ids []uint `json:"ids" v:"required|length:1,100#评论ID列表不能为空|最多选择100条记录" dc:"评论ID列表"`
}
// AdminCommentBatchDeleteRes 管理员批量删除评论响应
type AdminCommentBatchDeleteRes struct {
g.Meta `mime:"application/json"`
}