Bläddra i källkod

feat:推送价格

wangshan 3 år sedan
förälder
incheckning
28dc14f265
1 ändrade filer med 10 tillägg och 4 borttagningar
  1. 10 4
      jyBXSubscribe/rpc/util/push.go

+ 10 - 4
jyBXSubscribe/rpc/util/push.go

@@ -400,10 +400,16 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 	}
 	//价格- 预算和中标金额
 	if spqp.Price != "" && strings.Contains(spqp.Price, "-") {
-		minPrice_str, maxPrice_str := strings.Split(spqp.Price, "-")[0], strings.Split(spqp.Price, "-")[1]
-		minPrice := common.Int64All(common.Float64All(minPrice_str) * 10000) //换成元
-		maxPrice := common.Int64All(common.Float64All(maxPrice_str) * 10000) //换成元
-		querys = append(querys, fmt.Sprintf("((bidamount>=%d and bidamount<=%d) or (budget>=%d and budget<=%d and bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
+		minPriceStr, maxPriceStr := strings.Split(spqp.Price, "-")[0], strings.Split(spqp.Price, "-")[1]
+		minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
+		maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
+		if minPriceStr != "" && maxPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("((bidamount>=%d and bidamount<=%d) or (budget>=%d and budget<=%d and bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
+		} else if minPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("(bidamount>=%d  or (budget>=%d and bidamount is null))", minPrice, minPrice))
+		} else if maxPriceStr != "" {
+			querys = append(querys, fmt.Sprintf("( bidamount<=%d or (budget<=%d and bidamount is null))", maxPrice, maxPrice))
+		}
 	}
 	//附件
 	if spqp.FileExists != "" {