Эх сурвалжийг харах

Merge branch 'aj_wind_wsd' into debug

tuoling805 1 жил өмнө
parent
commit
ea23da0ad0

+ 1 - 1
controllers/base_from_wind_wsd.go

@@ -131,7 +131,7 @@ func (this *WindWsdController) Add() {
 		br.Ret = 200
 		br.Success = true
 		br.Msg = "获取成功"
-		br.Data = dataItem
+		//br.Data = dataItem
 	} else {
 		br.Ret = 501
 		br.Success = true

+ 11 - 1
models/base_from_wind_wsd.go

@@ -29,10 +29,20 @@ func AddEdbDataFromWindWsd(stockCode string, item map[string]map[string]interfac
 			vk = strings.ToLower(vk)
 			indexCode = windWsd + stockCode + vk
 
-			timeStr := wk
 			wkInt = wkInt / 1000
 			t := time.Unix(wkInt, 0)
+			if t.After(time.Now()) {
+				continue
+			}
 			dateTime := t.Format(utils.FormatDate)
+
+			dataTime, err := time.ParseInLocation(utils.FormatDate, dateTime, time.Local)
+			if err != nil {
+				return err
+			}
+			timestamp := dataTime.UnixNano() / 1e6
+			timeStr := fmt.Sprintf("%d", timestamp)
+
 			//saveVal := utils.SubFloatToString(val, 20)
 			if vv == nil {
 				continue

+ 1 - 1
services/base_from_wind_wsd.go

@@ -76,7 +76,7 @@ func GetEdbDataFromWindWsd(securitiesCode, edbCode, startDate, endDate string) (
 
 // GetEdbDataFromWindUrlWsd 通过url获取wind wsd数据
 func GetEdbDataFromWindUrlWsd(windUrl, stockCode, edbCode, startDate, endDate string) (item map[string]map[string]interface{}, errorCode int, err error) {
-	requestWindUrl := windUrl + `/edbInfo/wind/wsd?StockCode=%s&EdbCode=%s&StartDate=%s&EndDate=%s`
+	requestWindUrl := windUrl + `edbInfo/wind/wsd?StockCode=%s&EdbCode=%s&StartDate=%s&EndDate=%s`
 	requestWindUrl = fmt.Sprintf(requestWindUrl, stockCode, edbCode, startDate, endDate)
 	utils.FileLog.Info(fmt.Sprintf("windUrl:%s", requestWindUrl))
 	body, err := http.Get(requestWindUrl)