base_from_fubao.go 746 B

1234567891011121314151617181920212223242526272829
  1. package services
  2. import (
  3. "encoding/json"
  4. "eta/eta_index_lib/models"
  5. "eta/eta_index_lib/utils"
  6. "fmt"
  7. "github.com/rdlucklib/rdluck_tools/http"
  8. )
  9. const (
  10. FuBaoQueryDataUrl = "http://data.f139.com/cooperation/wande/queryData.do?pid=%s"
  11. FuBaoQueryLastDataUrl = "http://data.f139.com/cooperation/wande/queryLastData.do"
  12. )
  13. // GetEdbDataFromLt 获取路透数据
  14. func GetEdbDataFromFuBao(edbCode, startDate, endDate string) (item *models.FuBaoData, err error) {
  15. sbUrl := fmt.Sprintf(FuBaoQueryDataUrl, edbCode)
  16. utils.FileLog.Info("sbUrl:%s", sbUrl)
  17. body, err := http.Get(sbUrl)
  18. utils.FileLog.Info("fubao result:%s", string(body))
  19. if err != nil {
  20. return
  21. }
  22. item = new(models.FuBaoData)
  23. err = json.Unmarshal(body, &item)
  24. return
  25. }