蛋蛋星球 后台端
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

86 líneas
2.7 KiB

  1. package website
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md"
  6. "applet/app/svc"
  7. "applet/app/utils"
  8. "applet/app/utils/cache"
  9. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  10. svc2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc"
  11. "github.com/gin-gonic/gin"
  12. )
  13. // WebsiteInfo
  14. // @Summary 官网-基本信息
  15. // @Tags 官网
  16. // @Description 官网-基本信息
  17. // @Accept json
  18. // @Produce json
  19. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  20. // @Success 200 {object} md.WebsiteInfoResp "具体数据"
  21. // @Failure 400 {object} md.Response "具体错误"
  22. // @Router /api/website/info [get]
  23. func WebsiteInfo(c *gin.Context) {
  24. res := md.WebsiteInfoResp{
  25. SeoTitle: svc.GetSysCfgStr("seo_title"),
  26. SeoLogo: svc.GetOssUrl(svc.GetSysCfgStr("seo_logo")),
  27. WebLogo: svc.GetOssUrl(svc.GetSysCfgStr("web_logo")),
  28. AndroidDownUrl: svc.GetSysCfgStr("android_down_url"),
  29. IosDownUrl: svc.GetSysCfgStr("ios_down_url"),
  30. }
  31. e.OutSuc(c, res, nil)
  32. return
  33. }
  34. // GetModuleSetting
  35. // @Summary 页面样式
  36. // @Tags 官网
  37. // @Description 页面样式
  38. // @Accept json
  39. // @Produce json
  40. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  41. // @Param mod_name_value query string true "页面名称类型值(15:官网 联系我们)"
  42. // @Success 200 {object} md.GetModuleSettingResp "具体数据"
  43. // @Failure 400 {object} md.Response "具体错误"
  44. // @Router /api/v1/website/getModuleSetting [GET]
  45. func GetModuleSetting(c *gin.Context) {
  46. modName := c.Query("mod_name_value")
  47. modNameMap := map[string]string{
  48. "15": "website_about_us",
  49. }
  50. val, ok := modNameMap[modName]
  51. if !ok {
  52. e.OutErr(c, e.ERR_BAD_REQUEST, nil)
  53. return
  54. }
  55. moduleStyleDb := implement.NewModuleStyleDb(db.Db)
  56. moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
  57. "key": "mod_name",
  58. "value": val,
  59. })
  60. if err != nil {
  61. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  62. return
  63. }
  64. if moduleStyle == nil {
  65. e.OutErr(c, e.ERR_NO_DATA, nil)
  66. return
  67. }
  68. var dataMap interface{}
  69. redisConn := cache.GetPool().Get()
  70. scheme, domain := svc2.ImageBucket(db.Db, redisConn)
  71. moduleStyle.Data = svc2.ImageFormatWithBucketForDataInfo(scheme, domain, moduleStyle.Data)
  72. utils.Unserialize([]byte(moduleStyle.Data), &dataMap)
  73. resp := md.GetModuleSettingResp{
  74. ModName: moduleStyle.ModName,
  75. Position: moduleStyle.Position,
  76. SkipIdentifier: moduleStyle.SkipIdentifier,
  77. Title: moduleStyle.Title,
  78. Subtitle: moduleStyle.Subtitle,
  79. Data: dataMap,
  80. }
  81. e.OutSuc(c, resp, nil)
  82. }