蛋蛋星球-客户端
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

76 linhas
2.4 KiB

  1. package hdl
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md"
  6. "applet/app/utils"
  7. "applet/app/utils/cache"
  8. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  9. "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc"
  10. "github.com/gin-gonic/gin"
  11. )
  12. // GetModuleSetting
  13. // @Summary 页面样式
  14. // @Tags 页面样式
  15. // @Description 页面样式
  16. // @Accept json
  17. // @Produce json
  18. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  19. // @Param mod_name_value query string true "页面名称类型值(1:首页 2:会员中心 3:底部导航 4:邀请下载落地页 5:邀请海报 7:下载渠道 8:贡献值 9:蛋蛋分 10:商务合作 11:资质证书 12:提现页 13:提现到账户 14实名认证)"
  20. // @Success 200 {object} md.GetModuleSettingResp "具体数据"
  21. // @Failure 400 {object} md.Response "具体错误"
  22. // @Router /api/v1/getModuleSetting [GET]
  23. func GetModuleSetting(c *gin.Context) {
  24. modName := c.Query("mod_name_value")
  25. modNameMap := map[string]string{
  26. "1": "home_page",
  27. "2": "member_center",
  28. "3": "bottom_bar",
  29. "4": "invitation_download_landing_page",
  30. "5": "invitation_poster",
  31. "6": "about_us",
  32. "7": "down_channel",
  33. "8": "contribution",
  34. "9": "egg_score",
  35. "10": "business_cooperation",
  36. "11": "qualification_certificate",
  37. "12": "withdraw",
  38. "13": "withdraw_account",
  39. "14": "user_real_name",
  40. }
  41. val, ok := modNameMap[modName]
  42. if !ok {
  43. e.OutErr(c, e.ERR_BAD_REQUEST, nil)
  44. return
  45. }
  46. moduleStyleDb := implement.NewModuleStyleDb(db.Db)
  47. moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
  48. "key": "mod_name",
  49. "value": val,
  50. })
  51. if err != nil {
  52. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  53. return
  54. }
  55. if moduleStyle == nil {
  56. e.OutErr(c, e.ERR_NO_DATA, nil)
  57. return
  58. }
  59. var dataMap interface{}
  60. redisConn := cache.GetPool().Get()
  61. scheme, domain := svc.ImageBucket(db.Db, redisConn)
  62. moduleStyle.Data = svc.ImageFormatWithBucketForDataInfo(scheme, domain, moduleStyle.Data)
  63. utils.Unserialize([]byte(moduleStyle.Data), &dataMap)
  64. resp := md.GetModuleSettingResp{
  65. ModName: moduleStyle.ModName,
  66. Position: moduleStyle.Position,
  67. SkipIdentifier: moduleStyle.SkipIdentifier,
  68. Title: moduleStyle.Title,
  69. Subtitle: moduleStyle.Subtitle,
  70. Data: dataMap,
  71. }
  72. e.OutSuc(c, resp, nil)
  73. }