|
@@ -79,6 +79,35 @@ func GetEdbDataFromWind(edbCode, startDate, endDate string) (item *EdbDataFromWi
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// GetEdbDataFromWindUrl 通过url获取wind数据
|
|
|
+func GetEdbDataFromWindUrl(windUrl, edbCode, startDate, endDate string) (item *EdbDataFromWind, errorCode int, err error) {
|
|
|
+ if windUrl == `` {
|
|
|
+ return GetEdbDataFromWind(edbCode, startDate, endDate)
|
|
|
+ }
|
|
|
+
|
|
|
+ thsUrl := windUrl + `edbInfo/wind?EdbCode=%s&StartDate=%s&EndDate=%s`
|
|
|
+ thsUrl = fmt.Sprintf(thsUrl, edbCode, startDate, endDate)
|
|
|
+ utils.FileLog.Info(fmt.Sprintf("windUrl:%s", thsUrl))
|
|
|
+ body, err := http.Get(thsUrl)
|
|
|
+ fmt.Println("GetEdbDataByWind body:")
|
|
|
+ fmt.Println(string(body))
|
|
|
+ utils.FileLog.Info(fmt.Sprint("wind result:", string(body)))
|
|
|
+
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item = new(EdbDataFromWind)
|
|
|
+ err = json.Unmarshal(body, &item)
|
|
|
+
|
|
|
+ //异常的话,需要邮件通知
|
|
|
+ if len(item.ErrorCode) > 0 {
|
|
|
+ if item.ErrorCode["0"] != 0 {
|
|
|
+ go alarm_msg.SendAlarmMsg(fmt.Sprintf("wind数据服务异常,url:%s;edbCode:%s,ErrorCode:%d,result:%s", windUrl, edbCode, item.ErrorCode["0"], string(body)), 3)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// GetWindUrl 获取wind的url
|
|
|
func GetWindUrl(edbCode string) (windUrl string, err error) {
|
|
|
defer func() {
|