Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
84 lines
2.3 KiB
Go
84 lines
2.3 KiB
Go
package web_ipblack
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"videoweb/pub/common"
|
|
"videoweb/pub/common/srvdef"
|
|
"videoweb/web/service/srv_ipblack"
|
|
)
|
|
|
|
// IpBlackList
|
|
// @Tags IP黑名单
|
|
// @Summary IP黑名单-列表
|
|
// @Description IP黑名单-列表
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body srv_ipblack.GetIPBlackListReq true "参数列表"
|
|
// @Success 200 {object} srv_ipblack.GetIPBlackListResp "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/web/ipblack/list [POST]
|
|
func IpBlackList(c *gin.Context) {
|
|
var req srv_ipblack.GetIPBlackListReq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
resp, err := srv_ipblack.GetIpBlackList(c, &req)
|
|
if err != nil {
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, resp)
|
|
}
|
|
|
|
// IpBlackAdd
|
|
// @Tags IP黑名单
|
|
// @Summary IP黑名单-增加
|
|
// @Description IP黑名单-增加
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body srv_ipblack.AddIPBlackListReq true "参数列表"
|
|
// @Success 200 {object} string "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/web/ipblack/add [POST]
|
|
func IpBlackAdd(c *gin.Context) {
|
|
var req srv_ipblack.AddIPBlackListReq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
err := srv_ipblack.AddIpBlack(c, &req)
|
|
if err != nil {
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, "")
|
|
}
|
|
|
|
// IpBlackDel
|
|
// @Tags IP黑名单
|
|
// @Summary IP黑名单-删除
|
|
// @Description IP黑名单-删除
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body srv_ipblack.DelIpBlackListReq true "参数列表"
|
|
// @Success 200 {object} string "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/web/ipblack/del [POST]
|
|
func IpBlackDel(c *gin.Context) {
|
|
var req srv_ipblack.DelIpBlackListReq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
err := srv_ipblack.DelIpBlack(c, &req)
|
|
if err != nil {
|
|
common.ServerJSON(c, err.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, "")
|
|
}
|