You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
782 B

package internal
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/imdotdev/im.dev/server/pkg/common"
"github.com/imdotdev/im.dev/server/pkg/config"
)
type UIConfig struct {
4 years ago
Posts *PostsConfig `json:"posts"`
}
4 years ago
type PostsConfig struct {
4 years ago
TitleMaxLen int `json:"titleMaxLen"`
4 years ago
BriefMaxLen int `json:"briefMaxLen"`
WritingEnabled bool `json:"writingEnabled"`
4 years ago
MaxTags int `json:"maxTags"`
}
4 years ago
// 在后台页面配置存储到mysql中
func GetUIConfig(c *gin.Context) {
conf := &UIConfig{
4 years ago
Posts: &PostsConfig{
4 years ago
TitleMaxLen: config.Data.Posts.TitleMaxLen,
4 years ago
BriefMaxLen: config.Data.Posts.BriefMaxLen,
WritingEnabled: config.Data.Posts.WritingEnabled,
4 years ago
MaxTags: 2,
},
}
c.JSON(http.StatusOK, common.RespSuccess(conf))
}