蛋蛋星球 后台端
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.

hdl_website.go 3.9 KiB

2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  9. "github.com/gin-gonic/gin"
  10. )
  11. // WebsiteInfo
  12. // @Summary 官网-基本信息
  13. // @Tags 官网
  14. // @Description 官网-基本信息
  15. // @Accept json
  16. // @Produce json
  17. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  18. // @Success 200 {object} md.WebsiteInfoResp "具体数据"
  19. // @Failure 400 {object} md.Response "具体错误"
  20. // @Router /api/website/info [get]
  21. func WebsiteInfo(c *gin.Context) {
  22. res := md.WebsiteInfoResp{
  23. SeoTitle: svc.GetSysCfgStr("seo_title"),
  24. SeoLogo: svc.GetOssUrl(svc.GetSysCfgStr("seo_logo")),
  25. WebLogo: svc.GetOssUrl(svc.GetSysCfgStr("web_logo")),
  26. AndroidDownUrl: svc.GetSysCfgStr("android_down_url"),
  27. IosDownUrl: svc.GetSysCfgStr("ios_down_url"),
  28. }
  29. e.OutSuc(c, res, nil)
  30. return
  31. }
  32. // GetModuleSetting
  33. // @Summary 页面样式
  34. // @Tags 官网
  35. // @Description 页面样式
  36. // @Accept json
  37. // @Produce json
  38. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  39. // @Param mod_name_value query string true "页面名称类型值(15:官网 联系我们)"
  40. // @Success 200 {object} md.GetModuleSettingResp "具体数据"
  41. // @Failure 400 {object} md.Response "具体错误"
  42. // @Router /api/website/getModuleSetting [GET]
  43. func GetModuleSetting(c *gin.Context) {
  44. modName := c.Query("mod_name_value")
  45. modNameMap := map[string]string{
  46. "15": "website_about_us",
  47. }
  48. val, ok := modNameMap[modName]
  49. if !ok {
  50. e.OutErr(c, e.ERR_BAD_REQUEST, nil)
  51. return
  52. }
  53. moduleStyleDb := implement.NewModuleStyleDb(db.Db)
  54. moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
  55. "key": "mod_name",
  56. "value": val,
  57. })
  58. if err != nil {
  59. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  60. return
  61. }
  62. if moduleStyle == nil {
  63. e.OutErr(c, e.ERR_NO_DATA, nil)
  64. return
  65. }
  66. var dataMap interface{}
  67. scheme, domain := svc.ImageBucket(db.Db)
  68. moduleStyle.Data = svc.ImageFormatWithBucketForDataInfo(scheme, domain, moduleStyle.Data)
  69. utils.Unserialize([]byte(moduleStyle.Data), &dataMap)
  70. resp := md.GetModuleSettingResp{
  71. ModName: moduleStyle.ModName,
  72. Position: moduleStyle.Position,
  73. SkipIdentifier: moduleStyle.SkipIdentifier,
  74. Title: moduleStyle.Title,
  75. Subtitle: moduleStyle.Subtitle,
  76. Data: dataMap,
  77. }
  78. e.OutSuc(c, resp, nil)
  79. }
  80. // Certificate
  81. // @Summary 证书查询
  82. // @Tags 官网
  83. // @Description 证书查询
  84. // @Accept json
  85. // @Produce json
  86. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  87. // @Param req body md.CertificateReq true "(分页信息必填)"
  88. // @Success 200 {object} md.CertificateResp "具体数据"
  89. // @Failure 400 {object} md.Response "具体错误"
  90. // @Router /api/website/certificate [POST]
  91. func Certificate(c *gin.Context) {
  92. var req md.CertificateReq
  93. err := c.ShouldBindJSON(&req)
  94. if err != nil {
  95. err = svc.HandleValidateErr(err)
  96. err1 := err.(e.E)
  97. e.OutErr(c, err1.Code, err1.Error())
  98. return
  99. }
  100. NewUserCertificateDb := implement.NewUserCertificateDb(db.Db)
  101. data, _ := NewUserCertificateDb.GetUserCertificateByNo(req.No)
  102. if data == nil {
  103. e.OutErr(c, 400, e.NewErr(400, "查询不到该证书"))
  104. return
  105. }
  106. resp := md.CertificateResp{
  107. No: data.No,
  108. Name: data.Name,
  109. StartTime: data.StartTime,
  110. EndTime: data.EndTime,
  111. Logo: svc.GetOssUrl(md.Certificate.Logo),
  112. BgImg: svc.GetOssUrl(md.Certificate.BgImg),
  113. NameIcon: svc.GetOssUrl(md.Certificate.NameIcon),
  114. Medal: svc.GetOssUrl(md.Certificate.Medal),
  115. Seal: svc.GetOssUrl(md.Certificate.Seal),
  116. }
  117. e.OutSuc(c, resp, nil)
  118. return
  119. }