Selaa lähdekoodia

fix:过滤特定指标更新

Roc 2 vuotta sitten
vanhempi
commit
0e76cf4525
2 muutettua tiedostoa jossa 22 lisäystä ja 0 poistoa
  1. 11 0
      controllers/base_from_wind.go
  2. 11 0
      utils/common.go

+ 11 - 0
controllers/base_from_wind.go

@@ -106,6 +106,17 @@ func (this *WindController) Refresh() {
 	if !utils.Rc.IsExist(cacheKey) {
 		utils.Rc.SetNX(cacheKey, 1, 1*time.Minute)
 
+		//特定的指标过滤(wind不对该指标进行更新了)
+		{
+			edbCodeArr := []string{"S6451662", "S6451679", "S6451670", "S6451671", "s6451669", "S6451693", "S6451694"}
+			has := utils.InArrayByStr(edbCodeArr, req.EdbCode)
+			if has {
+				br.Ret = 200
+				br.Success = true
+				br.Msg = "获取成功"
+			}
+		}
+
 		//期货数据,就默认到今天,特殊处理下
 		endDate := utils.BASE_END_DATE
 		if strings.Contains(req.EdbCode, ".") {

+ 11 - 0
utils/common.go

@@ -1064,3 +1064,14 @@ func PrintLog(params ...string) {
 	_, file, line, ok := runtime.Caller(1)
 	fmt.Println(file, line, ok, params)
 }
+
+// InArrayByStr php中的in_array(判断String类型的切片中是否存在该string值)
+func InArrayByStr(idStrList []string, searchId string) (has bool) {
+	for _, id := range idStrList {
+		if id == searchId {
+			has = true
+			return
+		}
+	}
+	return
+}