蛋蛋星球 后台端
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

hdl_website.go 4.0 KiB

vor 1 Woche
vor 1 Woche
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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/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. }
  83. // Certificate
  84. // @Summary 证书查询
  85. // @Tags 官网
  86. // @Description 证书查询
  87. // @Accept json
  88. // @Produce json
  89. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  90. // @Param req body md.CertificateReq true "(分页信息必填)"
  91. // @Success 200 {object} md.CertificateResp "具体数据"
  92. // @Failure 400 {object} md.Response "具体错误"
  93. // @Router /api/website/certificate [POST]
  94. func Certificate(c *gin.Context) {
  95. var req md.CertificateReq
  96. err := c.ShouldBindJSON(&req)
  97. if err != nil {
  98. err = svc.HandleValidateErr(err)
  99. err1 := err.(e.E)
  100. e.OutErr(c, err1.Code, err1.Error())
  101. return
  102. }
  103. NewUserCertificateDb := implement.NewUserCertificateDb(db.Db)
  104. data, _ := NewUserCertificateDb.GetUserCertificateByNo(req.No)
  105. if data == nil {
  106. e.OutErr(c, 400, e.NewErr(400, "查询不到该证书"))
  107. return
  108. }
  109. resp := md.CertificateResp{
  110. No: data.No,
  111. Name: data.Name,
  112. StartTime: data.StartTime,
  113. EndTime: data.EndTime,
  114. Logo: svc.GetOssUrl(md.Certificate.Logo),
  115. BgImg: svc.GetOssUrl(md.Certificate.BgImg),
  116. NameIcon: svc.GetOssUrl(md.Certificate.NameIcon),
  117. Medal: svc.GetOssUrl(md.Certificate.Medal),
  118. Seal: svc.GetOssUrl(md.Certificate.Seal),
  119. }
  120. e.OutSuc(c, resp, nil)
  121. return
  122. }