瀏覽代碼

feat:超时

wangshan 3 年之前
父節點
當前提交
ce398bf678
共有 1 個文件被更改,包括 5 次插入13 次删除
  1. 5 13
      jyBXBuyer/rpc/model/buyerListBYEs.go

+ 5 - 13
jyBXBuyer/rpc/model/buyerListBYEs.go

@@ -132,20 +132,10 @@ const (
 //查询采购单位列表
 //查询采购单位列表
 func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bxbuyer.BuyerListResp) {
 func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bxbuyer.BuyerListResp) {
 	t1 := time.Now()
 	t1 := time.Now()
-	aggs, count := GetAggs(P_INDEX, P_TYPE, qstr)
-	log.Println("=------===", count)
-	if count > IC.C.BuyerCount {
-		count = IC.C.BuyerCount
-	}
-	if isCache {
-		if count > int64(len(IC.C.DefaultBuyerNames)) {
-			count = int64(len(IC.C.DefaultBuyerNames))
-		}
-	}
+	aggs := GetAggs(P_INDEX, P_TYPE, qstr)
 	resp = &bxbuyer.BuyerListResp{
 	resp = &bxbuyer.BuyerListResp{
 		Data: &bxbuyer.BuyerData{},
 		Data: &bxbuyer.BuyerData{},
 	}
 	}
-	resp.Data.Count = count
 	type GroupStruct struct {
 	type GroupStruct struct {
 		Buckets []struct {
 		Buckets []struct {
 			Key       string `json:"key,omitempty"`
 			Key       string `json:"key,omitempty"`
@@ -178,6 +168,8 @@ func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bx
 			}
 			}
 		}
 		}
 	}
 	}
+	resp.Data.Count = int64(len(resp.Data.List))
+	log.Println("=---count---===", resp.Data.Count)
 	if len(resp.Data.List) > 0 {
 	if len(resp.Data.List) > 0 {
 		var wg sync.WaitGroup
 		var wg sync.WaitGroup
 		//省份和城市 是否查询已关注信息 是否查询已领取信息
 		//省份和城市 是否查询已关注信息 是否查询已领取信息
@@ -225,8 +217,8 @@ func GetBuyerList(qstr string, in *bxbuyer.BuyerListReq, isCache bool) (resp *bx
 }
 }
 
 
 //聚合查询
 //聚合查询
-func GetAggs(index, itype, query string) (aggs map[string]*json.RawMessage, count int64) {
-	count = elastic.Count(index, itype, query)
+func GetAggs(index, itype, query string) (aggs map[string]*json.RawMessage) {
+	//count = elastic.Count(index, itype, query)
 	defer MC.Catch()
 	defer MC.Catch()
 	client := elastic.GetEsConn()
 	client := elastic.GetEsConn()
 	defer func() {
 	defer func() {