mini_config.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package controllers
  2. import (
  3. "eta/eta_mini_api/models"
  4. "eta/eta_mini_api/models/response"
  5. )
  6. type MiniConfigController struct {
  7. BaseCommonController
  8. }
  9. // @Title 获取小程序配置项
  10. // @Description 获取小程序配置项
  11. // @Param ReportId query int true "报告id"
  12. // @Param chartPermissionId query int true "品种ID"
  13. // @Param PageSize query int true "每页数据条数"
  14. // @Param CurrentIndex query int true "当前页页码,从1开始"
  15. // @Success 200 {object} models.ReportDetailResp
  16. // @router /config [get]
  17. func (this *MiniConfigController) MiniConfig() {
  18. br := new(models.BaseResponse).Init()
  19. defer func() {
  20. if br.ErrMsg == "" {
  21. br.IsSendEmail = false
  22. }
  23. this.Data["json"] = br
  24. this.ServeJSON()
  25. }()
  26. list := make([]response.MiniConfigResp, 0)
  27. miniConf, err := models.GetMiniConf()
  28. if err != nil {
  29. br.Msg = "获取小程序配置项失败"
  30. br.ErrMsg = "获取小程序配置项失败,系统异常,Err:" + err.Error()
  31. return
  32. }
  33. list = append(list, response.MiniConfigResp{
  34. ConfKey: "ChartViewUrl",
  35. ConfVal: miniConf["ChartViewUrl"],
  36. }, response.MiniConfigResp{
  37. ConfKey: "H5Url",
  38. ConfVal: miniConf["H5Url"],
  39. }, response.MiniConfigResp{
  40. ConfKey: "Disclaimers",
  41. ConfVal: miniConf["Disclaimers"],
  42. }, response.MiniConfigResp{
  43. ConfKey: "ServiceAgreement",
  44. ConfVal: miniConf["ServiceAgreement"],
  45. }, response.MiniConfigResp{
  46. ConfKey: "MostReport",
  47. ConfVal: miniConf["MostReport"],
  48. }, response.MiniConfigResp{
  49. ConfKey: "ServicePhone",
  50. ConfVal: miniConf["ServicePhone"],
  51. }, response.MiniConfigResp{
  52. ConfKey: "Colors",
  53. ConfVal: miniConf["Colors"],
  54. }, response.MiniConfigResp{
  55. ConfKey: "EmptyImg",
  56. ConfVal: miniConf["EmptyImg"],
  57. }, response.MiniConfigResp{
  58. ConfKey: "Logo",
  59. ConfVal: miniConf["Logo"],
  60. }, response.MiniConfigResp{
  61. ConfKey: "WxAppId",
  62. ConfVal: miniConf["WxAppId"],
  63. }, response.MiniConfigResp{
  64. ConfKey: "BindImg",
  65. ConfVal: miniConf["BindImg"],
  66. })
  67. br.Data = list
  68. br.Ret = 200
  69. br.Success = true
  70. br.Msg = "获取成功"
  71. }