37 lines
944 B
Go
37 lines
944 B
Go
package richtextapi
|
|
|
|
import (
|
|
"videoweb/app/service/richtextser"
|
|
"videoweb/pub/common"
|
|
"videoweb/pub/common/srvdef"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type getByTitleReq struct {
|
|
Title string `form:"title" binding:"required"`
|
|
}
|
|
|
|
// GetByTitle 按 title 查询富文本
|
|
// @Tags 富文本
|
|
// @Summary 按 title 查询富文本
|
|
// @Description 从缓存中查询启用状态的富文本信息
|
|
// @Produce json
|
|
// @Param title query string true "富文本内部标题"
|
|
// @Success 200 {object} proto.RichTextInfo "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/app/richtext [get]
|
|
func GetByTitle(ctx *gin.Context) {
|
|
var req getByTitleReq
|
|
if err := ctx.ShouldBindQuery(&req); err != nil {
|
|
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
|
return
|
|
}
|
|
data, serr := richtextser.GetByTitle(req.Title)
|
|
if serr != nil {
|
|
common.ServerJSON(ctx, serr.Code, serr.Tips)
|
|
return
|
|
}
|
|
common.ServerJSON(ctx, srvdef.Success, data)
|
|
}
|