1234567891011121314151617181920212223242526272829303132 |
- package services
- import (
- "encoding/json"
- "fmt"
- "github.com/rdlucklib/rdluck_tools/http"
- "hongze/hongze_edb_lib/utils"
- )
- type EdbDataFromWind struct {
- Close map[string]float64 `json:"CLOSE"`
- Dt map[string]int64 `json:"DT"`
- ErrMsg string
- }
- // GetEdbDataFromWind 获取wind数据
- func GetEdbDataFromWind(edbCode, startDate, endDate string) (item *EdbDataFromWind, err error) {
- thsUrl := utils.Hz_Wind_Data_Url + `edbInfo/wind?EdbCode=%s&StartDate=%s&EndDate=%s`
- thsUrl = fmt.Sprintf(thsUrl, edbCode, startDate, endDate)
- utils.FileLog.Info("thsUrl:%s", thsUrl)
- body, err := http.Get(thsUrl)
- fmt.Println("GetEdbDataByThs body:")
- fmt.Println(string(body))
- utils.FileLog.Info("wind result:", string(body))
- if err != nil {
- return
- }
- item = new(EdbDataFromWind)
- err = json.Unmarshal(body, &item)
- return
- }
|