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

58 lines
1.7 KiB

  1. package hdl
  2. import (
  3. "applet/app/db"
  4. "applet/app/e"
  5. "applet/app/md"
  6. "applet/app/utils"
  7. "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
  8. "github.com/gin-gonic/gin"
  9. )
  10. // GetModuleSetting
  11. // @Summary 页面样式
  12. // @Tags 页面样式
  13. // @Description 页面样式
  14. // @Accept json
  15. // @Produce json
  16. // @param Authorization header string true "验证参数Bearer和token空格拼接"
  17. // @Param mod_name_value query string true "页面名称类型值(1:home_page 2:member_center 3:bottom_bar 4:invitation_download_landing_page 5:invitation_poster)"
  18. // @Success 200 {object} md.GetModuleSettingResp "具体数据"
  19. // @Failure 400 {object} md.Response "具体错误"
  20. // @Router /api/v1/getModuleSetting [GET]
  21. func GetModuleSetting(c *gin.Context) {
  22. modName := c.Query("mod_name_value")
  23. modNameMap := map[string]string{
  24. "1": "home_page",
  25. "2": "member_center",
  26. "3": "bottom_bar",
  27. "4": "invitation_download_landing_page",
  28. "5": "invitation_poster",
  29. }
  30. val, ok := modNameMap[modName]
  31. if !ok {
  32. e.OutErr(c, e.ERR_BAD_REQUEST, nil)
  33. return
  34. }
  35. moduleStyleDb := implement.NewModuleStyleDb(db.Db)
  36. moduleStyle, err := moduleStyleDb.ModuleStyleGetOneByParams(map[string]interface{}{
  37. "key": "mod_name",
  38. "value": val,
  39. })
  40. if err != nil {
  41. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  42. return
  43. }
  44. var dataMap map[string]interface{}
  45. utils.Unserialize([]byte(moduleStyle.Data), &dataMap)
  46. resp := md.GetModuleSettingResp{
  47. ModName: moduleStyle.ModName,
  48. Position: moduleStyle.Position,
  49. SkipIdentifier: moduleStyle.SkipIdentifier,
  50. Title: moduleStyle.Title,
  51. Subtitle: moduleStyle.Subtitle,
  52. Data: dataMap,
  53. }
  54. e.OutSuc(c, resp, nil)
  55. }