wangshan 2 жил өмнө
parent
commit
d75d6347bc

+ 6 - 4
jyBXCore/rpc/entity/search.go

@@ -15,8 +15,8 @@ import (
 )
 
 var (
-	SearchCacheKey   = "searchDataCache_%d_%s_%s"
-	SearchCacheCount = "searchCountCache_%d_%s_%s"
+	SearchCacheKey   = "searchDataCache_%d_%s_%s_%s"
+	SearchCacheCount = "searchCountCache_%d_%s_%s_%s"
 )
 
 type KeyWordsSearch struct{}
@@ -41,10 +41,10 @@ func (kws *KeyWordsSearch) GetBidSearchListByCache(in *bxcore.SearchReq) (list [
 	//缓存数据 最大量是5000条  100页数据
 	l, c := func(in *bxcore.SearchReq) (list []*bxcore.SearchList, count int64) {
 		//缓存数据总量 - 当前平台
-		redisCountKey := fmt.Sprintf(SearchCacheCount, in.SearchGroup, MC.If(in.IsPay, "v", "f").(string), MC.If(in.BidField != "", in.BidField, "n").(string))
+		redisCountKey := fmt.Sprintf(SearchCacheCount, in.SearchGroup, MC.If(in.IsPay, "v", "f").(string), MC.If(in.BidField != "", in.BidField, "n").(string), in.Platform)
 		count = int64(redis.GetInt(util.RedisNameNew, redisCountKey))
 		//缓存数据: SearchGroup-全部;招标信息;超前项目信息;kws.PageNum-当前页 免费用户 or 付费用户
-		redisDataKey := fmt.Sprintf(SearchCacheKey, in.SearchGroup, MC.If(in.IsPay, "v", "f").(string), MC.If(in.BidField != "", in.BidField, "n").(string))
+		redisDataKey := fmt.Sprintf(SearchCacheKey, in.SearchGroup, MC.If(in.IsPay, "v", "f").(string), MC.If(in.BidField != "", in.BidField, "n").(string), in.Platform)
 		sCache, err := redis.GetNewBytes(util.RedisNameNew, redisDataKey)
 		logx.Info("-------------------------redisDataKey--------------------------------:", redisDataKey)
 		if err == nil {
@@ -52,6 +52,8 @@ func (kws *KeyWordsSearch) GetBidSearchListByCache(in *bxcore.SearchReq) (list [
 				err = json.Unmarshal(*sCache, &list)
 				if err == nil {
 					return
+				} else {
+					logx.Info("缓存序列化异常")
 				}
 			}
 		}

+ 3 - 2
jyBXCore/rpc/internal/server/bxcoreserver.go

@@ -5,6 +5,7 @@ package server
 
 import (
 	"context"
+
 	"jyBXCore/rpc/internal/logic"
 	"jyBXCore/rpc/internal/svc"
 	"jyBXCore/rpc/type/bxcore"
@@ -21,13 +22,13 @@ func NewBxCoreServer(svcCtx *svc.ServiceContext) *BxCoreServer {
 	}
 }
 
-// 标讯搜索结果列表数据
+// GetSearchList 标讯搜索结果列表数据
 func (s *BxCoreServer) GetSearchList(ctx context.Context, in *bxcore.SearchReq) (*bxcore.SearchResp, error) {
 	l := logic.NewGetSearchListLogic(ctx, s.svcCtx)
 	return l.GetSearchList(in)
 }
 
-// 标讯搜索限制内容
+// SearchLimit 标讯搜索限制内容
 func (s *BxCoreServer) SearchLimit(ctx context.Context, in *bxcore.SearchLimitReq) (*bxcore.SearchLimitResp, error) {
 	l := logic.NewSearchLimitLogic(ctx, s.svcCtx)
 	return l.SearchLimit(in)

+ 5 - 4
jyBXCore/rpc/util/search.go

@@ -177,8 +177,9 @@ func MakeCollection(userId string, list []*bxcore.SearchList) {
 		return
 	}
 	param := []interface{}{userId}
-	wh := []string{}
+	var wh []string
 	for _, v := range list {
+		logx.Info(v.Title, "---v.id---:", v.Id)
 		array := ME.DecodeArticleId2ByCheck(v.Id)
 		if len(array) == 1 && array[0] != "" {
 			param = append(param, array[0])
@@ -187,14 +188,14 @@ func MakeCollection(userId string, list []*bxcore.SearchList) {
 	}
 	if len(wh) > 0 {
 		result := IC.MainMysql.SelectBySql(`select bid from bdcollection where userid=? and bid in (`+strings.Join(wh, ",")+`)`, param...)
-		bid_map := map[string]bool{}
+		bidMap := map[string]bool{}
 		if result != nil {
 			for _, v := range *result {
-				bid_map[ME.EncodeArticleId2ByCheck(MC.ObjToString(v["bid"]))] = true
+				bidMap[ME.EncodeArticleId2ByCheck(MC.ObjToString(v["bid"]))] = true
 			}
 		}
 		for _, v := range list {
-			if bid_map[v.Id] {
+			if bidMap[v.Id] {
 				v.IsCollected = true
 			}
 		}