Files
web_huakui_server/web/api/web_video/creater.go
T
rootandClaude Opus 4.7 85c0071fd8 feat: 从黄果 NET hgdjnet-server 9bfbafe 导入 HKDJ 官网后端
来源:hgdjnet-server 9bfbafe10d417deea959bd53117bc88a10e60a83
项目身份 HKDJ / JHA-216,独立官网仓库,Jenkins 守卫键 hkdjnet
测试目录 /server/hkdj_net,App/Web API 30331/30332

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-10-16 11:20:04 +08:00

112 lines
3.3 KiB
Go

package web_video
import (
"hkdj-web-server/pub/common"
"hkdj-web-server/pub/common/srvdef"
"hkdj-web-server/pub/models/videocreatermod"
"hkdj-web-server/web/service/srv_videocreater"
"github.com/gin-gonic/gin"
)
// @Tags 视频作者
// @Summary 分组分页获取视频作者
// @Description 分组分页获取视频作者
// @Accept json
// @Produce json
// @Param param body srv_videocreater.VideoCreaterReq true "参数列表"
// @Success 200 {object} srv_videocreater.VideoCreaterResp "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/videocreater/list [POST]
func GetVideoCreater(ctx *gin.Context) {
var req = &srv_videocreater.VideoCreaterReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, serr := srv_videocreater.GetVideoCreaters(ctx, req)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// @Tags 视频作者
// @Summary 添加一个视频作者
// @Description 添加一个视频作者
// @Accept json
// @Produce json
// @Param param body videocreatermod.VideoCreaterInfo true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/videocreater/add [POST]
func AddOneVideoCreater(ctx *gin.Context) {
var req = &videocreatermod.VideoCreaterInfo{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, err)
return
}
serr := srv_videocreater.AddVideoCreater(ctx, req)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// @Tags 视频作者
// @Summary 删除一个视频作者
// @Description 删除一个视频作者
// @Accept json
// @Produce json
// @Param param body srv_videocreater.VideoCreaterDelReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/videocreater/del [POST]
func DelOneVideoCreater(ctx *gin.Context) {
var req = &srv_videocreater.VideoCreaterDelReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, err)
return
}
serr := srv_videocreater.DelVideoCreater(ctx, req.Id)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// @Tags 视频作者
// @Summary 更新一个视频作者
// @Description 更新一个视频作者
// @Accept json
// @Produce json
// @Param param body srv_videocreater.VideoCreaterUpdateReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/videocreater/update [POST]
func UpdateOneVideoCreater(ctx *gin.Context) {
var req = &srv_videocreater.VideoCreaterUpdateReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
serr := srv_videocreater.UpdateVideoCreater(ctx, req.Id, req.Param)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}