来源: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>
112 lines
3.4 KiB
Go
112 lines
3.4 KiB
Go
package web_richtextcontent
|
|
|
|
import (
|
|
"hkdj-web-server/pub/common"
|
|
"hkdj-web-server/pub/common/srvdef"
|
|
"hkdj-web-server/pub/models/richtextcontentmod"
|
|
"hkdj-web-server/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, "")
|
|
}
|