Ver Fonte

feat:jyBXbuyer 采购单位空搜索存缓存调整

fuwencai há 2 anos atrás
pai
commit
f30e73aa59

+ 12 - 2
jyBXBuyer/rpc/internal/logic/buyerlistlogic.go

@@ -54,12 +54,20 @@ func (l *BuyerListLogic) BuyerList(in *bxbuyer.BuyerListReq) (*bxbuyer.BuyerList
 			if err := json.Unmarshal(*bs, &resp.Data); err != nil {
 				isBool = true
 				logx.Info("获取redis缓存,序列化异常")
+			} else {
+				if len(resp.Data.List) > 0 {
+					for i := 0; i < len(resp.Data.List); i++ {
+						buyerNames = append(buyerNames, resp.Data.List[i].Buyer)
+					}
+				}
+
 			}
 		}
 		if isBool {
 			query, CountQuery = model.BuyerListRedisCacheQuery(in.PageNum, in.PageSize)
 			buyerNames, resp = model.GetBuyerList(query, CountQuery, true)
 			if len(resp.Data.List) > 0 {
+				model.SupplyBuyerListData(buyerNames, resp)
 				b, err := json.Marshal(resp.Data)
 				if err == nil {
 					redis.PutBytes("other", fmt.Sprintf(model.P_redis_key, in.PageNum, in.PageSize), &b, model.P_redis_time)
@@ -72,10 +80,12 @@ func (l *BuyerListLogic) BuyerList(in *bxbuyer.BuyerListReq) (*bxbuyer.BuyerList
 		query, CountQuery = model.BuyerListQuery(in)
 		logx.Info("query:", query)
 		buyerNames, resp = model.GetBuyerList(query, CountQuery, false) // 查询数据
+		if len(resp.Data.List) > 0 {
+			model.SupplyBuyerListData(buyerNames, resp)
+		}
 	}
-	if len(resp.Data.List) > 0 {
+	if len(resp.Data.List) > 0 && (in.UserId != "" || in.EntUserId != "") {
 		model.SupplyFollowInfo(in, buyerNames, resp)
-		model.SupplyBuyerListData(buyerNames, resp)
 	}
 	if resp.Data.Count > IC.C.BuyerSearchLimit {
 		resp.Data.Count = IC.C.BuyerSearchLimit

+ 1 - 1
jyBXBuyer/rpc/model/buyerListBYEs.go

@@ -176,7 +176,7 @@ func SupplyFollowInfo(in *bxbuyer.BuyerListReq, buyerNames []string, resp *bxbuy
 	return resp
 }
 
-// SupplyBuyerListData 补充字段   项目数量 历史联系人数量 采购单位规模
+// SupplyBuyerListData 补充字段   招标动态数量 项目数量 历史联系人数量 采购单位规模
 func SupplyBuyerListData(buyerNames []string, resp *bxbuyer.BuyerListResp) *bxbuyer.BuyerListResp {
 	start := time.Now()
 	t1 := time.Now()