|
- package hdl
-
- import (
- "applet/app/db"
- "applet/app/e"
- "applet/app/md"
- "applet/app/svc"
- "applet/app/utils"
- "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
- "fmt"
- "github.com/gin-gonic/gin"
- )
-
- // Config
- // @Summary 基本配置
- // @Tags 基本配置
- // @Description 基本配置
- // @Accept json
- // @Produce json
- // @param Authorization header string true "验证参数Bearer和token空格拼接"
- // @Success 200 {object} md.ConfigResp "具体数据"
- // @Failure 400 {object} md.Response "具体错误"
- // @Router /api/v1/config [get]
- func Config(c *gin.Context) {
- res := md.ConfigResp{}
- eg := db.Db
- NewArticleDb := implement.NewArticleDb(eg)
- article, _ := NewArticleDb.ArticleByTypeId("1")
- if article != nil {
- res.Title = article.Title
- res.Content = article.Content
- }
- userArticle, _ := NewArticleDb.ArticleByTypeId("2")
- if userArticle != nil {
- res.UserTitle = userArticle.Title
- res.UserUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id))
- }
- privacyArticle, _ := NewArticleDb.ArticleByTypeId("3")
- if privacyArticle != nil {
- res.PrivacyTitle = privacyArticle.Title
- res.PrivacyUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id))
- }
- e.OutSuc(c, res, nil)
- return
- }
|