init: web_hgdjc_server

This commit is contained in:
2026-11-07 10:46:18 +08:00
commit b2ff6ac8ff
707 changed files with 147645 additions and 0 deletions
+766
View File
@@ -0,0 +1,766 @@
package playletapi
import (
"videoweb/app/api/proto"
"videoweb/app/service/playletser"
"videoweb/pub/common"
"videoweb/pub/common/ipaddr"
"videoweb/pub/common/srvdef"
"github.com/gin-gonic/gin"
)
// HomePlaylet app端首页短剧接口
// @Tags app短剧相关接口
// @Summary app端首页短剧接口 --by 王鸣
// @Description 无请求参数,返回首页banner短剧、公告和SEO信息
// @Accept json
// @Produce json
// @Success 200 {object} proto.HomePlayletResponse "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/home [get]
func HomePlaylet(ctx *gin.Context) {
resp, err := playletser.Home(ctx)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HomeConfigList app端分页查询首页配置内容
// @Tags app短剧相关接口
// @Summary app端分页查询首页配置内容
// @Description 根据首页配置ID或slug分页查询短剧或题材,slug 优先
// @Accept json
// @Produce json
// @Param params query proto.PlayletHomeConfigListReq true "首页配置内容分页请求"
// @Success 200 {object} proto.PlayletHomeConfigListResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/home-config/list [get]
func HomeConfigList(ctx *gin.Context) {
var req proto.PlayletHomeConfigListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.HomeConfigList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// AllList app端分页查询全部短剧
// @Tags app短剧相关接口
// @Summary app端分页查询全部短剧 --by 王鸣
// @Description 分页查询已上架短剧,支持题材、更新状态和排序筛选
// @Accept json
// @Produce json
// @Param params query proto.PlayletAllListReq true "全部短剧分页请求"
// @Success 200 {object} proto.PlayletAllListResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/all/list [get]
func AllList(ctx *gin.Context) {
var req proto.PlayletAllListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.AllList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HotList app端分页查询热门短剧
// @Tags app短剧相关接口
// @Summary app端分页查询热门短剧
// @Description 按热度查询已上架短剧,可排除指定短剧
// @Accept json
// @Produce json
// @Param params query proto.PlayletHotListReq true "热门短剧分页请求"
// @Success 200 {object} proto.PlayletHotListResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/hot/list [get]
func HotList(ctx *gin.Context) {
var req proto.PlayletHotListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.HotList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// TopicList app端分页查询专题剧单
// @Tags app短剧相关接口
// @Summary app端分页查询专题剧单 --by 王鸣
// @Description 分页查询各启用区块下有已上架短剧的专题卡片
// @Accept json
// @Produce json
// @Param params query proto.PlayletTopicPageListReq true "专题剧单分页请求"
// @Success 200 {object} proto.PlayletTopicPageListResp{list=[]proto.PlayletTopicGroupPageItem} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/topic/list [get]
func TopicList(ctx *gin.Context) {
var req proto.PlayletTopicPageListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.TopicList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// TopicDetail app端查询专题详情
// @Tags app短剧相关接口
// @Summary app端查询专题详情 --by 王鸣
// @Description 按专题ID查询专题信息和专题短剧列表
// @Accept json
// @Produce json
// @Param params query proto.PlayletTopicDetailReq true "专题详情请求"
// @Success 200 {object} proto.PlayletTopicDetailResp{list=[]proto.CommonData,moreTopics=[]proto.PlayletTopicPageItem} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/topic/detail [get]
func TopicDetail(ctx *gin.Context) {
var req proto.PlayletTopicDetailReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.TopicDetail(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// Rank app端分页查询短剧排行榜
// @Tags app短剧相关接口
// @Summary 短剧排行榜 --by 王鸣
// @Description 分页查询已上架短剧排行榜;sortOrder=1按热度值倒序,2按上架时间倒序,3按收藏数倒序
// @Accept json
// @Produce json
// @Param params query proto.PlayletRankReq true "分页查询短剧排行榜请求"
// @Success 200 {object} proto.PlayletRankResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/rank [get]
func Rank(ctx *gin.Context) {
var req proto.PlayletRankReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.Rank(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HotRankList app端分页查询热榜
// @Tags app短剧相关接口
// @Summary app端分页查询热榜 --by 王鸣
// @Description 分页查询已上架短剧热榜;rankType=1热播榜 2新剧榜 3追剧榜
// @Accept json
// @Produce json
// @Param params query proto.PlayletHotRankListReq true "热榜分页请求"
// @Success 200 {object} proto.PlayletHotRankListResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/hot/rank/list [get]
func HotRankList(ctx *gin.Context) {
var req proto.PlayletHotRankListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.HotRankList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// OperateList app端按类型分页查询短剧
// @Tags app短剧相关接口
// @Summary app端按类型分页查询短剧
// @Description type=1最新更新 2当前热播 3独家原创(筛选推荐短剧) 4随机推荐,随机推荐每日更新顺序
// @Accept json
// @Produce json
// @Param params query proto.PlayletOperateListReq true "短剧分类列表分页请求"
// @Success 200 {object} proto.PlayletOperateListResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/operate/list [get]
func OperateList(ctx *gin.Context) {
var req proto.PlayletOperateListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.OperateList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// TodayUpdate app端分页查询今日更新短剧
// @Tags app短剧相关接口
// @Summary app端分页查询今日更新短剧 --by 王鸣
// @Description 分页查询已上架短剧
// @Accept json
// @Produce json
// @Param params query proto.PlayletTodayUpdateReq true "分页查询今日更新短剧请求"
// @Success 200 {object} proto.PlayletTodayUpdateResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/today-update [get]
func TodayUpdate(ctx *gin.Context) {
var req proto.PlayletTodayUpdateReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.TodayUpdate(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// TagVideoList app端根据标签ID分页查询短剧
// @Tags app短剧相关接口
// @Summary app端根据标签ID分页查询短剧 --by 王鸣
// @Description 根据标签ID或标签slug分页查询已上架短剧;slug非空时优先按slug解析标签ID;sortType=1最新 2最热 3收藏最多
// @Accept json
// @Produce json
// @Param params query proto.PlayletTagVideoReq true "根据标签ID分页查询短剧请求"
// @Success 200 {object} proto.PlayletTagVideoResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/tag/list [get]
func TagVideoList(ctx *gin.Context) {
var req proto.PlayletTagVideoReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.TagVideoList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// GuessLikeList app端分页查询猜你喜欢短剧
// @Tags app短剧相关接口
// @Summary app端分页查询猜你喜欢短剧 --by 王鸣
// @Description 根据当前短剧同题材查询猜你喜欢,排除当前短剧
// @Accept json
// @Produce json
// @Param params query proto.PlayletGuessLikeListReq true "猜你喜欢分页请求"
// @Success 200 {object} proto.PlayletGuessLikeListResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/guess-like/list [get]
func GuessLikeList(ctx *gin.Context) {
var req proto.PlayletGuessLikeListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.GuessLikeList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// Search app端ES分页搜索短剧
// @Tags app短剧相关接口
// @Summary app端ES分页搜索短剧 --by 王鸣
// @Description 使用ES分页搜索已上架短剧,支持剧名、题材名、简介和标签名检索
// @Accept json
// @Produce json
// @Param params query proto.PlayletSearchReq true "短剧ES分页搜索请求"
// @Success 200 {object} proto.PlayletSearchResp{list=[]proto.CommonData} "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/search [get]
func Search(ctx *gin.Context) {
var req proto.PlayletSearchReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.Search(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// SearchSuggest app端短剧搜索联想
// @Tags app短剧相关接口
// @Summary app端短剧搜索联想 --by 王鸣
// @Description 搜索框下拉联想,返回短剧列表
// @Accept json
// @Produce json
// @Param params query proto.PlayletSearchSuggestReq true "短剧搜索联想请求"
// @Success 200 {object} proto.PlayletSearchSuggestResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/search/suggest [get]
func SearchSuggest(ctx *gin.Context) {
var req proto.PlayletSearchSuggestReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.SearchSuggest(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HotLike app端热搜词和猜你喜欢
// @Tags app短剧相关接口
// @Summary app端热搜词和猜你喜欢
// @Description 返回缓存的前10个热搜词,以及按收藏量最多的15部猜你喜欢短剧
// @Accept json
// @Produce json
// @Success 200 {object} proto.PlayletHotLikeResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/hot-like [get]
func HotLike(ctx *gin.Context) {
common.ServerJSON(ctx, srvdef.Success, playletser.HotLike(ctx))
}
// LikeList app端我的短剧点赞列表
// @Tags app短剧相关接口
// @Summary app端我的短剧点赞列表
// @Description 按当前用户点赞时间倒序分页返回短剧
// @Accept json
// @Produce json
// @Param params query proto.PlayletLikeListReq true "我的短剧点赞列表请求"
// @Success 200 {object} proto.PlayletLikeListResp{list=[]proto.PlayletLikeData} "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/like/list [get]
func LikeList(ctx *gin.Context) {
var req proto.PlayletLikeListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.LikeList(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// SetLike app端短剧点赞/取消点赞
// @Tags app短剧相关接口
// @Summary app端短剧点赞/取消点赞 --by 王鸣
// @Description 设置当前用户短剧点赞状态,点赞数只在状态真实变化时增减
// @Accept json
// @Produce json
// @Param param body proto.PlayletLikeSetReq true "短剧点赞设置请求"
// @Success 200 {object} proto.PlayletLikeSetResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/like/set [post]
func SetLike(ctx *gin.Context) {
var req proto.PlayletLikeSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.SetLike(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// SetCollect app端短剧收藏/取消收藏
// @Tags app短剧相关接口
// @Summary app端短剧收藏/取消收藏 --by 王鸣
// @Description 设置当前用户短剧收藏状态,收藏数只在状态真实变化时增减
// @Accept json
// @Produce json
// @Param param body proto.PlayletCollectSetReq true "短剧收藏设置请求"
// @Success 200 {object} proto.PlayletCollectSetResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/collect/set [post]
func SetCollect(ctx *gin.Context) {
var req proto.PlayletCollectSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.SetCollect(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ForwardHeat app端短剧转发增加热度
// @Tags app短剧相关接口
// @Summary app端短剧转发增加热度 --by 王鸣
// @Description 请求一次短剧热度值增加5,仅支持已上架短剧
// @Accept json
// @Produce json
// @Param param body proto.PlayletForwardHeatReq true "短剧转发加热度请求"
// @Success 200 {object} proto.PlayletForwardHeatResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/forward/heat [post]
func ForwardHeat(ctx *gin.Context) {
var req proto.PlayletForwardHeatReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.ForwardHeat(ctx, common.GetUserId(ctx), ipaddr.ResolveClientIP(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// CollectList app端我的短剧收藏列表
// @Tags app短剧相关接口
// @Summary app端我的短剧收藏列表 --by 王鸣
// @Description 按当前用户收藏时间倒序分页返回短剧收藏列表,并返回已看/未看集数和最近观看位置;watchStatus=0全部 1追剧中 2已看完
// @Accept json
// @Produce json
// @Param params query proto.PlayletCollectListReq true "我的短剧收藏列表请求"
// @Success 200 {object} proto.PlayletCollectListResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/collect/list [get]
func CollectList(ctx *gin.Context) {
var req proto.PlayletCollectListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.CollectList(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// BoughtList app端我的已购短剧列表
// @Tags app短剧相关接口
// @Summary app端我的已购短剧列表 --by 王鸣
// @Description 按当前用户最近购买时间倒序分页返回已购短剧列表,并返回已购集数、消耗金币和最近观看位置
// @Accept json
// @Produce json
// @Param params query proto.PlayletBoughtListReq true "我的已购短剧列表请求"
// @Success 200 {object} proto.PlayletBoughtListResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/bought/list [get]
func BoughtList(ctx *gin.Context) {
var req proto.PlayletBoughtListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.BoughtList(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HistoryList app端我的短剧观看历史列表
// @Tags app短剧相关接口
// @Summary app端我的短剧观看历史列表 --by 王鸣
// @Description 按当前用户最近观看时间倒序分页返回短剧观看历史;pageSize默认20、最大100
// @Accept json
// @Produce json
// @Param params query proto.PlayletHistoryListReq true "观看历史列表请求"
// @Success 200 {object} proto.PlayletHistoryListResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/history/list [get]
func HistoryList(ctx *gin.Context) {
var req proto.PlayletHistoryListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.HistoryList(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// DeleteHistory app端删除单条短剧观看历史
// @Tags app短剧相关接口
// @Summary app端删除单条短剧观看历史 --by 王鸣
// @Description 删除当前用户指定短剧的观看历史,不影响观看进度、收藏和已购记录
// @Accept json
// @Produce json
// @Param param body proto.PlayletHistoryDeleteReq true "删除单条观看历史请求"
// @Success 200 {object} proto.PlayletHistoryDeleteResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/history/delete [post]
func DeleteHistory(ctx *gin.Context) {
var req proto.PlayletHistoryDeleteReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.DeleteHistory(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ClearHistory app端清空我的短剧观看历史
// @Tags app短剧相关接口
// @Summary app端清空我的短剧观看历史 --by 王鸣
// @Description 仅清空观看历史,不影响收藏列表和观看进度
// @Accept json
// @Produce json
// @Success 200 {object} proto.PlayletHistoryClearResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/history/clear [post]
func ClearHistory(ctx *gin.Context) {
resp, err := playletser.ClearHistory(ctx, common.GetUserId(ctx))
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// SetChapterLike app端短剧剧集点赞/取消点赞
// @Tags app短剧相关接口
// @Summary app端短剧剧集点赞/取消点赞 --by 王鸣
// @Description 设置当前用户短剧剧集点赞状态,点赞数只在状态真实变化时增减
// @Accept json
// @Produce json
// @Param param body proto.PlayletChapterLikeSetReq true "短剧剧集点赞设置请求"
// @Success 200 {object} proto.PlayletChapterLikeSetResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/chapter/like/set [post]
func SetChapterLike(ctx *gin.Context) {
var req proto.PlayletChapterLikeSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.SetChapterLike(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// SetChapterCollect app端短剧剧集收藏/取消收藏
// @Tags app短剧相关接口
// @Summary app端短剧剧集收藏/取消收藏 --by 王鸣
// @Description 设置当前用户短剧剧集收藏状态,收藏数只在状态真实变化时增减
// @Accept json
// @Produce json
// @Param param body proto.PlayletChapterCollectSetReq true "短剧剧集收藏设置请求"
// @Success 200 {object} proto.PlayletChapterCollectSetResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/chapter/collect/set [post]
func SetChapterCollect(ctx *gin.Context) {
var req proto.PlayletChapterCollectSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.SetChapterCollect(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ChapterCollectList app端我的短剧剧集收藏列表
// @Tags app短剧相关接口
// @Summary app端我的短剧剧集收藏列表 --by 王鸣
// @Description 按当前用户收藏时间倒序分页返回短剧剧集收藏列表
// @Accept json
// @Produce json
// @Param params query proto.PlayletChapterCollectListReq true "我的短剧剧集收藏列表请求"
// @Success 200 {object} proto.PlayletChapterCollectListResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/chapter/collect/list [get]
func ChapterCollectList(ctx *gin.Context) {
var req proto.PlayletChapterCollectListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.ChapterCollectList(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ReportChapterWatch app端短剧剧集观看上报
// @Tags app短剧相关接口
// @Summary app端短剧剧集观看上报 --by 王鸣
// @Description 上报当前用户短剧剧集播放进度,达到已看条件时用于我的收藏未看集数计算
// @Accept json
// @Produce json
// @Param param body proto.PlayletChapterWatchReportReq true "短剧剧集观看上报请求"
// @Success 200 {object} proto.PlayletChapterWatchReportResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/chapter/watch/report [post]
func ReportChapterWatch(ctx *gin.Context) {
var req proto.PlayletChapterWatchReportReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.ReportChapterWatch(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// UnlockChapter app端使用金币逐集解锁短剧剧集
// @Tags app短剧相关接口
// @Summary app端使用金币逐集解锁短剧剧集 --by 王鸣
// @Description 仅金币付费剧集可调用;接口具备幂等性,已解锁剧集重复调用不会重复扣金币
// @Accept json
// @Produce json
// @Param param body proto.PlayletChapterUnlockReq true "短剧剧集金币解锁请求"
// @Success 200 {object} proto.PlayletChapterUnlockResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/app/playlet/chapter/unlock [post]
func UnlockChapter(ctx *gin.Context) {
var req proto.PlayletChapterUnlockReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err1 := playletser.UnlockChapter(ctx, common.GetUserId(ctx), &req)
if err1 != nil {
common.ServerJSON(ctx, err1.Code, err1.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// Detail app端根据ID查询短剧详情
// @Tags app短剧相关接口
// @Summary app端根据ID查询短剧详情 --by 王鸣
// @Description 根据短剧ID或slug查询已上架短剧详情;slug非空时优先按slug解析短剧ID
// @Produce json
// @Param params query proto.PlayletInfoReq true "短剧详情请求"
// @Success 200 {object} proto.PlayletInfoResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/detail [get]
func Detail(ctx *gin.Context) {
var req proto.PlayletInfoReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.Detail(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ChapterDetail app端根据ID查询短剧剧集详情
// @Tags app短剧相关接口
// @Summary app端根据ID查询短剧剧集详情 --by 王鸣
// @Description 根据短剧剧集ID查询播放页当前剧集详情;可传playletId或playletSlug校验剧集归属,slug非空时优先解析短剧ID
// @Produce json
// @Param params query proto.PlayletChapterInfoReq true "短剧剧集详情请求"
// @Success 200 {object} proto.PlayletChapterInfoResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/chapter/detail [get]
func ChapterDetail(ctx *gin.Context) {
var req proto.PlayletChapterInfoReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.ChapterDetail(ctx, common.GetUserId(ctx), &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ChapterList app端根据短剧ID查询剧集列表
// @Tags app短剧相关接口
// @Summary app端根据短剧ID查询剧集列表 --by 王鸣
// @Description 根据短剧ID或slug查询右侧选集列表;slug非空时优先按slug解析短剧ID
// @Produce json
// @Param params query proto.PlayletChapterListReq true "短剧剧集列表请求"
// @Success 200 {object} proto.PlayletChapterListResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/app/playlet/chapter/list [get]
func ChapterList(ctx *gin.Context) {
var req proto.PlayletChapterListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := playletser.ChapterList(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}