eta_forum_chart.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package controllers
  2. import (
  3. "eta/eta_chart_lib/models"
  4. "eta/eta_chart_lib/services/eta_forum"
  5. )
  6. type EtaForumChartController struct {
  7. BaseCommonController
  8. }
  9. // CommonChartInfoDetailFromUniqueCode
  10. // @Title 根据编码获取图表详情
  11. // @Description 根据编码获取图表详情接口
  12. // @Param UniqueCode query int true "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
  13. // @Param IsCache query bool true "是否走缓存,默认false"
  14. // @Success 200 {object} data_manage.ChartInfoDetailFromUniqueCodeResp
  15. // @router /chart/common/detail [get]
  16. func (this *EtaForumChartController) CommonChartInfoDetailFromUniqueCode() {
  17. br := new(models.BaseResponse).Init()
  18. defer func() {
  19. this.Data["json"] = br
  20. this.ServeJSON()
  21. }()
  22. uniqueCode := this.GetString("UniqueCode")
  23. if uniqueCode == "" {
  24. br.Msg = "参数错误"
  25. br.ErrMsg = "参数错误,uniqueCode is empty"
  26. return
  27. }
  28. resp := new(models.ChartInfoDetailResp)
  29. //是否走缓存
  30. isCache, _ := this.GetBool("IsCache")
  31. forumResp, err, _ := eta_forum.GeChartFromUniqueCode(uniqueCode, isCache)
  32. if err != nil {
  33. br.Msg = "获取失败"
  34. br.ErrMsg = "获取图表信息失败, Err: " + err.Error()
  35. return
  36. }
  37. chartInfo := forumResp.ChartInfo
  38. resp.ChartInfo = chartInfo
  39. resp.DataResp = forumResp.DataResp
  40. resp.EdbInfoList = forumResp.EdbInfoList
  41. resp.XDataList = forumResp.XDataList
  42. resp.YDataList = forumResp.YDataList
  43. resp.WaterMark = forumResp.WaterMark
  44. br.Ret = 200
  45. br.Success = true
  46. br.Msg = "获取成功"
  47. br.Data = resp
  48. }