Explorar o código

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

fuwencai hai 1 ano
pai
achega
5f2a5aba3b
Modificáronse 3 ficheiros con 4 adicións e 10 borrados
  1. 0 4
      jyBXCore/rpc/etc/db.yaml
  2. 1 1
      jyBXCore/rpc/model/es/es.go
  3. 3 5
      jyBXCore/rpc/service/search.go

+ 0 - 4
jyBXCore/rpc/etc/db.yaml

@@ -23,8 +23,6 @@ es:
     version: v7
     userName: ""
     password: ""
-    index: bidding
-    type: bidding
 mongo:
     main:
         dbName: qfw
@@ -44,8 +42,6 @@ esNoLogin:
     version: v7
     userName: ""
     password: ""
-    index: bidding_year
-    type: bidding_year
 esFree:
     addr: http://192.168.3.241:9205,http://192.168.3.149:9200
     size: 50

+ 1 - 1
jyBXCore/rpc/model/es/es.go

@@ -91,7 +91,7 @@ func (e *SearchByES) GetAllByNgramWithCount(loginType int) (int64, *[]map[string
 		case LoginTypePay:
 			return elastic.GetWithCount(e.Index, e.IType, e.Query, queryStr)
 		case LoginTypeFree:
-			// 免费用户
+			// 免费用户 
 			return IC.FreeEs.GetWithCount(e.Index, e.IType, e.Query, queryStr)
 		default:
 			// 未登录

+ 3 - 5
jyBXCore/rpc/service/search.go

@@ -43,6 +43,8 @@ func GetBidSearchData(in *bxcore.SearchReq, isCache bool) (count int64, list []*
 			fields = fields + es.BidSearchFieldFile
 		}
 		biddingSearch := es.SearchByES{
+			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,
@@ -56,16 +58,12 @@ func GetBidSearchData(in *bxcore.SearchReq, isCache bool) (count int64, list []*
 		// 处理免费用户index
 		if in.UserId == "" {
 			loginType = es.LoginTypeNoLogin
-			biddingSearch.Index = IC.DB.EsNoLogin.Index
-			biddingSearch.IType = IC.DB.EsNoLogin.Type
 		} else if !in.IsPay {
-			loginType = es.LoginTypeFree
 			biddingSearch.Index = IC.DB.EsFree.Index
 			biddingSearch.IType = IC.DB.EsFree.Type
+			loginType = es.LoginTypeFree
 		} else {
 			loginType = es.LoginTypePay
-			biddingSearch.Index = IC.DB.Es.Index
-			biddingSearch.IType = IC.DB.Es.Type
 		}
 		var repl *[]map[string]interface{}
 		if in.UserId != "" {