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
+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, "")
}