init: web_hgdjc_server
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
package web_video
|
||||
|
||||
import (
|
||||
"videoweb/pub/common"
|
||||
"videoweb/pub/common/srvdef"
|
||||
"videoweb/pub/models/videocreatermod"
|
||||
"videoweb/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, "")
|
||||
}
|
||||
Reference in New Issue
Block a user