فهرست منبع

Merge branch 'master' of http://192.168.3.207:8080/BaseService/jyMicroservices

duxin 3 سال پیش
والد
کامیت
ff1346e1a1
2فایلهای تغییر یافته به همراه9 افزوده شده و 4 حذف شده
  1. 6 1
      jyBXBase/rpc/util/common.go
  2. 3 3
      jyBXSubscribe/rpc/util/push.go

+ 6 - 1
jyBXBase/rpc/util/common.go

@@ -19,7 +19,7 @@ import (
 
 const (
 	query          = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","subtype","s_winner","buyertel","winnertel","buyerclass"],"from":0,"size":%d}`
-	mongodb_fields = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"winnertel":1,"s_winner":1,"buyertel":1}`
+	mongodb_fields = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"winnertel":1,"s_winner":1,"buyertel":1,"attach_text":1}`
 	querys         = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","title","detail","area","city","publishtime","projectname","buyer","buyerclass","s_winner","bidamount","subtype","toptype","projectcode","buyertel","budget","bidopentime","agency","projectscope","winnerperson","winnertel"],"from":0,"size":%d}}`
 )
 
@@ -359,6 +359,7 @@ type InfoList struct {
 	Buyer           string      `json:"buyer"`
 	S_winner        string      `json:"s_winner"`
 	Bidopentime     int64       `json:"bidopentime"`
+	FileExists      bool        `json:"fileExists"`
 }
 
 //根据id取内容
@@ -396,6 +397,7 @@ func GetInfoById(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, i
 		if list != nil {
 			for _, v := range *list {
 				_id := common.ObjToString(v["_id"])
+				v["attachment_count"] = common.If(v["filetext"] != nil, 1, 0).(int)
 				infos[_id] = v
 			}
 		}
@@ -414,6 +416,7 @@ func GetInfoById(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, i
 			for _, v := range *list {
 				_id := mongodb.BsonIdToSId(v["_id"])
 				v["_id"] = _id
+				v["attachment_count"] = common.If(v["attach_text"] != nil, 1, 0).(int)
 				infos[_id] = v
 			}
 		}
@@ -431,6 +434,7 @@ func GetInfoById(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, i
 			for _, v := range *list {
 				_id := mongodb.BsonIdToSId(v["_id"])
 				v["_id"] = _id
+				v["attachment_count"] = common.If(v["attach_text"] != nil, 1, 0).(int)
 				infos[_id] = v
 			}
 		}
@@ -492,6 +496,7 @@ func InfoFormat(p string, info *map[string]interface{}) *InfoList {
 		Buyer:           common.ObjToString((*info)["buyer"]),
 		S_winner:        common.ObjToString((*info)["s_winner"]),
 		Bidopentime:     common.Int64All((*info)["bidopentime"]),
+		FileExists:      common.IntAll((*info)["attachment_count"]) > 0,
 	}
 }
 

+ 3 - 3
jyBXSubscribe/rpc/util/push.go

@@ -403,9 +403,9 @@ 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.Float64All(minPrice_str)
-		maxPrice := common.Float64All(maxPrice_str)
-		querys = append(querys, fmt.Sprintf("(budget>=%d and budget<=%d) or (bidamout>=%d and bidamout<=%d)", minPrice, maxPrice, minPrice, maxPrice))
+		minPrice := common.Int64All(common.Float64All(minPrice_str) * 10000) //换成元
+		maxPrice := common.Int64All(common.Float64All(maxPrice_str) * 10000) //换成元
+		querys = append(querys, fmt.Sprintf("(budget>=%d and budget<=%d) or (bidamount>=%d and bidamount<=%d)", minPrice, maxPrice, minPrice, maxPrice))
 	}
 	//附件
 	if spqp.FileExists != "" {