Initial commit: web_hghl_server

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-26 16:28:14 +08:00
co-authored by Claude Opus 4.7
commit 65fca60622
653 changed files with 135901 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
package web_playlet
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/api/proto"
"videoweb/web/service/srv_playlet"
"github.com/gin-gonic/gin"
)
// CategoryList web端短剧分类列表
// @Tags web短剧相关接口
// @Summary web端短剧分类列表 -- by 王鸣
// @Description 分页查询短剧分类
// @Accept json
// @Produce json
// @Param params query proto.PlayletCategoryListReq true "短剧分类列表请求"
// @Success 200 {object} proto.PlayletCategoryListPageResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/category/list [get]
func CategoryList(ctx *gin.Context) {
var req proto.PlayletCategoryListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.ListPlayletCategory(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// CategoryAdd web端新增短剧分类
// @Tags web短剧相关接口
// @Summary web端新增短剧分类 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletCategoryAddReq true "新增短剧分类请求"
// @Success 200 {object} proto.PlayletCategoryAddResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/category/add [post]
func CategoryAdd(ctx *gin.Context) {
var req proto.PlayletCategoryAddReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.AddPlayletCategory(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// CategoryUpdate web端更新短剧分类
// @Tags web短剧相关接口
// @Summary web端更新短剧分类 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletCategoryUpdateReq true "更新短剧分类请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/category/update [post]
func CategoryUpdate(ctx *gin.Context) {
var req proto.PlayletCategoryUpdateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.UpdatePlayletCategory(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// CategoryDel web端删除短剧分类
// @Tags web短剧相关接口
// @Summary web端删除短剧分类 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletCategoryDelReq true "删除短剧分类请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/category/del [post]
func CategoryDel(ctx *gin.Context) {
var req proto.PlayletCategoryDelReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.DelPlayletCategory(ctx, req.Id); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
+130
View File
@@ -0,0 +1,130 @@
package web_playlet
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/api/proto"
"videoweb/web/service/srv_playlet"
"github.com/gin-gonic/gin"
)
// HomeConfigList web端首页配置列表
// @Tags web短剧相关接口
// @Summary web端首页配置列表
// @Description 分页查询短剧首页配置
// @Accept json
// @Produce json
// @Param params query proto.PlayletHomeConfigListReq true "首页配置列表请求"
// @Success 200 {object} proto.PlayletHomeConfigListPageResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/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 := srv_playlet.ListPlayletHomeConfig(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HomeConfigTopicOptions web端首页专题下拉选项
// @Tags web短剧相关接口
// @Summary web端分页查询首页专题可选项
// @Description dataType 1查询短剧题材 2查询视频分类,排除其他已启用模块占用的专题,configId用于回显当前配置已选项
// @Accept json
// @Produce json
// @Param params query proto.PlayletHomeTopicOptionsReq true "首页专题选项请求"
// @Success 200 {object} proto.PlayletHomeTopicOptionsResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/home-config/topic/options [get]
func HomeConfigTopicOptions(ctx *gin.Context) {
var req proto.PlayletHomeTopicOptionsReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.ListPlayletHomeTopicOptions(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HomeConfigAdd web端新增首页配置
// @Tags web短剧相关接口
// @Summary web端新增首页配置
// @Accept json
// @Produce json
// @Param params body proto.PlayletHomeConfigAddReq true "新增首页配置请求"
// @Success 200 {object} proto.PlayletHomeConfigAddResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/home-config/add [post]
func HomeConfigAdd(ctx *gin.Context) {
var req proto.PlayletHomeConfigAddReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.AddPlayletHomeConfig(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// HomeConfigUpdate web端更新首页配置
// @Tags web短剧相关接口
// @Summary web端更新首页配置
// @Accept json
// @Produce json
// @Param params body proto.PlayletHomeConfigUpdateReq true "更新首页配置请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/home-config/update [post]
func HomeConfigUpdate(ctx *gin.Context) {
var req proto.PlayletHomeConfigUpdateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.UpdatePlayletHomeConfig(ctx, &req); err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// HomeConfigDel web端删除首页配置
// @Tags web短剧相关接口
// @Summary web端删除首页配置
// @Accept json
// @Produce json
// @Param params body proto.PlayletHomeConfigDelReq true "删除首页配置请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/home-config/del [post]
func HomeConfigDel(ctx *gin.Context) {
var req proto.PlayletHomeConfigDelReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.DelPlayletHomeConfig(ctx, &req); err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
+543
View File
@@ -0,0 +1,543 @@
package web_playlet
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/api/proto"
"videoweb/web/middleware/auth"
"videoweb/web/service/srv_mediaresource"
"videoweb/web/service/srv_playlet"
"github.com/gin-gonic/gin"
)
// List web端短剧列表
// @Tags web短剧相关接口
// @Summary web端短剧列表 -- by 王鸣
// @Description 分页查询短剧列表
// @Accept json
// @Produce json
// @Param params query proto.PlayletListReq true "短剧列表请求"
// @Success 200 {object} proto.PlayletListPageResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/list [get]
func List(ctx *gin.Context) {
var req proto.PlayletListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.ListPlaylet(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// Add web端新增短剧
// @Tags web短剧相关接口
// @Summary web端新增短剧 -- by 王鸣
// @Description 新增 playlet 集合短剧数据,支持分类、题材、标签、支付方式、推荐和 banner 配置
// @Accept json
// @Produce json
// @Param params body proto.PlayletAddReq true "新增短剧请求"
// @Success 200 {object} proto.PlayletAddResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/add [post]
func Add(ctx *gin.Context) {
var req proto.PlayletAddReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.AddPlaylet(ctx, &req, auth.GetAccount(ctx))
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// Update web端编辑短剧
// @Tags web短剧相关接口
// @Summary web端编辑短剧 -- by 王鸣
// @Description 按短剧ID编辑 playlet 集合短剧数据,只更新请求中传入的字段
// @Accept json
// @Produce json
// @Param params body proto.PlayletUpdateReq true "编辑短剧请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/update [post]
func Update(ctx *gin.Context) {
var req proto.PlayletUpdateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.UpdatePlaylet(ctx, &req, auth.GetAccount(ctx)); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// Del 删除短剧及其关联数据
// @Tags web短剧相关接口
// @Summary web端单/批量删除短剧
// @Description 删除短剧、剧集及关联用户数据,上架和下架短剧均可删除
// @Accept json
// @Produce json
// @Param params body proto.PlayletDelReq true "删除短剧请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/del [post]
func Del(ctx *gin.Context) {
var req proto.PlayletDelReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.DelPlaylet(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetStatus web端单/批量设置短剧上下架
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧上下架 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 status 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletStatusSetReq true "单/批量设置短剧上下架请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/status/set [post]
func SetStatus(ctx *gin.Context) {
var req proto.PlayletStatusSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletStatus(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetRecommend web端单/批量设置短剧是否推荐
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧是否推荐 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 isRecommend 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletRecommendSetReq true "单/批量设置短剧是否推荐请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/recommend/set [post]
func SetRecommend(ctx *gin.Context) {
var req proto.PlayletRecommendSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletRecommend(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetFeatured web端单/批量设置短剧是否爆剧
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧是否爆剧 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 isFeatured 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletFeaturedSetReq true "单/批量设置短剧是否爆剧请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/featured/set [post]
func SetFeatured(ctx *gin.Context) {
var req proto.PlayletFeaturedSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletFeatured(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetBanner web端单/批量设置短剧是否显示在首页banner
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧是否显示在首页banner -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 showOnBanner 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletBannerSetReq true "单/批量设置短剧是否显示在首页banner请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/banner/set [post]
func SetBanner(ctx *gin.Context) {
var req proto.PlayletBannerSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletBanner(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetTheme web端单/批量设置短剧题材
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧题材 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 themeIds 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletThemeSetReq true "单/批量设置短剧题材请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/theme/set [post]
func SetTheme(ctx *gin.Context) {
var req proto.PlayletThemeSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletTheme(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetTag web端单/批量设置短剧标签
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧标签 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 tagIds 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletTagSetReq true "单/批量设置短剧标签请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/tag/set [post]
func SetTag(ctx *gin.Context) {
var req proto.PlayletTagSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletTag(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetCategory web端单/批量设置短剧分类
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧分类 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 categoryIds 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletCategorySetReq true "单/批量设置短剧分类请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/category/set [post]
func SetCategory(ctx *gin.Context) {
var req proto.PlayletCategorySetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletCategory(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetVirtualLike web端单/批量设置短剧虚拟点赞数
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧虚拟点赞数 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 virtualCountLike 字段,每条短剧从最小值和最大值之间随机取不重复数值入库
// @Accept json
// @Produce json
// @Param params body proto.PlayletVirtualLikeSetReq true "单/批量随机设置短剧虚拟点赞数请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/like/virtual/set [post]
func SetVirtualLike(ctx *gin.Context) {
var req proto.PlayletVirtualLikeSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletVirtualLike(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetVirtualBrowse web端单/批量设置短剧虚拟观看数
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧虚拟观看数 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletVirtualBrowseSetReq true "设置短剧虚拟观看数请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/browse/virtual/set [post]
func SetVirtualBrowse(ctx *gin.Context) {
var req proto.PlayletVirtualBrowseSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletVirtualBrowse(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetVirtualHeat web端单/批量设置短剧虚拟热度
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧虚拟热度 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletVirtualHeatSetReq true "设置短剧虚拟热度请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/heat/virtual/set [post]
func SetVirtualHeat(ctx *gin.Context) {
var req proto.PlayletVirtualHeatSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletVirtualHeat(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// SetPayType web端单/批量设置短剧默认支付方式
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧默认支付方式 -- by 王鸣
// @Description 根据短剧ID集合批量更新 playlet 集合 payType/singleCoins 字段
// @Accept json
// @Produce json
// @Param params body proto.PlayletPayTypeSetReq true "单/批量设置短剧默认支付方式请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/pay-type/set [post]
func SetPayType(ctx *gin.Context) {
var req proto.PlayletPayTypeSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletPayType(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// ResetWatermark web端按短剧ID批量重置剧集水印
// @Tags web短剧相关接口
// @Summary web端按短剧ID批量重置剧集水印 -- by 王鸣
// @Description 根据短剧ID集合重置剧集水印状态,保留已有水印地址以便换水印期间继续观看
// @Accept json
// @Produce json
// @Param params body proto.PlayletWatermarkResetReq true "批量重置短剧水印请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/watermark/reset [post]
func ResetWatermark(ctx *gin.Context) {
var req proto.PlayletWatermarkResetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.ResetPlayletWatermark(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// ChapterList web端短剧剧集列表
// @Tags web短剧相关接口
// @Summary web端短剧剧集列表 -- by 王鸣
// @Description 分页查询 playlet_chapter 集合短剧剧集数据,默认按集数升序返回
// @Accept json
// @Produce json
// @Param params query proto.PlayletChapterListReq true "短剧剧集列表请求"
// @Success 200 {object} proto.PlayletChapterListPageResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/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 := srv_playlet.ListPlayletChapter(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ChapterAdd web端新增短剧剧集
// @Tags web短剧相关接口
// @Summary web端新增短剧剧集 -- by 王鸣
// @Description 新增 playlet_chapter 集合短剧剧集数据
// @Accept json
// @Produce json
// @Param params body proto.PlayletChapterAddReq true "新增短剧剧集请求"
// @Success 200 {object} proto.PlayletChapterAddResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/chapter/add [post]
func ChapterAdd(ctx *gin.Context) {
var req proto.PlayletChapterAddReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.AddPlayletChapter(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ChapterDel web端单/批量删除短剧剧集
// @Tags web短剧相关接口
// @Summary web端单/批量删除短剧剧集
// @Description 根据剧集ID集合删除 playlet_chapter 记录,仅原创短剧支持删除
// @Accept json
// @Produce json
// @Param params body proto.PlayletChapterDelReq true "单/批量删除短剧剧集请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/chapter/del [post]
func ChapterDel(ctx *gin.Context) {
var req proto.PlayletChapterDelReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.DelPlayletChapter(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// ChapterSync web端手动同步短剧剧集
// @Tags web短剧相关接口
// @Summary web端手动单/批量同步短剧剧集
// @Description 根据短剧ID集合从媒资中心同步新增剧集,playletIds传1个表示单条同步,传多个表示批量同步,允许已完结短剧补集或修正状态
// @Accept json
// @Produce json
// @Param params body proto.PlayletChapterSyncReq true "手动单/批量同步短剧剧集请求"
// @Success 200 {object} proto.PlayletChapterSyncResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/chapter/sync [post]
func ChapterSync(ctx *gin.Context) {
var req proto.PlayletChapterSyncReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_mediaresource.SyncPlayletChapters(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ChapterUpdate web端编辑短剧剧集
// @Tags web短剧相关接口
// @Summary web端编辑短剧剧集 -- by 王鸣
// @Description 按剧集ID编辑 playlet_chapter 集合短剧剧集数据,只更新请求中传入的字段
// @Accept json
// @Produce json
// @Param params body proto.PlayletChapterUpdateReq true "编辑短剧剧集请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/chapter/update [post]
func ChapterUpdate(ctx *gin.Context) {
var req proto.PlayletChapterUpdateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.UpdatePlayletChapter(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// ChapterSetPayType web端单/批量设置短剧剧集支付方式
// @Tags web短剧相关接口
// @Summary web端单/批量设置短剧剧集支付方式 -- by 王鸣
// @Description 根据剧集ID集合批量更新 playlet_chapter 集合 payType 和 singleCoins 字段,传1个ID表示单条设置,传多个ID表示批量设置
// @Accept json
// @Produce json
// @Param params body proto.PlayletChapterPayTypeSetReq true "单/批量设置短剧剧集支付方式请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/chapter/pay-type/set [post]
func ChapterSetPayType(ctx *gin.Context) {
var req proto.PlayletChapterPayTypeSetReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.SetPlayletChapterPayType(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
+105
View File
@@ -0,0 +1,105 @@
package web_playlet
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/api/proto"
"videoweb/web/service/srv_playlet"
"github.com/gin-gonic/gin"
)
// TagList web端标签列表
// @Tags web短剧相关接口
// @Summary web端标签列表 -- by 王鸣
// @Description 分页查询短剧标签
// @Accept json
// @Produce json
// @Param params query proto.PlayletTagListReq true "标签列表请求"
// @Success 200 {object} proto.PlayletTagListPageResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/tag/list [get]
func TagList(ctx *gin.Context) {
var req proto.PlayletTagListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.ListPlayletTag(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// TagAdd web端新增标签
// @Tags web短剧相关接口
// @Summary web端新增标签 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletTagAddReq true "新增标签请求"
// @Success 200 {object} proto.PlayletTagAddResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/tag/add [post]
func TagAdd(ctx *gin.Context) {
var req proto.PlayletTagAddReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.AddPlayletTag(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// TagUpdate web端更新标签
// @Tags web短剧相关接口
// @Summary web端更新标签 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletTagUpdateReq true "更新标签请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/tag/update [post]
func TagUpdate(ctx *gin.Context) {
var req proto.PlayletTagUpdateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.UpdatePlayletTag(ctx, &req); err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// TagDel web端删除标签
// @Tags web短剧相关接口
// @Summary web端删除标签 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletTagDelReq true "删除标签请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/tag/del [post]
func TagDel(ctx *gin.Context) {
var req proto.PlayletTagDelReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.DelPlayletTag(ctx, req.Id); err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
+105
View File
@@ -0,0 +1,105 @@
package web_playlet
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/api/proto"
"videoweb/web/service/srv_playlet"
"github.com/gin-gonic/gin"
)
// ThemeList web端题材列表
// @Tags web短剧相关接口
// @Summary web端题材列表 -- by 王鸣
// @Description 分页查询短剧题材
// @Accept json
// @Produce json
// @Param params query proto.PlayletThemeListReq true "题材列表请求"
// @Success 200 {object} proto.PlayletThemeListPageResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/theme/list [get]
func ThemeList(ctx *gin.Context) {
var req proto.PlayletThemeListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.ListPlayletTheme(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ThemeAdd web端新增题材
// @Tags web短剧相关接口
// @Summary web端新增题材 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletThemeAddReq true "新增题材请求"
// @Success 200 {object} proto.PlayletThemeAddResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/theme/add [post]
func ThemeAdd(ctx *gin.Context) {
var req proto.PlayletThemeAddReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_playlet.AddPlayletTheme(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// ThemeUpdate web端更新题材
// @Tags web短剧相关接口
// @Summary web端更新题材 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletThemeUpdateReq true "更新题材请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/theme/update [post]
func ThemeUpdate(ctx *gin.Context) {
var req proto.PlayletThemeUpdateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.UpdatePlayletTheme(ctx, &req); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// ThemeDel web端删除题材
// @Tags web短剧相关接口
// @Summary web端删除题材 -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.PlayletThemeDelReq true "删除题材请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/playlet/theme/del [post]
func ThemeDel(ctx *gin.Context) {
var req proto.PlayletThemeDelReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_playlet.DelPlayletTheme(ctx, req.Id); err != nil {
common.ServerJSON(ctx, err, err.GetMsg())
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}