Browse Source

fix:期货数据库的刷新,也要兼容多服务器

Roc 3 tháng trước cách đây
mục cha
commit
04248c538e
1 tập tin đã thay đổi với 13 bổ sung1 xóa
  1. 13 1
      services/data/future_good/base_future_good_lib.go

+ 13 - 1
services/data/future_good/base_future_good_lib.go

@@ -29,9 +29,21 @@ func RefreshEdbData(futureGoodEdbInfoId int, futureGoodEdbCode, startDate string
 	return
 }
 
+var step int //计数器
+
 // postRefreshEdbData 刷新指标数据
 func postRefreshEdbData(param map[string]interface{}, urlStr string) (resp *models.BaseResponse, err error) {
-	postUrl := utils.EDB_LIB_URL + urlStr
+	var postUrl string
+	edbLibUrlListLen := len(utils.EDB_LIB_URL_LIST)
+	if edbLibUrlListLen <= 0 {
+		postUrl = utils.EDB_LIB_URL
+	} else {
+		rn := step % edbLibUrlListLen
+		postUrl = utils.EDB_LIB_URL_LIST[rn].Url
+	}
+	postUrl = postUrl + urlStr
+	step++
+
 	postData, err := json.Marshal(param)
 	if err != nil {
 		return