Files
2026-10-26 16:28:14 +08:00

110 lines
3.0 KiB
Go

package web_hotnav
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/service/srv_hotnav"
"github.com/gin-gonic/gin"
)
// HotNavList
// @Tags 热门导航配置
// @Summary 热门导航配置-列表
// @Description 热门导航配置-列表
// @Accept json
// @Produce json
// @Param param body srv_hotnav.GetHotNavListReq true "参数列表"
// @Success 200 {object} srv_hotnav.GetHotNavListResp "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/hotnav/list [post]
func HotNavList(c *gin.Context) {
var req srv_hotnav.GetHotNavListReq
if err := c.ShouldBind(&req); err != nil {
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
return
}
resp, serr := srv_hotnav.GetHotNavList(c, &req)
if serr != nil {
common.ServerJSON(c, serr.Code, "")
return
}
common.ServerJSON(c, srvdef.Success, resp)
}
// HotNavAdd
// @Tags 热门导航配置
// @Summary 热门导航配置-增加
// @Description 热门导航配置-增加
// @Accept json
// @Produce json
// @Param param body srv_hotnav.AddHotNavReq true "参数列表"
// @Success 200 {object} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/hotnav/add [post]
func HotNavAdd(c *gin.Context) {
var req srv_hotnav.AddHotNavReq
if err := c.ShouldBind(&req); err != nil {
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
return
}
serr := srv_hotnav.AddHotNav(c, &req)
if serr != nil {
common.ServerJSON(c, serr.Code, "")
return
}
common.ServerJSON(c, srvdef.Success, "")
}
// HotNavDel
// @Tags 热门导航配置
// @Summary 热门导航配置-删除
// @Description 热门导航配置-删除
// @Accept json
// @Produce json
// @Param param body srv_hotnav.DelHotNavReq true "参数列表"
// @Success 200 {object} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/hotnav/del [post]
func HotNavDel(c *gin.Context) {
var req srv_hotnav.DelHotNavReq
if err := c.ShouldBind(&req); err != nil {
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
return
}
serr := srv_hotnav.DelHotNav(c, &req)
if serr != nil {
common.ServerJSON(c, serr.Code, "")
return
}
common.ServerJSON(c, srvdef.Success, "")
}
// HotNavUpdate
// @Tags 热门导航配置
// @Summary 热门导航配置-更新
// @Description 热门导航配置-更新
// @Accept json
// @Produce json
// @Param param body srv_hotnav.UpdateHotNavReq true "参数列表"
// @Success 200 {object} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/hotnav/update [post]
func HotNavUpdate(c *gin.Context) {
var req srv_hotnav.UpdateHotNavReq
if err := c.ShouldBind(&req); err != nil {
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
return
}
serr := srv_hotnav.UpdateHotNav(c, &req)
if serr != nil {
common.ServerJSON(c, serr.Code, "")
return
}
common.ServerJSON(c, srvdef.Success, "")
}