pcsg_index.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package index_data
  2. import (
  3. "eta/eta_bridge/controller/resp"
  4. indexDataService "eta/eta_bridge/services/index_data"
  5. "github.com/gin-gonic/gin"
  6. )
  7. // PCSGIndexController 中石油新加坡指标
  8. type PCSGIndexController struct{}
  9. // GetBloombergDailyIndex
  10. // @Description 获取日度指标
  11. // @Success 200 {string} string "获取成功"
  12. // @Router /bloomberg/daily_index [post]
  13. func (this *PCSGIndexController) GetBloombergDailyIndex(c *gin.Context) {
  14. data, e := indexDataService.GetPCSGBloombergDailyIndex()
  15. if e != nil {
  16. resp.FailMsg("获取失败", "获取中石油新加坡日度指标失败, err: "+e.Error(), c)
  17. return
  18. }
  19. resp.OkData("获取成功", data, c)
  20. }
  21. // GetBloombergWeeklyIndex
  22. // @Description 获取周度指标
  23. // @Success 200 {string} string "获取成功"
  24. // @Router /bloomberg/weekly_index [post]
  25. func (this *PCSGIndexController) GetBloombergWeeklyIndex(c *gin.Context) {
  26. data, e := indexDataService.GetPCSGBloombergWeeklyIndex()
  27. if e != nil {
  28. resp.FailMsg("获取失败", "获取中石油新加坡周度指标失败, err: "+e.Error(), c)
  29. return
  30. }
  31. resp.OkData("获取成功", data, c)
  32. }
  33. // GetBloombergMonthlyIndex
  34. // @Description 获取月度指标
  35. // @Success 200 {string} string "获取成功"
  36. // @Router /bloomberg/monthly_index [post]
  37. func (this *PCSGIndexController) GetBloombergMonthlyIndex(c *gin.Context) {
  38. data, e := indexDataService.GetPCSGBloombergMonthlyIndex()
  39. if e != nil {
  40. resp.FailMsg("获取失败", "获取中石油新加坡月度指标失败, err: "+e.Error(), c)
  41. return
  42. }
  43. resp.OkData("获取成功", data, c)
  44. }