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/videotopicmod"
|
||||
"videoweb/web/service/srv_videotopic"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 视频专题
|
||||
// @Summary 分组分页获取视频专题
|
||||
// @Description 分组分页获取视频专题
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_videotopic.VideoTopicReq true "参数列表"
|
||||
// @Success 200 {object} srv_videotopic.VideoTopicResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/videotopic/list [POST]
|
||||
func GetVideoTopic(ctx *gin.Context) {
|
||||
var req = &srv_videotopic.VideoTopicReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, serr := srv_videotopic.GetVideoTopics(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 videotopicmod.VideoTopicModel true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/videotopic/add [POST]
|
||||
func AddOneVideoTopic(ctx *gin.Context) {
|
||||
var req = &videotopicmod.VideoTopicModel{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
serr := srv_videotopic.AddVideoTopic(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_videotopic.VideoTopicDelReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/videotopic/del [POST]
|
||||
func DelOneVideoTopic(ctx *gin.Context) {
|
||||
var req = &srv_videotopic.VideoTopicDelReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, err)
|
||||
return
|
||||
}
|
||||
serr := srv_videotopic.DelVideoTopic(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_videotopic.VideoTopicUpdateReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/videotopic/update [POST]
|
||||
func UpdateOneVideoTopic(ctx *gin.Context) {
|
||||
var req = &srv_videotopic.VideoTopicUpdateReq{}
|
||||
if err := ctx.ShouldBind(req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
|
||||
serr := srv_videotopic.UpdateVideoTopic(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