chart.go 915 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package services
  2. import (
  3. "encoding/json"
  4. "eta/eta_mini_api/utils"
  5. "fmt"
  6. resp2 "eta/eta_mini_api/models/response"
  7. )
  8. func GetChartList(currentIndex, pageSize int) (resp *resp2.ChartResp[resp2.ChartListResp], err error) {
  9. url := utils.ETA_MINI_BRIDGE_URL + "/chart/list?"
  10. url += fmt.Sprintf("PageSize=%d&CurrentIndex=%d", pageSize, currentIndex)
  11. fmt.Println(url)
  12. body, err := HttpGet(url)
  13. if err != nil {
  14. return
  15. }
  16. err = json.Unmarshal(body, &resp)
  17. if err != nil {
  18. return resp, err
  19. }
  20. return resp, nil
  21. }
  22. func GetChartDetail(chartInfoId int, uniqueCode string) (resp *resp2.ChartResp[resp2.ChartInfoView], err error) {
  23. url := utils.ETA_MINI_BRIDGE_URL + "/chart/detail?"
  24. url += fmt.Sprintf("ChartInfoId=%d&UniqueCode=%s", chartInfoId, uniqueCode)
  25. fmt.Println(url)
  26. body, err := HttpGet(url)
  27. if err != nil {
  28. return
  29. }
  30. err = json.Unmarshal(body, &resp)
  31. if err != nil {
  32. return
  33. }
  34. return
  35. }