Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
package videoapi
|
||||
|
||||
import (
|
||||
"videoweb/app/api/proto"
|
||||
"videoweb/app/service/videoser"
|
||||
"videoweb/pub/common"
|
||||
"videoweb/pub/common/ipaddr"
|
||||
"videoweb/pub/common/srvdef"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// List 普通分页查询视频
|
||||
// @Tags 视频相关接口
|
||||
// @Summary 普通分页查询视频 --by 旺鸣
|
||||
// @Description 按上架时间倒序普通分页查询已上架视频
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param params query proto.VideoReq true "普通分页查询视频请求"
|
||||
// @Success 200 {object} proto.VideoResp{list=[]proto.VideoItemResp} "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/app/video/list [get]
|
||||
func List(ctx *gin.Context) {
|
||||
var req proto.VideoReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, err := videoser.VideoList(ctx, &req)
|
||||
if err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, resp)
|
||||
}
|
||||
|
||||
// Detail 查询视频详情
|
||||
// @Tags 视频相关接口
|
||||
// @Summary 查询视频详情 --by 旺鸣
|
||||
// @Description 查询已上架视频详情和该视频相关推荐列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param params query proto.VideoInfoReq true "查询视频详情请求"
|
||||
// @Success 200 {object} proto.VideoInfoResp{recommendVideos=[]proto.VideoItemResp} "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/app/video/detail [get]
|
||||
func Detail(ctx *gin.Context) {
|
||||
var req proto.VideoInfoReq
|
||||
if err := ctx.ShouldBindQuery(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
ua, _ := common.GetUA(ctx)
|
||||
resp, err := videoser.VideoInfo(ctx, &req, common.GetUserId(ctx), ipaddr.ResolveClientIP(ctx), ua.UserAgent)
|
||||
if err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, resp)
|
||||
}
|
||||
Reference in New Issue
Block a user