Browse Source

修改富宝数据兼容问题

tuoling805 1 year ago
parent
commit
74a3dc9c6c
1 changed files with 9 additions and 1 deletions
  1. 9 1
      controllers/base_from_fubao.go

+ 9 - 1
controllers/base_from_fubao.go

@@ -57,7 +57,15 @@ func (this *FuBaoController) Add() {
 		}
 		if len(dataItem.ReturnValue.Data) > 0 {
 			priceStr := dataItem.ReturnValue.Data[0].PriceStr
-			if strings.Contains(priceStr, "-") {
+
+			priceArr := strings.Split(priceStr, "-")
+			var isAdd bool
+			for _, v := range priceArr {
+				if v == "" {
+					isAdd = true
+				}
+			}
+			if isAdd == false {
 				br.Msg = "此指标的数据格式暂不支持!"
 				br.ErrMsg = "此指标的数据格式暂不支持,Val:" + priceStr + ";pid:" + req.EdbCode
 				return