init: web_hgdjc_server
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package web_playlet
|
||||
|
||||
import (
|
||||
"videoweb/pub/common"
|
||||
"videoweb/pub/common/srvdef"
|
||||
"videoweb/web/api/proto"
|
||||
"videoweb/web/service/srv_playlet"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// TopicGroupList 查询专题区块
|
||||
// @Tags web短剧相关接口
|
||||
// @Summary 查询专题区块
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param params query proto.PlayletTopicGroupListReq true "筛选条件"
|
||||
// @Success 200 {object} proto.PlayletTopicGroupListResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/playlet/topic-group/list [get]
|
||||
func TopicGroupList(ctx *gin.Context) {
|
||||
var req proto.PlayletTopicGroupListReq
|
||||
if ctx.ShouldBindQuery(&req) != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, err := srv_playlet.ListPlayletTopicGroups(ctx, &req)
|
||||
if err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, resp)
|
||||
}
|
||||
|
||||
// TopicGroupAdd 新增专题区块
|
||||
// @Tags web短剧相关接口
|
||||
// @Summary 新增专题区块
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param params body proto.PlayletTopicGroupAddReq true "区块数据"
|
||||
// @Success 200 {object} proto.PlayletTopicGroupAddResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/playlet/topic-group/add [post]
|
||||
func TopicGroupAdd(ctx *gin.Context) {
|
||||
var req proto.PlayletTopicGroupAddReq
|
||||
if ctx.ShouldBindJSON(&req) != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, err := srv_playlet.AddPlayletTopicGroup(ctx, &req)
|
||||
if err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, resp)
|
||||
}
|
||||
|
||||
// TopicGroupUpdate 更新专题区块
|
||||
// @Tags web短剧相关接口
|
||||
// @Summary 更新专题区块
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param params body proto.PlayletTopicGroupUpdateReq true "区块数据"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/playlet/topic-group/update [post]
|
||||
func TopicGroupUpdate(ctx *gin.Context) {
|
||||
var req proto.PlayletTopicGroupUpdateReq
|
||||
if ctx.ShouldBindJSON(&req) != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
if err := srv_playlet.UpdatePlayletTopicGroup(ctx, &req); err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, "")
|
||||
}
|
||||
|
||||
// TopicGroupDel 删除专题区块
|
||||
// @Tags web短剧相关接口
|
||||
// @Summary 删除专题区块
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param params body proto.PlayletTopicGroupDeleteReq true "区块ID"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/playlet/topic-group/del [post]
|
||||
func TopicGroupDel(ctx *gin.Context) {
|
||||
var req proto.PlayletTopicGroupDeleteReq
|
||||
if ctx.ShouldBindJSON(&req) != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
if err := srv_playlet.DeletePlayletTopicGroup(ctx, req.Id); err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, "")
|
||||
}
|
||||
Reference in New Issue
Block a user