Initial commit

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 10:47:18 +08:00
co-authored by Claude Opus 4.7
commit 79ac89b458
708 changed files with 151634 additions and 0 deletions
+106
View File
@@ -0,0 +1,106 @@
package web_homebanner
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/api/proto"
"videoweb/web/middleware/auth"
"videoweb/web/service/srv_homebanner"
"github.com/gin-gonic/gin"
)
// List 首页banner列表
// @Tags web首页banner相关接口
// @Summary 首页banner列表 -- by 王鸣
// @Description 分页查询首页banner配置
// @Accept json
// @Produce json
// @Param params query proto.HomeBannerListReq true "首页banner列表请求"
// @Success 200 {object} proto.HomeBannerListPageResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/home/banner/list [get]
func List(ctx *gin.Context) {
var req proto.HomeBannerListReq
if err := ctx.ShouldBindQuery(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_homebanner.ListHomeBanner(ctx, &req)
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// Add 新增首页banner
// @Tags web首页banner相关接口
// @Summary 新增首页banner -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.HomeBannerAddReq true "新增首页banner请求"
// @Success 200 {object} proto.HomeBannerAddResp "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/home/banner/add [post]
func Add(ctx *gin.Context) {
var req proto.HomeBannerAddReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, err := srv_homebanner.AddHomeBanner(ctx, &req, auth.GetAccount(ctx))
if err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// Update 更新首页banner
// @Tags web首页banner相关接口
// @Summary 更新首页banner -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.HomeBannerUpdateReq true "更新首页banner请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/home/banner/update [post]
func Update(ctx *gin.Context) {
var req proto.HomeBannerUpdateReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_homebanner.UpdateHomeBanner(ctx, &req, auth.GetAccount(ctx)); err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// Del 删除首页banner
// @Tags web首页banner相关接口
// @Summary 删除首页banner -- by 王鸣
// @Accept json
// @Produce json
// @Param params body proto.HomeBannerDelReq true "删除首页banner请求"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/web/home/banner/del [post]
func Del(ctx *gin.Context) {
var req proto.HomeBannerDelReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if err := srv_homebanner.DelHomeBanner(ctx, &req); err != nil {
common.ServerJSON(ctx, err.Code, err.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}