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

ModuleSetting.go 2.0 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)"
  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. }
  32. val, ok := modNameMap[modName]
  33. if !ok {
  34. e.OutErr(c, e.ERR_BAD_REQUEST, nil)
  35. return
  36. }
  37. moduleStyleDb := implement.NewModuleStyleDb(db.Db)
  38. moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
  39. "key": "mod_name",
  40. "value": val,
  41. })
  42. if err != nil {
  43. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  44. return
  45. }
  46. var dataMap map[string]interface{}
  47. redisConn := cache.GetPool().Get()
  48. scheme, domain := svc.ImageBucket(db.Db, redisConn)
  49. moduleStyle.Data = svc.ImageFormatWithBucketNew(scheme, domain, moduleStyle.Data)
  50. utils.Unserialize([]byte(moduleStyle.Data), &dataMap)
  51. resp := md.GetModuleSettingResp{
  52. ModName: moduleStyle.ModName,
  53. Position: moduleStyle.Position,
  54. SkipIdentifier: moduleStyle.SkipIdentifier,
  55. Title: moduleStyle.Title,
  56. Subtitle: moduleStyle.Subtitle,
  57. Data: dataMap,
  58. }
  59. e.OutSuc(c, resp, nil)
  60. }