Browse Source

Merge branch 'dev1.0.0' of https://app.yhyue.com/moapp/jyInfo into dev1.0.0

duxin 3 years ago
parent
commit
6ce0d95bb0

BIN
rpc/consumer/consumer.exe


+ 6 - 7
rpc/consumer/internal/logic/supplyinfosearchlogic.go

@@ -1,14 +1,14 @@
 package logic
 
 import (
-	IC "app.yhyue.com/moapp/jyInfo/rpc/consumer/init"
-	"app.yhyue.com/moapp/jyInfo/rpc/model/es"
-	"app.yhyue.com/moapp/jyInfo/rpc/util"
 	"context"
-	"log"
 	"strconv"
 	"strings"
 
+	IC "app.yhyue.com/moapp/jyInfo/rpc/consumer/init"
+	"app.yhyue.com/moapp/jyInfo/rpc/model/es"
+	"app.yhyue.com/moapp/jyInfo/rpc/util"
+
 	se "app.yhyue.com/moapp/jybase/encrypt"
 
 	"app.yhyue.com/moapp/jyInfo/rpc/consumer/consumerinfo"
@@ -46,13 +46,12 @@ func (l *SupplyInfoSearchLogic) SupplyInfoSearch(in *consumerinfo.SupplyInfoSear
 	if strings.Contains(in.Keywords, "+") {
 		in.Keywords = strings.ReplaceAll(in.Keywords, " ", "+")
 	}
-	list, total := model.GetSupplyInfoList(in)
+	list, total := model.GetSupplyInfoList(in, true)
 	logx.Info("ttt---", total, "----", in.Keywords)
 	if total == 0 && len([]rune(in.Keywords)) > 3 {
 		if secondKWS := util.HttpEsGetWords(in.Keywords, "ik_smart", IC.C.Es.Addr); secondKWS != "" {
-			log.Println("secondKWS:", secondKWS)
 			in.Keywords = secondKWS
-			list, total = model.GetSupplyInfoList(in)
+			list, total = model.GetSupplyInfoList(in, false)
 		}
 	}
 	logx.Info("-------", total, "----", in.Keywords)

+ 6 - 8
rpc/model/es/es.go

@@ -2,7 +2,6 @@ package model
 
 import (
 	"fmt"
-	"log"
 	"strconv"
 	"strings"
 	"time"
@@ -20,15 +19,15 @@ const (
 )
 
 //获取供应信息
-func GetSupplyInfoList(in *consumerinfo.SupplyInfoSearchReq) (list *[]map[string]interface{}, total int64) {
+func GetSupplyInfoList(in *consumerinfo.SupplyInfoSearchReq, b bool) (list *[]map[string]interface{}, total int64) {
 	isHight := false
 	if in.SearchType != "" {
-		for _, v := range strings.Split(in.SearchType, ",") {
-			if v == "detail" {
-				isHight = true
-			}
+		if strings.Contains(in.SearchType, "detail") {
+			isHight = true
+		}
+		if b {
+			in.SearchType = fmt.Sprintf(`"%s"`, strings.ReplaceAll(in.SearchType, ",", "\",\""))
 		}
-		in.SearchType = fmt.Sprintf(`"%s"`, strings.ReplaceAll(in.SearchType, ",", "\",\""))
 	} else {
 		in.SearchType = `"title"`
 	}
@@ -43,7 +42,6 @@ func GetSupplyInfoList(in *consumerinfo.SupplyInfoSearchReq) (list *[]map[string
 	} else { //标题搜索
 		list = elastic.GetAllByNgram(INDEX, TYPE, qstr, ``, Search_sort, Search_field, start, pagesize, 0, false)
 	}
-	log.Println(total, "----", len(*list))
 	return
 }