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

81 lines
3.3 KiB
Go

package v1
import (
"github.com/gogf/gf/v2/frame/g"
)
// UserWatchHistoryAddReq 添加观看历史请求
type UserWatchHistoryAddReq struct {
g.Meta `path:"/user/history/add" method:"post" summary:"添加观看历史" tags:"观看历史"`
MovieId int `json:"movie_id" v:"required|min:1#影片ID不能为空|影片ID必须大于0" dc:"影片ID"`
EpisodeId int `json:"episode_id" v:"min:0#剧集ID必须大于等于0" dc:"剧集ID"`
Progress int `json:"progress" v:"min:0|max:100#观看进度必须在0-100之间" dc:"观看进度(百分比)" default:"0"`
}
// UserWatchHistoryAddRes 添加观看历史响应
type UserWatchHistoryAddRes struct {
g.Meta `mime:"application/json"`
}
// UserWatchHistoryListReq 观看历史列表请求
type UserWatchHistoryListReq struct {
g.Meta `path:"/user/history/list" method:"get" summary:"观看历史列表" tags:"观看历史"`
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"`
}
// UserWatchHistoryListRes 观看历史列表响应
type UserWatchHistoryListRes struct {
g.Meta `mime:"application/json"`
List []UserWatchHistoryItem `json:"list" dc:"观看历史列表"`
Total int `json:"total" dc:"总数"`
Page int `json:"page" dc:"当前页"`
Size int `json:"size" dc:"每页数量"`
}
// UserWatchHistoryItem 观看历史项目
type UserWatchHistoryItem struct {
Id uint `json:"id" dc:"历史记录ID"`
MovieId int `json:"movie_id" dc:"影片ID"`
MovieName string `json:"movie_name" dc:"影片名称"`
MovieCover string `json:"movie_cover" dc:"影片封面"`
EpisodeId int `json:"episode_id" dc:"剧集ID"`
EpisodeName string `json:"episode_name" dc:"剧集名称"`
Progress int `json:"progress" dc:"观看进度"`
WatchedAt string `json:"watched_at" dc:"观看时间"`
}
// UserWatchHistoryDeleteReq 删除观看历史请求
type UserWatchHistoryDeleteReq struct {
g.Meta `path:"/user/history/delete" method:"post" summary:"删除观看历史" tags:"观看历史"`
Id uint `json:"id" v:"required|min:1#历史记录ID不能为空|历史记录ID必须大于0" dc:"历史记录ID"`
}
// UserWatchHistoryDeleteRes 删除观看历史响应
type UserWatchHistoryDeleteRes struct {
g.Meta `mime:"application/json"`
}
// UserWatchHistoryClearReq 清空观看历史请求
type UserWatchHistoryClearReq struct {
g.Meta `path:"/user/history/clear" method:"post" summary:"清空观看历史" tags:"观看历史"`
}
// UserWatchHistoryClearRes 清空观看历史响应
type UserWatchHistoryClearRes struct {
g.Meta `mime:"application/json"`
}
// UserWatchHistoryGetReq 获取观看进度请求
type UserWatchHistoryGetReq struct {
g.Meta `path:"/user/history/get" method:"get" summary:"获取观看进度" tags:"观看历史"`
MovieId int `json:"movie_id" v:"required|min:1#影片ID不能为空|影片ID必须大于0" dc:"影片ID"`
EpisodeId int `json:"episode_id" v:"min:0#剧集ID必须大于等于0" dc:"剧集ID"`
}
// UserWatchHistoryGetRes 获取观看进度响应
type UserWatchHistoryGetRes struct {
g.Meta `mime:"application/json"`
Progress int `json:"progress" dc:"观看进度"`
}