Эх сурвалжийг харах

Merge branch 'dev/v1.1.35_fuwencai' of BaseService/jyMicroservices into feature/v1.1.35

fuwencai 1 жил өмнө
parent
commit
9e64840cbe

+ 20 - 19
jyBXCore/rpc/bxcore/bxcore.go

@@ -1,4 +1,4 @@
-// Code generated by goctl. DO NOT EDIT.
+// Code generated by goctl. DO NOT EDIT!
 // Source: bxcore.proto
 
 package bxcore
@@ -52,6 +52,7 @@ type (
 	SearchLimitReq           = bxcore.SearchLimitReq
 	SearchLimitResp          = bxcore.SearchLimitResp
 	SearchList               = bxcore.SearchList
+	SearchMap                = bxcore.SearchMap
 	SearchReq                = bxcore.SearchReq
 	SearchResp               = bxcore.SearchResp
 	SearchReturn             = bxcore.SearchReturn
@@ -67,23 +68,23 @@ type (
 		GetSearchList(ctx context.Context, in *SearchReq, opts ...grpc.CallOption) (*SearchResp, error)
 		// 标讯搜索限制内容
 		SearchLimit(ctx context.Context, in *SearchLimitReq, opts ...grpc.CallOption) (*SearchLimitResp, error)
-		// 列表数据参标信息接口
+		//  列表数据参标信息接口
 		ParticipateShow(ctx context.Context, in *ParticipateShowReq, opts ...grpc.CallOption) (*ParticipateShowRes, error)
-		// 详情页参标信息接口
+		//  详情页参标信息接口
 		ParticipateInfo(ctx context.Context, in *ParticipateInfoReq, opts ...grpc.CallOption) (*ParticipateInfoRes, error)
-		// 投标状态更新
+		//   投标状态更新
 		UpdateBidStatus(ctx context.Context, in *UpdateBidStatusReq, opts ...grpc.CallOption) (*UpdateBidStatusRes, error)
-		// 获取投标状态信息
+		//  获取投标状态信息
 		ParticipateContent(ctx context.Context, in *ParticipateContentReq, opts ...grpc.CallOption) (*ParticipateContentRes, error)
-		// 参标操作记录
+		//  参标操作记录
 		ParticipateRecords(ctx context.Context, in *ParticipateRecordsReq, opts ...grpc.CallOption) (*ParticipateRecordsRes, error)
-		// 当前部门/企业下参标人员信息
+		//  当前部门/企业下参标人员信息
 		ParticipatePersons(ctx context.Context, in *ParticipatePersonsReq, opts ...grpc.CallOption) (*ParticipatePersonsRes, error)
-		// 参标设置信息
+		//  参标设置信息
 		ParticipateSetUpInfo(ctx context.Context, in *ParticipateSetUpInfoReq, opts ...grpc.CallOption) (*ParticipateSetUpInfoRes, error)
-		// 项目参标 终止参标 划转等动作
+		//  项目参标 终止参标 划转等动作
 		ParticipateAction(ctx context.Context, in *ParticipateActionReq, opts ...grpc.CallOption) (*ParticipateActionRes, error)
-		// 我的参标项目列表|企业参标项目列表
+		//  我的参标项目列表|企业参标项目列表
 		ParticipateList(ctx context.Context, in *ParticipateListReq, opts ...grpc.CallOption) (*ParticipateListRes, error)
 		// 推送参标统计
 		PushStatistics(ctx context.Context, in *StatisticsListReq, opts ...grpc.CallOption) (*PushStatisticsDataRes, error)
@@ -116,55 +117,55 @@ func (m *defaultBxCore) SearchLimit(ctx context.Context, in *SearchLimitReq, opt
 	return client.SearchLimit(ctx, in, opts...)
 }
 
-// 列表数据参标信息接口
+//  列表数据参标信息接口
 func (m *defaultBxCore) ParticipateShow(ctx context.Context, in *ParticipateShowReq, opts ...grpc.CallOption) (*ParticipateShowRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipateShow(ctx, in, opts...)
 }
 
-// 详情页参标信息接口
+//  详情页参标信息接口
 func (m *defaultBxCore) ParticipateInfo(ctx context.Context, in *ParticipateInfoReq, opts ...grpc.CallOption) (*ParticipateInfoRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipateInfo(ctx, in, opts...)
 }
 
-// 投标状态更新
+//   投标状态更新
 func (m *defaultBxCore) UpdateBidStatus(ctx context.Context, in *UpdateBidStatusReq, opts ...grpc.CallOption) (*UpdateBidStatusRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.UpdateBidStatus(ctx, in, opts...)
 }
 
-// 获取投标状态信息
+//  获取投标状态信息
 func (m *defaultBxCore) ParticipateContent(ctx context.Context, in *ParticipateContentReq, opts ...grpc.CallOption) (*ParticipateContentRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipateContent(ctx, in, opts...)
 }
 
-// 参标操作记录
+//  参标操作记录
 func (m *defaultBxCore) ParticipateRecords(ctx context.Context, in *ParticipateRecordsReq, opts ...grpc.CallOption) (*ParticipateRecordsRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipateRecords(ctx, in, opts...)
 }
 
-// 当前部门/企业下参标人员信息
+//  当前部门/企业下参标人员信息
 func (m *defaultBxCore) ParticipatePersons(ctx context.Context, in *ParticipatePersonsReq, opts ...grpc.CallOption) (*ParticipatePersonsRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipatePersons(ctx, in, opts...)
 }
 
-// 参标设置信息
+//  参标设置信息
 func (m *defaultBxCore) ParticipateSetUpInfo(ctx context.Context, in *ParticipateSetUpInfoReq, opts ...grpc.CallOption) (*ParticipateSetUpInfoRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipateSetUpInfo(ctx, in, opts...)
 }
 
-// 项目参标 终止参标 划转等动作
+//  项目参标 终止参标 划转等动作
 func (m *defaultBxCore) ParticipateAction(ctx context.Context, in *ParticipateActionReq, opts ...grpc.CallOption) (*ParticipateActionRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipateAction(ctx, in, opts...)
 }
 
-// 我的参标项目列表|企业参标项目列表
+//  我的参标项目列表|企业参标项目列表
 func (m *defaultBxCore) ParticipateList(ctx context.Context, in *ParticipateListReq, opts ...grpc.CallOption) (*ParticipateListRes, error) {
 	client := bxcore.NewBxCoreClient(m.cli.Conn())
 	return client.ParticipateList(ctx, in, opts...)

+ 21 - 5
jyBXCore/rpc/entity/search.go

@@ -4,6 +4,7 @@ import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
+	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
 	"encoding/json"
 	"fmt"
 	IC "jyBXCore/rpc/init"
@@ -17,8 +18,10 @@ import (
 )
 
 var (
-	SearchCacheKey   = "searchDataCache_%d_%s_%s_%s"
-	SearchCacheCount = "searchCountCache_%d_%s_%s_%s"
+	SearchCacheKey          = "searchDataCache_%d_%s_%s_%s"
+	SearchCacheNoLoginKey   = "searchDataCacheNoLogin_%d_%s_%s_%s"
+	SearchCacheCount        = "searchCountCache_%d_%s_%s_%s"
+	SearchCacheCountNoLogin = "searchCountCacheNoLogin_%d_%s_%s_%s"
 )
 
 type KeyWordsSearch struct{}
@@ -44,9 +47,16 @@ func (kws *KeyWordsSearch) GetBidSearchListByCache(in *bxcore.SearchReq) (list [
 	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), 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), in.Platform)
+		if in.UserId == "" {
+			// 未登录用户查的不是一个库 缓存也分开
+			//缓存数据总量 - 当前平台
+			redisCountKey = fmt.Sprintf(SearchCacheCountNoLogin, in.SearchGroup, MC.If(in.IsPay, "v", "f").(string), MC.If(in.BidField != "", in.BidField, "n").(string), in.Platform)
+			//缓存数据: SearchGroup-全部;招标信息;超前项目信息;kws.PageNum-当前页 免费用户 or 付费用户
+			redisDataKey = fmt.Sprintf(SearchCacheNoLoginKey, 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))
 		sCache, err := redis.GetNewBytes(util.RedisNameNew, redisDataKey)
 		log.Println("-------------------------redisDataKey--------------------------------:", redisDataKey)
 		if err == nil {
@@ -81,6 +91,7 @@ func (kws *KeyWordsSearch) GetBidSearchListByCache(in *bxcore.SearchReq) (list [
 	if len(l) > 0 {
 		total = c
 		limitCount := int64(util.SearchPageSize * MC.If(in.IsPay, util.SearchMaxPageNum_PAYED, util.SearchMaxPageNum).(int))
+		log.Println(in.IsPay, limitCount, "调试日志")
 		count = c
 		if count > limitCount {
 			count = limitCount
@@ -162,8 +173,13 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
 	accountId, _ := strconv.ParseInt(in.AccountId, 10, 64)
 	positionType, _ := strconv.ParseInt(in.PositionType, 10, 64)
 	positionId, _ := strconv.ParseInt(in.PositionId, 10, 64)
-	//判断用户身份
-	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.MgoUserId, baseUserId, accountId, in.EntId, positionType, positionId)
+	userInfo := &pb.CheckResp{}
+	if in.UserId != "" {
+		//判断用户身份
+		userInfo = IC.Middleground.PowerCheckCenter.Check(in.AppId, in.MgoUserId, baseUserId, accountId, in.EntId, positionType, positionId)
+	} else {
+		userInfo = &pb.CheckResp{Free: &pb.Free{IsFree: true}}
+	}
 	//是否是付费用户
 	in.IsPay = !userInfo.Free.IsFree
 	//默认搜索范围

+ 7 - 2
jyBXCore/rpc/etc/bxcore.yaml

@@ -12,6 +12,7 @@ LabelUrl:
   SType: /list/stype/%s.html
   Industry: /list/industry/%s.html
 DefaultSearchCacheTime: 24
+DefaultSearchCacheNoLoginTime: 24 # 未登录空搜索缓存时间
 LimitSearchText:
   Flag: true
   Count: 40
@@ -45,9 +46,13 @@ ContextOldVipLimit: 1664553600
 Middleground:
   Etcd:
     Hosts:
-      - 192.168.3.206:2379
+      - 127.0.0.1:2379
   PowerCheckCenterKey: powercheck.rpc #权益校验中台
   UserCenterKey: usercenter.rpc #用户中台rpc
   ResourceCenterKey: resource.rpc #资源中台rpc
 ResourceCode: "cb_zy_code"
-SearchConcurrency: 20
+SearchConcurrency: 20
+NoLoginSearch: # 未登录搜索配置
+  Switch: true # 是否打开并发限制
+  ExecutionNum: 5 # 执行池
+  Wait: 2 # 等待池

+ 7 - 1
jyBXCore/rpc/etc/db.yaml

@@ -35,4 +35,10 @@ mongo:
         collection: bidding
         collectionChange: bidding_back
         userName: jyDevGroup
-        password: jy@DevGroup
+        password: jy@DevGroup
+esNoLogin:
+    addr: http://192.168.3.241:9205,http://192.168.3.149:9200
+    size: 50
+    version: v7
+    userName: ""
+    password: ""

+ 7 - 0
jyBXCore/rpc/init/db.go

@@ -19,6 +19,7 @@ var (
 	BaseMysql  *mysql.Mysql
 	Mgo        mongodb.MongodbSim
 	MgoBidding mongodb.MongodbSim //标讯详情等(第一版没用)
+	NoLoginEs  Es
 )
 
 func MongoDBInit(em *entity.Mongo) {
@@ -90,3 +91,9 @@ func EsInit(es *entity.EsStruct) {
 		NewEs(es.Version, es.Addr, es.Size, es.UserName, es.Password)
 	}
 }
+func NoLoginEsInit(es *entity.EsStruct) {
+	if es.Addr != "" {
+		log.Println("--初始化 nologin  elasticsearch--")
+		NoLoginEs = NewEs(es.Version, es.Addr, es.Size, es.UserName, es.Password)
+	}
+}

+ 35 - 0
jyBXCore/rpc/init/init.go

@@ -1,10 +1,12 @@
 package init
 
 import (
+	"context"
 	"flag"
 	"fmt"
 	"jyBXCore/entity"
 	"jyBXCore/rpc/internal/config"
+	"time"
 
 	"app.yhyue.com/moapp/jypkg/middleground"
 	_ "github.com/go-sql-driver/mysql"
@@ -21,8 +23,39 @@ var (
 	SearchLimitKey = "jy_limitSearchText_new" // 全文或附件搜索限制
 	Middleground   *middleground.Middleground
 	Search_Thread  chan bool
+	ReqLimitInit   *ReqLimit
 )
 
+type ReqLimit struct {
+	DoPool   chan struct{}
+	WaitPool chan struct{}
+}
+
+// -2 等待池已满
+// -1 超时
+// 1:可以执行查询
+func (r *ReqLimit) Limit(ctx context.Context) int {
+	ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
+	defer cancel()
+	select {
+	case <-r.WaitPool:
+		defer func() {
+			r.WaitPool <- struct{}{}
+		}()
+		select {
+		case <-r.DoPool:
+			return 1
+		case <-ctx.Done(): //超时
+			return -1
+		}
+	default:
+		return -2
+	}
+}
+
+func (r *ReqLimit) Release() {
+	r.DoPool <- struct{}{}
+}
 func init() {
 	//基本配置
 	conf.MustLoad(*configFile, &C)
@@ -36,7 +69,9 @@ func init() {
 	RedisInit(&DB.Redis)
 	//初始es
 	EsInit(&DB.Es)
+	NoLoginEsInit(&DB.EsNoLogin)
 	Search_Thread = make(chan bool, C.SearchConcurrency)
+	NoLoginPoolInit(C.NoLoginSearch.Switch, C.NoLoginSearch.ExecutionNum, C.NoLoginSearch.Wait)
 	//初始化标签
 	LabelInit()
 	//

+ 24 - 0
jyBXCore/rpc/init/pool.go

@@ -0,0 +1,24 @@
+package init
+
+import "log"
+
+func NoLoginPoolInit(poolSwitch bool, do, wait int) {
+	if poolSwitch {
+		//创建执行池 等待池
+		doPool := make(chan struct{}, do)
+		for i := 0; i < do; i++ {
+			doPool <- struct{}{}
+		}
+		waitPool := make(chan struct{}, wait)
+		for i := 0; i < wait; i++ {
+			waitPool <- struct{}{}
+		}
+		ReqLimitInit = &ReqLimit{
+			DoPool:   doPool,
+			WaitPool: waitPool,
+		}
+	} else {
+		log.Println("未登录搜索限制未打开")
+	}
+
+}

+ 10 - 4
jyBXCore/rpc/internal/config/config.go

@@ -54,11 +54,17 @@ type Config struct {
 	}
 	ResourceCode      string
 	SearchConcurrency int64
+	NoLoginSearch     struct {
+		Switch       bool
+		ExecutionNum int
+		Wait         int
+	}
 }
 
 type Db struct {
-	Mysql entity.Mysql      `json:"mysql"`
-	Redis entity.RedisStuct `json:"redis"`
-	Es    entity.EsStruct   `json:"es"`
-	Mongo entity.Mongo      `json:"mongo"`
+	Mysql     entity.Mysql      `json:"mysql"`
+	Redis     entity.RedisStuct `json:"redis"`
+	Es        entity.EsStruct   `json:"es"`
+	Mongo     entity.Mongo      `json:"mongo"`
+	EsNoLogin entity.EsStruct   `json:"esNoLogin"`
 }

+ 26 - 1
jyBXCore/rpc/internal/logic/getsearchlistlogic.go

@@ -41,6 +41,32 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 	}
 	//初始化搜索对象
 	ks := entity.NewKeyWordsSearch()
+	// 未登录用户只允许翻页和筛选搜索范围 其他参数无效
+	if in.UserId == "" {
+		in = &bxcore.SearchReq{
+			AppId:      in.AppId,
+			PageNum:    in.PageNum,
+			PageSize:   in.PageSize,
+			SelectType: in.SelectType,
+			KeyWords:   in.KeyWords,
+			Platform:   in.Platform,
+			UserType:   in.UserType,
+		}
+		// 搜索范围只允许筛选 标题和正文 其他的过滤掉
+		var selectType []string
+		selectTypeSplit := strings.Split(in.SelectType, ",")
+		// 未登录用户只能搜标题和正文
+		for i := 0; i < len(selectTypeSplit); i++ {
+			if selectTypeSplit[i] == "title" || selectTypeSplit[i] == "content" {
+				selectType = append(selectType, selectTypeSplit[i])
+			}
+		}
+		if len(selectType) == 0 {
+			selectType = []string{"title", "content"}
+		}
+		//
+		in.SelectType = strings.Join(selectType, ",")
+	}
 	//处理搜索条件
 	heightWords := ks.SearchParamsHandle(in)
 	if in.PageNum < 0 && in.PageSize < 0 {
@@ -83,7 +109,6 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 			in.Subtype = "招标预告,招标公告,招标结果,招标信用信息" //"拟建,招标预告,招标公告,招标结果,招标信用信息"
 		}
 	}
-
 	t := time.Now()
 	//招标信息有效查询
 	res.IsLimit = 1

+ 10 - 10
jyBXCore/rpc/internal/server/bxcoreserver.go

@@ -1,4 +1,4 @@
-// Code generated by goctl. DO NOT EDIT.
+// Code generated by goctl. DO NOT EDIT!
 // Source: bxcore.proto
 
 package server
@@ -34,55 +34,55 @@ func (s *BxCoreServer) SearchLimit(ctx context.Context, in *bxcore.SearchLimitRe
 	return l.SearchLimit(in)
 }
 
-// 列表数据参标信息接口
+//  列表数据参标信息接口
 func (s *BxCoreServer) ParticipateShow(ctx context.Context, in *bxcore.ParticipateShowReq) (*bxcore.ParticipateShowRes, error) {
 	l := logic.NewParticipateShowLogic(ctx, s.svcCtx)
 	return l.ParticipateShow(in)
 }
 
-// 详情页参标信息接口
+//  详情页参标信息接口
 func (s *BxCoreServer) ParticipateInfo(ctx context.Context, in *bxcore.ParticipateInfoReq) (*bxcore.ParticipateInfoRes, error) {
 	l := logic.NewParticipateInfoLogic(ctx, s.svcCtx)
 	return l.ParticipateInfo(in)
 }
 
-// 投标状态更新
+//   投标状态更新
 func (s *BxCoreServer) UpdateBidStatus(ctx context.Context, in *bxcore.UpdateBidStatusReq) (*bxcore.UpdateBidStatusRes, error) {
 	l := logic.NewUpdateBidStatusLogic(ctx, s.svcCtx)
 	return l.UpdateBidStatus(in)
 }
 
-// 获取投标状态信息
+//  获取投标状态信息
 func (s *BxCoreServer) ParticipateContent(ctx context.Context, in *bxcore.ParticipateContentReq) (*bxcore.ParticipateContentRes, error) {
 	l := logic.NewParticipateContentLogic(ctx, s.svcCtx)
 	return l.ParticipateContent(in)
 }
 
-// 参标操作记录
+//  参标操作记录
 func (s *BxCoreServer) ParticipateRecords(ctx context.Context, in *bxcore.ParticipateRecordsReq) (*bxcore.ParticipateRecordsRes, error) {
 	l := logic.NewParticipateRecordsLogic(ctx, s.svcCtx)
 	return l.ParticipateRecords(in)
 }
 
-// 当前部门/企业下参标人员信息
+//  当前部门/企业下参标人员信息
 func (s *BxCoreServer) ParticipatePersons(ctx context.Context, in *bxcore.ParticipatePersonsReq) (*bxcore.ParticipatePersonsRes, error) {
 	l := logic.NewParticipatePersonsLogic(ctx, s.svcCtx)
 	return l.ParticipatePersons(in)
 }
 
-// 参标设置信息
+//  参标设置信息
 func (s *BxCoreServer) ParticipateSetUpInfo(ctx context.Context, in *bxcore.ParticipateSetUpInfoReq) (*bxcore.ParticipateSetUpInfoRes, error) {
 	l := logic.NewParticipateSetUpInfoLogic(ctx, s.svcCtx)
 	return l.ParticipateSetUpInfo(in)
 }
 
-// 项目参标 终止参标 划转等动作
+//  项目参标 终止参标 划转等动作
 func (s *BxCoreServer) ParticipateAction(ctx context.Context, in *bxcore.ParticipateActionReq) (*bxcore.ParticipateActionRes, error) {
 	l := logic.NewParticipateActionLogic(ctx, s.svcCtx)
 	return l.ParticipateAction(in)
 }
 
-// 我的参标项目列表|企业参标项目列表
+//  我的参标项目列表|企业参标项目列表
 func (s *BxCoreServer) ParticipateList(ctx context.Context, in *bxcore.ParticipateListReq) (*bxcore.ParticipateListRes, error) {
 	l := logic.NewParticipateListLogic(ctx, s.svcCtx)
 	return l.ParticipateList(in)

+ 9 - 2
jyBXCore/rpc/model/es/es.go

@@ -2,6 +2,7 @@ package es
 
 import (
 	"fmt"
+	IC "jyBXCore/rpc/init"
 	"strconv"
 	"strings"
 
@@ -24,6 +25,8 @@ const (
 	HL                      = `"highlight": {"pre_tags": [""],"post_tags": [""],"fields": {%s}}`
 	INDEX                   = "bidding"
 	TYPE                    = "bidding"
+	INDEXNoLogin            = "bidding_year"
+	TYPENoLogin             = "bidding_year"
 	BidSearchSort           = `{"dataweight":-1,"publishtime":-1}`
 	BidSearchFieldBase      = `"_id","title","publishtime","dataweight","toptype","subtype","type","area","city","s_subscopeclass","bidamount","budget","buyerclass","spidercode","site","buyer","winner","bidopentime"` //搜索列表基础字段
 	BidSearchFieldOfVip     = BidSearchFieldBase + `,"buyertel","buyerperson","agency","agencytel","agencyperson","s_winner","winnertel","winnerperson","signendtime","bidendtime","projectinfo","entidlist"`            //付费列表字段
@@ -61,7 +64,7 @@ type SearchByES struct {
 }
 
 // GetAllByNgramWithCount  获取es查询结果及总数量
-func (e *SearchByES) GetAllByNgramWithCount() (int64, *[]map[string]interface{}) {
+func (e *SearchByES) GetAllByNgramWithCount(isLogin bool) (int64, *[]map[string]interface{}) {
 	if e.Query != "" {
 		queryStr := e.Query
 		if e.HighLight {
@@ -81,7 +84,11 @@ func (e *SearchByES) GetAllByNgramWithCount() (int64, *[]map[string]interface{})
 			queryStr = queryStr[:len(queryStr)-1] + `,"from":` + strconv.Itoa(e.Start) + `,"size":` + strconv.Itoa(e.Limit) + "}"
 		}
 		log.Println("queryStr:", queryStr)
-		return elastic.GetWithCount(e.Index, e.IType, e.Query, queryStr)
+		if isLogin {
+			return elastic.GetWithCount(e.Index, e.IType, e.Query, queryStr)
+		} else {
+			return IC.NoLoginEs.GetWithCount(e.Index, e.IType, e.Query, queryStr)
+		}
 	} else {
 		return 0, nil
 	}

+ 20 - 4
jyBXCore/rpc/service/search.go

@@ -6,6 +6,7 @@ import (
 	elastic "app.yhyue.com/moapp/jybase/es"
 	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
 	userPb "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+	"context"
 	"fmt"
 	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/model/es"
@@ -42,8 +43,8 @@ func GetBidSearchData(in *bxcore.SearchReq, isCache bool) (count int64, list []*
 			fields = fields + es.BidSearchFieldFile
 		}
 		biddingSearch := es.SearchByES{
-			Index:      es.INDEX,
-			IType:      es.TYPE,
+			Index:      MC.If(in.UserId == "", es.INDEXNoLogin, es.INDEX).(string),
+			IType:      MC.If(in.UserId == "", es.TYPENoLogin, es.TYPE).(string),
 			Query:      es.GetSearchQuery(in, es.GetBidSearchQuery(in)),
 			FindFields: MC.If(isCache, "title", "detail").(string),
 			Order:      es.BidSearchSort,
@@ -54,7 +55,23 @@ func GetBidSearchData(in *bxcore.SearchReq, isCache bool) (count int64, list []*
 			HighLight:  MC.If(strings.Contains(in.SelectType, "detail"), true, false).(bool), //是否高亮正文
 		}
 		var repl *[]map[string]interface{}
-		count, repl = biddingSearch.GetAllByNgramWithCount()
+		if in.UserId != "" {
+			count, repl = biddingSearch.GetAllByNgramWithCount(true)
+		} else {
+			if IC.C.NoLoginSearch.Switch {
+				if flag := IC.ReqLimitInit.Limit(context.Background()); flag == 1 {
+					defer IC.ReqLimitInit.Release()
+				} else {
+					if flag == -2 {
+						log.Println("等待队列已满")
+					} else if flag == -1 {
+						log.Println("等待超时")
+					}
+					return 0, nil
+				}
+			}
+			count, repl = biddingSearch.GetAllByNgramWithCount(false)
+		}
 		if repl != nil && *repl != nil && len(*repl) > 0 {
 			//格式化查询结果
 			list = util.SearchListFormat(in.UserId, in.Industry, repl, strings.Contains(in.SelectType, "detail"))
@@ -65,7 +82,6 @@ func GetBidSearchData(in *bxcore.SearchReq, isCache bool) (count int64, list []*
 	}
 	return
 }
-
 func EntSearch(searchCode string) ([]*bxcore.Search, int64) {
 	data := make([]*bxcore.Search, 0, 0)
 	count := int64(0)

+ 13 - 6
jyBXCore/rpc/type/bxcore/bxcore.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.28.1
-// 	protoc        v3.15.1
+// 	protoc-gen-go v1.28.0
+// 	protoc        v3.19.4
 // source: bxcore.proto
 
 package bxcore
@@ -840,6 +840,7 @@ func (x *SearchList) GetWinner() string {
 	return ""
 }
 
+//
 type WinnerInfo struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -911,6 +912,7 @@ func (x *WinnerInfo) GetWinnerId() string {
 	return ""
 }
 
+//
 type PInfo struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1006,6 +1008,7 @@ func (x *PInfo) GetApproveNumber() string {
 	return ""
 }
 
+//
 type SearchLimitReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1101,6 +1104,7 @@ func (x *SearchLimitReq) GetSearchType() string {
 	return ""
 }
 
+//
 type SearchLimitResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -2917,6 +2921,7 @@ func (x *ParticipatePersonsRes) GetData() []*ParticipatePerson {
 	return nil
 }
 
+//
 type ParticipateSetUpInfoReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -3139,7 +3144,7 @@ func (x *BidTypeReq) GetContent() []string {
 	return nil
 }
 
-// 消息提醒设置:
+//消息提醒设置:
 type RemindRuleReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -3203,7 +3208,7 @@ func (x *RemindRuleReq) GetNode() string {
 	return ""
 }
 
-// 设置信息内容
+//设置信息内容
 type ParticipateSetUpInfo struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -3283,7 +3288,7 @@ func (x *ParticipateSetUpInfo) GetIsShow() int64 {
 	return 0
 }
 
-// 设置信息范围内容
+//设置信息范围内容
 type ParticipateSetUpInfoRes struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -3347,6 +3352,7 @@ func (x *ParticipateSetUpInfoRes) GetData() *ParticipateSetUpInfo {
 	return nil
 }
 
+//
 type ParticipateActionReq struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -3514,6 +3520,7 @@ func (x *ParticipateActionReq) GetPhone() string {
 	return ""
 }
 
+//
 type ParticipateActionRes struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -3808,7 +3815,7 @@ func (x *ParticipateListReq) GetPhone() string {
 	return ""
 }
 
-// 参标列表
+//参标列表
 type ParticipateList struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache

+ 1 - 1
jyBXCore/rpc/type/bxcore/bxcore_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.15.1
+// - protoc             v3.19.4
 // source: bxcore.proto
 
 package bxcore