蛋蛋星球-客户端
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.
 
 
 
 
 
 

46 lines
1.4 KiB

  1. package hdl
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md"
  6. "applet/app/svc"
  7. "applet/app/utils"
  8. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  9. "fmt"
  10. "github.com/gin-gonic/gin"
  11. )
  12. // Config
  13. // @Summary 基本配置
  14. // @Tags 基本配置
  15. // @Description 基本配置
  16. // @Accept json
  17. // @Produce json
  18. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  19. // @Success 200 {object} md.ConfigResp "具体数据"
  20. // @Failure 400 {object} md.Response "具体错误"
  21. // @Router /api/v1/config [get]
  22. func Config(c *gin.Context) {
  23. res := md.ConfigResp{}
  24. eg := db.Db
  25. NewArticleDb := implement.NewArticleDb(eg)
  26. article, _ := NewArticleDb.ArticleByTypeId("1")
  27. if article != nil {
  28. res.Title = article.Title
  29. res.Content = article.Content
  30. }
  31. userArticle, _ := NewArticleDb.ArticleByTypeId("2")
  32. if userArticle != nil {
  33. res.UserTitle = userArticle.Title
  34. res.UserUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id))
  35. }
  36. privacyArticle, _ := NewArticleDb.ArticleByTypeId("3")
  37. if privacyArticle != nil {
  38. res.PrivacyTitle = privacyArticle.Title
  39. res.PrivacyUrl = fmt.Sprintf("%s%s?article_id=%s", svc.GetSysCfgStr("wap_host"), "/api/v1/article/html", utils.AnyToString(userArticle.Id))
  40. }
  41. e.OutSuc(c, res, nil)
  42. return
  43. }