Files
rootandClaude Opus 5.5 7974a42301 Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-23 11:07:42 +08:00

112 lines
3.3 KiB
Go

package web_richtextcontent
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/pub/models/richtextcontentmod"
"videoweb/web/service/srv_richtextcontent"
"github.com/gin-gonic/gin"
)
// @Tags 富文本内容
// @Summary 分组分页获取富文本内容
// @Description 分组分页获取富文本内容
// @Accept json
// @Produce json
// @Param param body srv_richtextcontent.GetRichTextContentListReq true "参数列表"
// @Success 200 {object} srv_richtextcontent.GetRichTextContentResp "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/richtextcontent/list [POST]
func List(ctx *gin.Context) {
var req = &srv_richtextcontent.GetRichTextContentListReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, serr := srv_richtextcontent.GetRichTextContentList(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 richtextcontentmod.RichTextContentModel true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/richtextcontent/add [POST]
func Add(ctx *gin.Context) {
var req = &richtextcontentmod.RichTextContentModel{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, err)
return
}
serr := srv_richtextcontent.AddRichTextContent(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_richtextcontent.DelRichTextContentReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/richtextcontent/del [POST]
func Del(ctx *gin.Context) {
var req = &srv_richtextcontent.DelRichTextContentReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, err)
return
}
serr := srv_richtextcontent.DelRichTextContent(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_richtextcontent.UpdateRichTextContentReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/richtextcontent/update [POST]
func Update(ctx *gin.Context) {
var req = &srv_richtextcontent.UpdateRichTextContentReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
serr := srv_richtextcontent.UpdateRichTextContent(ctx, req.Id, &req.Param)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}