wangshan 3 жил өмнө
parent
commit
ee5ae23d1e

+ 1 - 0
jyBXCore/api/bxcore.api

@@ -26,6 +26,7 @@ type (
 		ExclusionWords string `json:"exclusionWords"`
 		FileExists     string `json:"fileExists"`
 		UserType       string `path:"userType"`
+		SecondSearch   bool   `json:"secondSearch"`
 	}
 	//
 	commonResp {

+ 2 - 1
jyBXCore/api/etc/bxcore-api.yaml

@@ -1,6 +1,7 @@
 Name: bxcore-api
 Host: 0.0.0.0
 Port: 8002
+Timeout: 5000
 Webrpcport: 8012
 Gateway:
   ServerCode: jyinfo
@@ -10,5 +11,5 @@ Core:
   Etcd:
     Hosts:
       - 127.0.0.1:2379
-    Key: bxsubscribe.rpc
+    Key: bxcore.rpc
 AppId: 10000

+ 6 - 0
jyBXCore/api/etc/logs.yaml

@@ -0,0 +1,6 @@
+Mode: file
+Path: ./logs
+Level:
+  - info
+  - error
+KeepDays: 10

+ 1 - 1
jyBXCore/api/internal/config/config.go

@@ -12,5 +12,5 @@ type Config struct {
 		ServerCode string
 		Etcd       []string
 	}
-	BxCore zrpc.RpcClientConf
+	Core zrpc.RpcClientConf
 }

+ 4 - 0
jyBXCore/api/internal/logic/searchListLogic.go

@@ -2,6 +2,7 @@ package logic
 
 import (
 	"context"
+	"jyBXCore/api/internal/util"
 	"jyBXCore/rpc/type/bxcore"
 	"net/http"
 
@@ -46,9 +47,12 @@ func (l *SearchListLogic) SearchList(req *types.SearchReq) (resp *types.CommonRe
 		ExclusionWords: req.ExclusionWords,
 		AppId:          req.AppId,
 		UserType:       req.UserType,
+		SecondSearch:   req.SecondSearch,
 		UserId:         l.r.Header.Get("userId"),
 		EntId:          l.r.Header.Get("entId"),
+		Platform:       util.CheckPlatform(l.r),
 	})
+	logx.Info("api: ", len(res.Data.List))
 	if err != nil {
 		return &types.CommonResp{
 			Err_code: res.ErrCode,

+ 1 - 1
jyBXCore/api/internal/svc/serviceContext.go

@@ -14,6 +14,6 @@ type ServiceContext struct {
 func NewServiceContext(c config.Config) *ServiceContext {
 	return &ServiceContext{
 		Config: c,
-		BxCore: bxcore.NewBxCore(zrpc.MustNewClient(c.BxCore)),
+		BxCore: bxcore.NewBxCore(zrpc.MustNewClient(c.Core)),
 	}
 }

+ 1 - 0
jyBXCore/api/internal/types/types.go

@@ -19,6 +19,7 @@ type SearchReq struct {
 	ExclusionWords string `json:"exclusionWords"`
 	FileExists     string `json:"fileExists"`
 	UserType       string `path:"userType"`
+	SecondSearch   bool   `json:"secondSearch"`
 }
 
 type CommonResp struct {

+ 39 - 0
jyBXCore/api/internal/util/util.go

@@ -0,0 +1,39 @@
+package util
+
+import (
+	"net/http"
+	"regexp"
+	"strings"
+)
+
+var mobileReg = regexp.MustCompile("(?i)(Android|Mobile|Phone)")
+
+func CheckPlatform(r *http.Request) (p string) {
+	p = "PC"
+	if CheckIsMobile(r) {
+		if CheckWxBrowser(r) {
+			p = "WX"
+		} else {
+			p = "APP"
+		}
+	}
+	return
+}
+
+//判断是否是微信访问
+func CheckWxBrowser(Request *http.Request) bool {
+	if strings.Index(Request.UserAgent(), "MicroMessenger") > -1 || strings.Index(Request.UserAgent(), "Wechat") > -1 {
+		return true
+	} else {
+		return false
+	}
+}
+
+//是否是移动端
+func CheckIsMobile(r *http.Request) bool {
+	client := r.UserAgent()
+	if mobileReg.MatchString(client) {
+		return true
+	}
+	return false
+}

+ 1 - 1
jyBXCore/rpc/bxcore.go

@@ -19,7 +19,7 @@ import (
 func main() {
 	//
 	go func() {
-		IC.InitLimitSearchText(true)
+		//IC.InitLimitSearchText(true)
 		err := endless.ListenAndServe(":"+MC.InterfaceToStr(IC.C.Webrpcport), nil, func() {})
 		if err != nil {
 			log.Println("ListenAndServe: ", err)

+ 5 - 1
jyBXCore/rpc/bxcore.proto

@@ -23,6 +23,8 @@ message SearchReq {
   string  userId = 17;
   string  entId = 18;
   string  userType = 19;//用户状态 fType:免费用户	pType:付费用户	vType:超级订阅用户	mType:大会员用户	eType:商机管理用户
+  bool  secondSearch = 20;//是否是二次搜索
+  string  platform = 21;//请求平台
 }
 
 message SearchResp {
@@ -33,9 +35,11 @@ message SearchResp {
 message SearchData {
   int64 count = 1;
   string keyWords = 2;
-  int64  status = 3;
+  int64  isLimit = 3;
   repeated string historyKeys = 4;
   repeated SearchList list = 5;
+  bool secondSearch = 6;
+  int64  totalPage = 7;
 }
 
 message  SearchList {

+ 6 - 1
jyBXCore/rpc/etc/bxcore.yaml

@@ -3,9 +3,14 @@ ListenOn: 0.0.0.0:8003
 Etcd:
   Hosts:
     - 127.0.0.1:2379
-  Key: bxsubscribe.rpc
+  Key: bxcore.rpc
 Webrpcport: 8013
 BidSearchOldUserLimit: 1626105600
+LabelUrl:
+  Area: /list/area/%s.html
+  Stype: /list/stype/%s.html
+  Industry: /list/industry/%s.html
+PCSTime: 24
 LimitSearchText:
   Flag: false
   Count: 3

+ 3 - 1
jyBXCore/rpc/init/init.go

@@ -9,7 +9,7 @@ import (
 	"jyBXCore/rpc/internal/config"
 )
 
-var configFile = flag.String("c", "etc/bxsubscribe.yaml", "the config file")
+var configFile = flag.String("c", "etc/bxcore.yaml", "the config file")
 var C config.Config
 var err error
 
@@ -47,4 +47,6 @@ func init() {
 			logx.Info(v, "--日志记录")
 		}
 	}
+	//初始化标签
+	LabelInit()
 }

+ 44 - 0
jyBXCore/rpc/init/label.go

@@ -0,0 +1,44 @@
+package init
+
+import (
+	MC "app.yhyue.com/moapp/jybase/common"
+	"fmt"
+	"strings"
+)
+
+type labelStruct struct {
+	Code        string `json:"code"`
+	Title       string `json:"title"`
+	Keywords    string `json:"keywords"`
+	Description string `json:"description"`
+	Url         string `json:"url"`
+}
+
+var LabelMap = map[string]labelStruct{}
+
+func LabelInit() {
+	labelList := MainMysql.SelectBySql(`select * from jy_label where status = ?`, 0)
+	if labelList != nil && len(*labelList) > 0 {
+		for _, v := range *labelList {
+			names := MC.ObjToString(v["name"])
+			url := ""
+			switch MC.IntAll(v["mold"]) {
+			case 1:
+				url = fmt.Sprintf(C.LabelUrl.Area, MC.ObjToString(v["code"]))
+			case 2:
+				url = fmt.Sprintf(C.LabelUrl.Industry, MC.ObjToString(v["code"]))
+			case 3:
+				url = fmt.Sprintf(C.LabelUrl.Stype, MC.ObjToString(v["code"]))
+			}
+			for _, nv := range strings.Split(names, ",") {
+				LabelMap[nv] = labelStruct{
+					Code:        MC.ObjToString(v["code"]),
+					Title:       MC.ObjToString(v["title"]),
+					Keywords:    MC.ObjToString(v["keywords"]),
+					Description: MC.ObjToString(v["description"]),
+					Url:         url,
+				}
+			}
+		}
+	}
+}

+ 0 - 136
jyBXCore/rpc/init/limitSearchText.go

@@ -1,136 +0,0 @@
-package init
-
-import (
-	MC "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
-	"app.yhyue.com/moapp/jybase/redis"
-	"fmt"
-	"net/http"
-	"time"
-)
-
-var Lst *LimitSearchText
-
-type LimitSearchText struct {
-	TimeOut    int
-	Count      int
-	UserIds    []string
-	Flag       bool
-	TotalPage  int
-	Msg        string
-	Percentage int
-}
-
-func IsSearchLimit(searchItems []string) bool {
-	for _, searchItem := range searchItems {
-		if searchItem == "detail" || searchItem == "filetext" {
-			return true
-		}
-	}
-	return false
-}
-
-//
-func InitLimitSearchText(flag bool) {
-	Lst = &C.LimitSearchText
-	if !Lst.Flag {
-		return
-	}
-	if flag {
-		Lst.Init()
-	}
-}
-func (l *LimitSearchText) Init() {
-	l.Clear()
-	for i := 0; i < Lst.Count; i++ {
-		redis.RPUSH("other", "jy_limitSearchText", 1)
-	}
-}
-func (l *LimitSearchText) Clear() {
-	redis.Del("other", "jy_limitSearchText")
-}
-
-//限制正文查询
-//return 1 正常
-//return -1 抱歉!由于系统繁忙暂时无法进行搜索,请1分钟后再试!
-//return -2 抱歉!由于系统繁忙暂时无法进行搜索,请稍后再试!
-func (l *LimitSearchText) IsLimited(r *http.Request, w http.ResponseWriter, s *httpsession.Session, isPayedUser bool) int {
-	if !l.Flag {
-		return 1
-	}
-	var llen = int(redis.LLEN("other", "jy_limitSearchText"))
-	if l.TimeOut > 0 {
-		limitFlag, isNew := l.getFlag(r, w, s)
-		if isNew {
-			if llen <= l.Count/2 {
-				timeLimit, _ := redis.Exists("other", "jy_limitSearchText_"+limitFlag)
-				if timeLimit {
-					return -1
-				}
-			}
-		}
-		redis.Put("other", "jy_limitSearchText_"+limitFlag, 1, l.TimeOut)
-	}
-	if l.Count == -2 {
-		return 1
-	} else if l.Count == -1 {
-		return -2
-	}
-	//非VIP&大会员 用户 使用并发的80%(默认)通道|| 保留一条通道给非普通用户使用
-	if !isPayedUser {
-		if llen <= l.Count*l.Percentage/100 || llen == 1 {
-			return -1
-		}
-	}
-	//
-	pollLimit := redis.LPOP("other", "jy_limitSearchText")
-	if MC.IntAll(pollLimit) <= 0 {
-		return -2
-	}
-	return 1
-}
-func (l *LimitSearchText) Limit() {
-	if !l.Flag {
-		return
-	}
-	if int(redis.LLEN("other", "jy_limitSearchText")) < l.Count {
-		redis.RPUSH("other", "jy_limitSearchText", 1)
-	}
-}
-
-func (l *LimitSearchText) getFlag(r *http.Request, w http.ResponseWriter, s *httpsession.Session) (string, bool) {
-	limitFlag, _ := s.Get("openid").(string)
-	if limitFlag == "" {
-		c, _ := r.Cookie("limitSearchTextFlag")
-		if c != nil {
-			limitFlag = c.Value
-			if limitFlag == "" {
-				limitFlag, _ = s.Get("limitSearchTextFlag").(string)
-			}
-		}
-	}
-	if limitFlag != "" {
-		return limitFlag, true
-	}
-	limitFlag = MC.GetLetterRandom(5) + fmt.Sprint(time.Now().UnixNano())
-	s.Set("limitSearchTextFlag", limitFlag)
-	c := &http.Cookie{
-		Name:     "limitSearchTextFlag",
-		Value:    limitFlag,
-		Path:     "/",
-		HttpOnly: false,
-		MaxAge:   2592000, //一个月
-	}
-	http.SetCookie(w, c)
-	return limitFlag, false
-}
-
-//
-func (l *LimitSearchText) IsCanLogin(userId string) bool {
-	for _, v := range l.UserIds {
-		if v == userId {
-			return true
-		}
-	}
-	return false
-}

+ 6 - 2
jyBXCore/rpc/internal/config/config.go

@@ -3,14 +3,18 @@ package config
 import (
 	"github.com/zeromicro/go-zero/zrpc"
 	"jyBXCore/entity"
-	IC "jyBXCore/rpc/init"
 )
 
 type Config struct {
 	zrpc.RpcServerConf
 	Webrpcport            int64
 	BidSearchOldUserLimit int64
-	LimitSearchText       IC.LimitSearchText
+	LabelUrl              struct {
+		Area     string
+		Stype    string
+		Industry string
+	}
+	PCSTime int //清除搜索列表内存缓存 间隔时间
 }
 
 type Db struct {

+ 101 - 11
jyBXCore/rpc/internal/logic/getsearchlistlogic.go

@@ -4,6 +4,8 @@ import (
 	MC "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/redis"
 	"context"
+	"encoding/json"
+	"fmt"
 	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/util"
 	"strings"
@@ -31,14 +33,19 @@ func NewGetSearchListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
 // 标讯搜索结果列表数据
 func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.SearchResp, error) {
 	defer MC.Catch()
-	res := &bxcore.SearchResp{}
+	res := &bxcore.SearchData{
+		Count: 0,
+		List:  []*bxcore.SearchList{},
+	}
 	if in.UserId != "" {
 		//历史记录
 		history_str := redis.GetStr("other", "s_"+in.UserId)
 		arrs := util.SearchHistory(history_str, in.KeyWords)
-		redis.Del("other", "s_"+in.UserId)
-		redis.Put("other", "s_"+in.UserId, strings.Join(arrs, ","), -1)
-		res.Data.HistoryKeys = arrs
+		//redis.Del("other", "s_"+in.UserId)
+		if len(arrs) > 0 {
+			redis.Put("other", "s_"+in.UserId, strings.Join(arrs, ","), -1)
+			res.HistoryKeys = arrs
+		}
 	}
 	//
 	if in.SelectType == "" {
@@ -63,13 +70,14 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 		in.City = ""
 	}
 	in.KeyWords = strings.TrimSpace(in.KeyWords)
-	searchLimit := IC.IsSearchLimit(queryItems)
+	searchLimit := true
 	in.SelectType = strings.Join(queryItems, ",")
-	b_word, s_word := "", ""
-	isLimit := 1
+	//b_word, s_word := "", ""
+	res.IsLimit = 1
 	if in.KeyWords != "" {
-		b_word, _, s_word = util.InterceptSearchKW(in.KeyWords, false, len(in.Industry) == 0)
+		_, _, in.KeyWords = util.InterceptSearchKW(in.KeyWords, false, len(in.Industry) == 0)
 	}
+	//查询数据
 	if in.KeyWords != "" || in.Industry != "" {
 		//查询数据
 		//全文检索限制
@@ -80,9 +88,91 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 			//	defer public.Lst.Limit()
 			//}
 		}
-		if isLimit == 1 {
-			util.SearchData()
+		//无限制
+		if res.IsLimit == 1 {
+			var count int64 = 0
+			var list = []*bxcore.SearchList{}
+			if !in.SecondSearch {
+				count, list = util.GetBidSearchData(in)
+			}
+			//二次搜索- 一次搜索结果少于一页数据;关键词长度大于三;第一,二页请求;搜索范围包括title;四个条件
+			if len([]rune(in.KeyWords)) > 3 && int(count) < util.SearchPageSize && in.PageNum < 3 && strings.Contains(in.SelectType, "title") {
+				if in.KeyWords = util.HttpEs(in.KeyWords, "ik_smart", IC.DB.Es.Addr); in.KeyWords != "" {
+					count, list = util.GetBidSearchData(in)
+					//最多两页数据
+					if count > util.SearchPageSize*2 {
+						count = util.SearchPageSize * 2
+					}
+					res.KeyWords = in.KeyWords
+					if in.PageNum == 1 {
+						res.SecondSearch = true
+					}
+				}
+			}
+			limitCount := MC.If(in.UserType != "fType", int64(util.SearchPageSize*util.SearchMaxPageNum_PAYED), int64(util.SearchPageSize*util.SearchMaxPageNum)).(int64)
+			if count > limitCount {
+				count = limitCount
+			}
+			res.TotalPage = MC.If(in.PageNum == 1, (count+int64(util.SearchPageSize)-1)/int64(util.SearchPageSize), res.TotalPage).(int64)
+			res.Count = count
+			res.List = list
+		}
+	} else if in.Platform == "PC" {
+		var count int64 = 0
+		var list = []*bxcore.SearchList{}
+		redisDataKey := fmt.Sprintf("PC_SearchDataCache_%s_%d", in.Platform, in.PageNum)
+		sCache, err := redis.GetNewBytes(util.RedisName, redisDataKey)
+		if err == nil {
+			redisCountKey := fmt.Sprintf("PC_SearchCountCache_%s", in.Platform)
+			count = int64(redis.GetInt(util.RedisName, redisCountKey))
+			if sCache != nil && len(*sCache) > 0 {
+				err = json.Unmarshal(*sCache, &list)
+				if err != nil {
+					return &bxcore.SearchResp{
+						ErrCode: -1,
+						ErrMsg:  "缓存数据序列化异常:" + err.Error(),
+					}, nil
+				}
+			} else {
+				pcstime := IC.C.PCSTime * 60 * 60
+				//缓存数据
+				_in := &bxcore.SearchReq{
+					PageNum:  in.PageNum,
+					PageSize: in.PageSize,
+				}
+				count, list = util.SearchCahcheData(_in)
+				limitCount := int64(util.SearchPageSize * util.SearchMaxPageNum)
+				if count > limitCount {
+					count = limitCount
+				}
+				if len(list) > 0 {
+					redis.Put(util.RedisName, redisCountKey, count, pcstime)
+					b, err := json.Marshal(list)
+					if err == nil {
+						redis.PutBytes(util.RedisName, redisDataKey, &b, pcstime)
+					} else {
+						return &bxcore.SearchResp{
+							ErrCode: -1,
+							ErrMsg:  "缓存数据 转化异常:" + err.Error(),
+						}, nil
+					}
+				}
+			}
+			//是否收藏
+			util.MakeCollection(in.UserId, list)
+			res.TotalPage = MC.If(in.PageNum == 1, (count+int64(util.SearchPageSize)-1)/int64(util.SearchPageSize), res.TotalPage).(int64)
+			res.Count = count
+			res.List = list
+		} else {
+			return &bxcore.SearchResp{
+				ErrCode: -1,
+				ErrMsg:  "查询redis缓存异常:" + err.Error(),
+			}, nil
 		}
 	}
-	return &bxcore.SearchResp{}, nil
+	return &bxcore.SearchResp{
+		Data:    res,
+		ErrMsg:  "",
+		ErrCode: 0,
+	}, nil
 }

+ 88 - 48
jyBXCore/rpc/type/bxcore/bxcore.pb.go

@@ -48,7 +48,9 @@ type SearchReq struct {
 	FileExists     string `protobuf:"bytes,16,opt,name=fileExists,proto3" json:"fileExists,omitempty"`         //是否有附件
 	UserId         string `protobuf:"bytes,17,opt,name=userId,proto3" json:"userId,omitempty"`
 	EntId          string `protobuf:"bytes,18,opt,name=entId,proto3" json:"entId,omitempty"`
-	UserType       string `protobuf:"bytes,19,opt,name=userType,proto3" json:"userType,omitempty"` //用户状态 fType:免费用户	pType:付费用户	vType:超级订阅用户	mType:大会员用户	eType:商机管理用户
+	UserType       string `protobuf:"bytes,19,opt,name=userType,proto3" json:"userType,omitempty"`          //用户状态 fType:免费用户	pType:付费用户	vType:超级订阅用户	mType:大会员用户	eType:商机管理用户
+	SecondSearch   bool   `protobuf:"varint,20,opt,name=secondSearch,proto3" json:"secondSearch,omitempty"` //是否是二次搜索
+	Platform       string `protobuf:"bytes,21,opt,name=platform,proto3" json:"platform,omitempty"`          //请求平台
 }
 
 func (x *SearchReq) Reset() {
@@ -216,6 +218,20 @@ func (x *SearchReq) GetUserType() string {
 	return ""
 }
 
+func (x *SearchReq) GetSecondSearch() bool {
+	if x != nil {
+		return x.SecondSearch
+	}
+	return false
+}
+
+func (x *SearchReq) GetPlatform() string {
+	if x != nil {
+		return x.Platform
+	}
+	return ""
+}
+
 type SearchResp struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -284,11 +300,13 @@ type SearchData struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Count       int64         `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
-	KeyWords    string        `protobuf:"bytes,2,opt,name=keyWords,proto3" json:"keyWords,omitempty"`
-	Status      int64         `protobuf:"varint,3,opt,name=status,proto3" json:"status,omitempty"`
-	HistoryKeys []string      `protobuf:"bytes,4,rep,name=historyKeys,proto3" json:"historyKeys,omitempty"`
-	List        []*SearchList `protobuf:"bytes,5,rep,name=list,proto3" json:"list,omitempty"`
+	Count        int64         `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"`
+	KeyWords     string        `protobuf:"bytes,2,opt,name=keyWords,proto3" json:"keyWords,omitempty"`
+	IsLimit      int64         `protobuf:"varint,3,opt,name=isLimit,proto3" json:"isLimit,omitempty"`
+	HistoryKeys  []string      `protobuf:"bytes,4,rep,name=historyKeys,proto3" json:"historyKeys,omitempty"`
+	List         []*SearchList `protobuf:"bytes,5,rep,name=list,proto3" json:"list,omitempty"`
+	SecondSearch bool          `protobuf:"varint,6,opt,name=secondSearch,proto3" json:"secondSearch,omitempty"`
+	TotalPage    int64         `protobuf:"varint,7,opt,name=totalPage,proto3" json:"totalPage,omitempty"`
 }
 
 func (x *SearchData) Reset() {
@@ -337,9 +355,9 @@ func (x *SearchData) GetKeyWords() string {
 	return ""
 }
 
-func (x *SearchData) GetStatus() int64 {
+func (x *SearchData) GetIsLimit() int64 {
 	if x != nil {
-		return x.Status
+		return x.IsLimit
 	}
 	return 0
 }
@@ -358,6 +376,20 @@ func (x *SearchData) GetList() []*SearchList {
 	return nil
 }
 
+func (x *SearchData) GetSecondSearch() bool {
+	if x != nil {
+		return x.SecondSearch
+	}
+	return false
+}
+
+func (x *SearchData) GetTotalPage() int64 {
+	if x != nil {
+		return x.TotalPage
+	}
+	return 0
+}
+
 type SearchList struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -513,7 +545,7 @@ var File_bxcore_proto protoreflect.FileDescriptor
 
 var file_bxcore_proto_rawDesc = []byte{
 	0x0a, 0x0c, 0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
-	0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x22, 0x9d, 0x04, 0x0a, 0x09, 0x53, 0x65, 0x61, 0x72, 0x63,
+	0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x22, 0xdd, 0x04, 0x0a, 0x09, 0x53, 0x65, 0x61, 0x72, 0x63,
 	0x68, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20,
 	0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61,
 	0x67, 0x65, 0x4e, 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x67,
@@ -547,54 +579,62 @@ var file_bxcore_proto_rawDesc = []byte{
 	0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x12, 0x20,
 	0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73,
 	0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73,
-	0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x22, 0x68, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
+	0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64,
+	0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x65,
+	0x63, 0x6f, 0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c,
+	0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c,
+	0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x22, 0x68, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
 	0x52, 0x65, 0x73, 0x70, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x72, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65,
 	0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
 	0x17, 0x0a, 0x07, 0x65, 0x72, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
 	0x52, 0x06, 0x65, 0x72, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
 	0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x2e,
 	0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
-	0x22, 0xa0, 0x01, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12,
+	0x22, 0xe4, 0x01, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x44, 0x61, 0x74, 0x61, 0x12,
 	0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
 	0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64,
 	0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x57, 0x6f, 0x72, 0x64,
-	0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x68, 0x69, 0x73,
-	0x74, 0x6f, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b,
-	0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x26, 0x0a, 0x04, 0x6c,
-	0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x78, 0x63, 0x6f,
-	0x72, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6c,
-	0x69, 0x73, 0x74, 0x22, 0x88, 0x03, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4c, 0x69,
-	0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
-	0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
-	0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x72, 0x65, 0x61, 0x55, 0x72,
-	0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x72, 0x65, 0x61, 0x55, 0x72, 0x6c,
-	0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x79, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x04,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x75, 0x79, 0x65, 0x72, 0x43, 0x6c, 0x61, 0x73, 0x73,
-	0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
-	0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x18, 0x06,
-	0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08,
-	0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
-	0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x6e, 0x64, 0x75,
-	0x73, 0x74, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x69,
-	0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x75,
-	0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52,
-	0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07,
-	0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
-	0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70,
-	0x65, 0x55, 0x72, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x74,
-	0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x45, 0x78,
-	0x69, 0x73, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65,
-	0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18,
-	0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b,
-	0x69, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28,
-	0x08, 0x52, 0x0b, 0x69, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x32, 0x40,
-	0x0a, 0x06, 0x42, 0x78, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x36, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x53,
-	0x65, 0x61, 0x72, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x11, 0x2e, 0x62, 0x78, 0x63, 0x6f,
-	0x72, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x62,
-	0x78, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70,
-	0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x33,
+	0x73, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x03, 0x52, 0x07, 0x69, 0x73, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x68,
+	0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09,
+	0x52, 0x0b, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x26, 0x0a,
+	0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62, 0x78,
+	0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52,
+	0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x53,
+	0x65, 0x61, 0x72, 0x63, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x65, 0x63,
+	0x6f, 0x6e, 0x64, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x6f, 0x74,
+	0x61, 0x6c, 0x50, 0x61, 0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f,
+	0x74, 0x61, 0x6c, 0x50, 0x61, 0x67, 0x65, 0x22, 0x88, 0x03, 0x0a, 0x0a, 0x53, 0x65, 0x61, 0x72,
+	0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x65, 0x61, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x65, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x72,
+	0x65, 0x61, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x72, 0x65,
+	0x61, 0x55, 0x72, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x62, 0x75, 0x79, 0x65, 0x72, 0x43, 0x6c, 0x61,
+	0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x75, 0x79, 0x65, 0x72, 0x43,
+	0x6c, 0x61, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x74, 0x61,
+	0x69, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c,
+	0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b,
+	0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x0b, 0x69, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x55, 0x72, 0x6c, 0x12, 0x20,
+	0x0a, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x0b, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65,
+	0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75,
+	0x62, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+	0x73, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x55, 0x72, 0x6c, 0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69,
+	0x6c, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a,
+	0x66, 0x69, 0x6c, 0x65, 0x45, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69,
+	0x74, 0x6c, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65,
+	0x12, 0x20, 0x0a, 0x0b, 0x69, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x65, 0x64, 0x18,
+	0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
+	0x65, 0x64, 0x32, 0x40, 0x0a, 0x06, 0x42, 0x78, 0x43, 0x6f, 0x72, 0x65, 0x12, 0x36, 0x0a, 0x0d,
+	0x47, 0x65, 0x74, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x11, 0x2e,
+	0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71,
+	0x1a, 0x12, 0x2e, 0x62, 0x78, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
+	0x52, 0x65, 0x73, 0x70, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x62, 0x78, 0x63, 0x6f, 0x72, 0x65,
+	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (

+ 208 - 117
jyBXCore/rpc/util/search.go

@@ -2,11 +2,15 @@ package util
 
 import (
 	MC "app.yhyue.com/moapp/jybase/common"
+	ME "app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/esv1"
 	"crypto/rand"
 	"encoding/json"
 	"fmt"
+	"github.com/zeromicro/go-zero/core/logx"
 	"io/ioutil"
+	IC "jyBXCore/rpc/init"
+	"jyBXCore/rpc/type/bxcore"
 	"log"
 	"math/big"
 	"net/http"
@@ -18,6 +22,7 @@ import (
 	"unicode"
 )
 
+var ClearHtml = regexp.MustCompile("<[^>]*>")
 var MatchSpace = regexp.MustCompile("\\s+")
 var filterReg_3 = regexp.MustCompile("(项目|公告|公示)$")
 var filterReg_2 = regexp.MustCompile("^[)\\)>》】\\]}}〕,,;;::'\"“”。.\\??、/+=\\_—*&……\\^%$¥@!!`~·(\\(<《【\\[{{〔]+$")
@@ -26,21 +31,23 @@ var filterReg = regexp.MustCompile("^[的人号时元万公告项目地址电话
 var PhoneReg = regexp.MustCompile("^[1][3-9][0-9]{9}$")
 var EmailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
 
-func SearchHistory(history, searchvalue string) []string {
-	arrs := strings.Split(history, ",")
-	//新增历史记录
-	if history == "" {
-		arrs = make([]string, 0)
-	}
-	for k, v := range arrs {
-		if v == strings.TrimSpace(searchvalue) {
-			arrs = append(arrs[:k], arrs[k+1:]...)
-			break
+func SearchHistory(history, searchvalue string) (arrs []string) {
+	if searchvalue != "" {
+		arrs = strings.Split(history, ",")
+		//新增历史记录
+		if history == "" {
+			arrs = make([]string, 0)
+		}
+		for k, v := range arrs {
+			if v == strings.TrimSpace(searchvalue) {
+				arrs = append(arrs[:k], arrs[k+1:]...)
+				break
+			}
+		}
+		arrs = append(arrs, searchvalue)
+		if len(arrs) > 10 {
+			arrs = arrs[1:11]
 		}
-	}
-	arrs = append(arrs, searchvalue)
-	if len(arrs) > 10 {
-		arrs = arrs[1:11]
 	}
 	return arrs
 }
@@ -144,88 +151,81 @@ const (
 	INDEX          = "bidding"
 	TYPE           = "bidding"
 	bidSearch_sort = `{"publishtime":-1}`
-
+	RedisName      = "other"
 	//招标搜索分页--每页显示数量
-	SearchPageSize_APP = 50
-	SearchPageSize_WX  = 50
-	SearchPageSize_PC  = 50
+	SearchPageSize = 50
 	//招标搜索分页--最大页数
-	SearchMaxPageNum_APP   = 10
-	SearchMaxPageNum_WX    = 10
-	SearchMaxPageNum_PC    = 10  //免费用户500条记录
+	SearchMaxPageNum       = 10  //免费用户500条记录
 	SearchMaxPageNum_PAYED = 100 //付费用户5000条记录
 
 	bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","city","s_subscopeclass","bidamount","budget","buyerclass"`
 	bidSearch_field   = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
 )
 
-func SearchData(platform string, request *http.Request, currentPage int, userId, secondKWS, s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, queryItems []string, field, notkey string, isPayedUser bool) (second, b_word, a_word, pcAjaxFlag, secondFlag string, count, totalPage int64, list *[]map[string]interface{}) {
-	count, totalPage, list = GetPcBidSearchData(s_word, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, pageSize, isGetCount, queryItems, field, notkey, isPayedUser)
-	//if len([]rune(s_word)) > 3 && int(count) < SearchPageSize_PC && start == 0 {
-	//	var paramList = list
-	//	s_word, pcAjaxFlag, secondFlag, second, list = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, city, publishtime, subtype, buyerclass, notkey, queryItems, paramList)
-	//}
-
-	listSize := 0
-	if list != nil {
-		listSize = len(*list)
-	}
-	//public.SaveUserSearchLog(request, userId, -1, platform, "超级搜索", map[string]interface{}{
-	//	"search_word":        MC.If(platform == "app" || platform == "wx", searchvalue, s_word),
-	//	"search_area":        area,
-	//	"search_city":        city,
-	//	"search_price":       []string{minprice, maxprice},
-	//	"search_publishtime": publishtime,
-	//	"search_type":        subtype,
-	//	"search_industry":    industry,
-	//	"pagenum":            currentPage,
-	//	"pagesize":           listSize,
-	//	"fileExists":         fileExists,
-	//})
-	return
-}
-
-//GetPcBidSearchData pc端招标信息搜索
-func GetPcBidSearchData(searchvalue, area, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, selectType, field, notkey string, start, pageSize int, isGetCount bool, ispayed bool) (count, totalPage int64, list *[]map[string]interface{}) {
-	var findfields string
+//GetBidSearchData 标信息搜索
+func GetBidSearchData(in *bxcore.SearchReq) (count int64, list []*bxcore.SearchList) {
 	var hightlightContent bool = false //是否高亮正文
+	var selectTypeArr = strings.Split(in.SelectType, ",")
 	for _, v := range selectTypeArr {
 		if v == "detail" {
 			hightlightContent = true
 			break
 		}
 	}
-	if selectTypeArr == nil || len(selectTypeArr) == 0 {
-		findfields = `"title"`
-	} else {
-		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
-	}
-	qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass), notkey)
-	if isGetCount && qstr != "" && start == 0 {
+	qstr := GetSearchQuery(in, GetBidSearchQuery(in))
+	var start = int((in.PageNum - 1) * in.PageSize)
+	//首页
+	if qstr != "" && start == 1 {
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
-	if !isGetCount || count > 0 || start > 0 {
+	if count > 0 || start > 0 {
+		field := bidSearch_field_1
+		if start == 1 {
+			field = bidSearch_field
+		}
 		var repl *[]map[string]interface{}
 		if hightlightContent {
-			repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, `"detail"`, bidSearch_sort, field, start, pageSize, 115, true)
+			repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, `"detail"`, bidSearch_sort, field, start, int(in.PageSize), 115, true)
 		} else {
-			repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, ``, bidSearch_sort, field, start, pageSize, 0, false)
+			repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, ``, bidSearch_sort, field, start, int(in.PageSize), 0, false)
 		}
+		logx.Info("------:", len(*repl))
 		if repl != nil && *repl != nil && len(*repl) > 0 {
-			BidListConvert(industry, repl)
-			list = repl
+			BidListConvert(in.Industry, repl)
+			for _, v := range *repl {
+				//正文匹配检索关键词
+				highlight, _ := v["highlight"].(map[string][]string)
+				detail := ""
+				for _, val := range highlight["detail"] {
+					detail += ClearHtml.ReplaceAllString(val, "")
+				}
+				var searchList = &bxcore.SearchList{}
+				searchList.Area = MC.ObjToString(v["area"])
+				searchList.AreaUrl = IC.LabelMap[searchList.Area].Url
+				searchList.BuyerClass = MC.ObjToString(v["buyerclass"])
+				searchList.City = MC.ObjToString(v["city"])
+				searchList.Detail = detail
+				searchList.FileExists = v["filetext"] != nil
+				searchList.Id = ME.EncodeArticleId2ByCheck(MC.ObjToString(v["id"]))
+				searchList.Industry = MC.ObjToString(v["industry"])
+				searchList.IndustryUrl = IC.LabelMap[searchList.Industry].Url
+				searchList.PublishTime = MC.Int64All(v["publishtime"])
+				searchList.Subtype = MC.ObjToString(v["subtype"])
+				searchList.SubtypeUrl = IC.LabelMap[searchList.Subtype].Url
+				searchList.Title = MC.ObjToString(v["title"])
+				list = append(list, searchList)
+			}
 		}
+		MakeCollection(in.UserId, list)
+		logx.Info("=====:", len(list))
 	}
-	limitCount := MC.If(ispayed, int64(SearchPageSize_PC*SearchMaxPageNum_PAYED), int64(SearchPageSize_PC*SearchMaxPageNum_PC)).(int64)
-	if count > limitCount {
-		count = limitCount
-	}
-	totalPage = (count + int64(SearchPageSize_PC) - 1) / int64(SearchPageSize_PC)
 	return
 }
 
-func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass string) string {
+func GetBidSearchQuery(in *bxcore.SearchReq) string {
 	query := ``
+	//省份
+	area := in.Province
 	if area != "" {
 		query += `{"terms":{"area":[`
 		for k, v := range strings.Split(area, ",") {
@@ -237,6 +237,7 @@ func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass stri
 		query += `]}}`
 	}
 	//
+	city := in.City
 	if city != "" {
 		if len(query) > 0 {
 			query += ","
@@ -250,6 +251,8 @@ func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass stri
 		}
 		query += `]}}`
 	}
+	//发布时间
+	publishtime := in.PublishTime
 	if publishtime != "" {
 		if len(query) > 0 {
 			query += ","
@@ -291,6 +294,8 @@ func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass stri
 		}
 		query += `}}}`
 	}
+	//信息类型
+	subtype := in.Subtype
 	if subtype != "" {
 		if len(query) > 0 {
 			query += ","
@@ -304,19 +309,22 @@ func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass stri
 		}
 		query += `]}}`
 	}
-	if winner != "" {
-		if len(query) > 0 {
-			query += ","
-		}
-		query += `{"terms":{"s_winner":[`
-		for k, v := range strings.Split(winner, ",") {
-			if k > 0 {
-				query += `,`
-			}
-			query += `"` + v + `"`
-		}
-		query += `]}}`
-	}
+	//
+	//if  winner != "" {
+	//	if len(query) > 0 {
+	//		query += ","
+	//	}
+	//	query += `{"terms":{"s_winner":[`
+	//	for k, v := range strings.Split(winner, ",") {
+	//		if k > 0 {
+	//			query += `,`
+	//		}
+	//		query += `"` + v + `"`
+	//	}
+	//	query += `]}}`
+	//}
+	//采购单位类型
+	buyerclass := in.BuyerClass
 	if buyerclass != "" {
 		if len(query) > 0 {
 			query += ","
@@ -333,7 +341,7 @@ func GetBidSearchQuery(area, city, publishtime, subtype, winner, buyerclass stri
 	return query
 }
 
-func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, mustquery, notkey string) (qstr string) {
+func GetSearchQuery(in *bxcore.SearchReq, mustquery string) (qstr string) {
 	multi_match := `{"multi_match": {"query": "%s","type": "phrase", "fields": [%s]}}`
 	query := `{"query":{"bool":{"must":[%s],"must_not":[%s]}}}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
@@ -346,53 +354,65 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 	if mustquery != "" {
 		musts = append(musts, mustquery)
 	}
-
+	selectTypeArr := strings.Split(in.SelectType, ",")
+	var findfields string
+	if selectTypeArr == nil || len(selectTypeArr) == 0 {
+		findfields = `"title"`
+	} else {
+		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
+	}
 	var isFileSearch bool = false //搜索范围是否有附件选择
-	if keyword != "" {
+	//此时关键词中间有+进行隔离
+	if in.KeyWords != "" {
 		if strings.Contains(findfields, "filetext") { //搜索范围选择附件,是否有附件条件无效;
 			isFileSearch = true
 		}
 		keyword_multi_match := fmt.Sprintf(multi_match, "%s", findfields)
 		shoulds := []string{}
-		for _, v := range strings.Split(keyword, "+") {
+		for _, v := range strings.Split(in.KeyWords, "+") {
 			shoulds = append(shoulds, fmt.Sprintf(keyword_multi_match, elastic.ReplaceYH(v)))
 		}
 		musts = append(musts, fmt.Sprintf(elastic.NgramMust, strings.Join(shoulds, ",")))
 	}
-	if industry != "" {
-		industrys := strings.Split(industry, ",")
+	if in.Industry != "" {
+		industrys := strings.Split(in.Industry, ",")
 		musts = append(musts, fmt.Sprintf(query_bool_must, `"`+strings.Join(industrys, `","`)+`"`))
 	}
-	if minprice != "" || maxprice != "" {
-		sq := ``
-		if minprice != "" {
-			min, _ := strconv.ParseFloat(minprice, 64)
-			minprice = fmt.Sprintf("%.0f", min*10000)
-			if minprice == "0" {
-				minprice = ""
+	//价格
+	if in.Price != "" {
+		minprice, maxprice := strings.Split(in.Price, "-")[0], strings.Split(in.Price, "-")[1]
+		if minprice != "" || maxprice != "" {
+			sq := ``
+			if minprice != "" {
+				min, _ := strconv.ParseFloat(minprice, 64)
+				minprice = fmt.Sprintf("%.0f", min*10000)
+				if minprice == "0" {
+					minprice = ""
+				}
 			}
-		}
-		if maxprice != "" {
-			max, _ := strconv.ParseFloat(maxprice, 64)
-			maxprice = fmt.Sprintf("%.0f", max*10000)
-			if maxprice == "0" {
-				maxprice = ""
+			if maxprice != "" {
+				max, _ := strconv.ParseFloat(maxprice, 64)
+				maxprice = fmt.Sprintf("%.0f", max*10000)
+				if maxprice == "0" {
+					maxprice = ""
+				}
+			}
+			if minprice != "" {
+				sq += fmt.Sprintf(gte, minprice)
+			}
+			if minprice != "" && maxprice != "" {
+				sq += `,`
+			}
+			if maxprice != "" {
+				sq += fmt.Sprintf(lte, maxprice)
+			}
+			if minprice != "" || maxprice != "" {
+				query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_bools_must, sq, sq))
+				musts = append(musts, query_price)
 			}
-		}
-		if minprice != "" {
-			sq += fmt.Sprintf(gte, minprice)
-		}
-		if minprice != "" && maxprice != "" {
-			sq += `,`
-		}
-		if maxprice != "" {
-			sq += fmt.Sprintf(lte, maxprice)
-		}
-		if minprice != "" || maxprice != "" {
-			query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_bools_must, sq, sq))
-			musts = append(musts, query_price)
 		}
 	}
+	hasBuyerTel := in.BuyerTel
 	if hasBuyerTel != "" {
 		if hasBuyerTel == "y" {
 			must_not = append(must_not, fmt.Sprintf(query_missing, "buyertel"))
@@ -400,6 +420,7 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 			musts = append(musts, fmt.Sprintf(query_missing, "buyertel"))
 		}
 	}
+	hasWinnerTel := in.WinnerTel
 	if hasWinnerTel != "" {
 		if hasWinnerTel == "y" {
 			must_not = append(must_not, fmt.Sprintf(query_missing, "winnertel"))
@@ -407,6 +428,8 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 			musts = append(musts, fmt.Sprintf(query_missing, "winnertel"))
 		}
 	}
+	//排除词
+	notkey := in.ExclusionWords
 	if notkey = strings.TrimSpace(notkey); notkey != "" {
 		notkey_multi_match := fmt.Sprintf(multi_match, "%s", findfields)
 		notkey_must_not := []string{}
@@ -419,6 +442,8 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 		}
 		must_not = append(must_not, fmt.Sprintf(query_bool_should, strings.Join(notkey_must_not, ",")))
 	}
+	//
+	fileExists := in.FileExists
 	if !isFileSearch && fileExists != "" {
 		if fileExists == "1" { //有附件
 			must_not = append(must_not, fmt.Sprintf(query_missing, "filetext"))
@@ -427,7 +452,7 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 		}
 	}
 	qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","))
-	log.Println(qstr)
+	logx.Info(qstr)
 	return
 }
 
@@ -436,8 +461,8 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
  * 所有的招标搜索都要调用此方法,列表中有展示行业的也可以用
  * industry 搜索条件中的行业,默认为空
  */
-func BidListConvert(industry string, list *[]map[string]interface{}) {
-	if list == nil {
+func BidListConvert(industry string, res *[]map[string]interface{}) {
+	if res == nil {
 		return
 	}
 	commonSubstring := func(v string) (value string) {
@@ -452,7 +477,9 @@ func BidListConvert(industry string, list *[]map[string]interface{}) {
 		}
 		return
 	}
-	for _, v := range *list {
+	for _, v := range *res {
+		v["id"] = v["_id"]
+		delete(v, "_id")
 		budget, _ := v["budget"].(float64)
 		bidamount, _ := v["bidamount"].(float64)
 		if budget == 0 || strings.TrimSpace(fmt.Sprint(v["budget"])) == "" {
@@ -489,3 +516,67 @@ func BidListConvert(industry string, list *[]map[string]interface{}) {
 		v["industry"] = value
 	}
 }
+
+//是否收藏
+func MakeCollection(userId string, list []*bxcore.SearchList) {
+	if list == nil || len(list) == 0 {
+		return
+	}
+	param := []interface{}{userId}
+	wh := []string{}
+	for _, v := range list {
+		array := ME.DecodeArticleId2ByCheck(v.Id)
+		if len(array) == 1 && array[0] != "" {
+			param = append(param, array[0])
+			wh = append(wh, "?")
+		}
+	}
+	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{}
+		if result != nil {
+			for _, v := range *result {
+				bid_map[ME.EncodeArticleId2ByCheck(MC.ObjToString(v["bid"]))] = true
+			}
+		}
+		for _, v := range list {
+			if bid_map[v.Id] {
+				v.IsCollected = true
+			}
+		}
+	}
+}
+
+//默认查询缓存数据
+func SearchCahcheData(in *bxcore.SearchReq) (count int64, list []*bxcore.SearchList) {
+	//最新招标信息
+	findfields := `"title"`
+	qstr := GetSearchQuery(in, GetBidSearchQuery(in))
+	//首页
+	if in.PageNum == 1 {
+		count = elastic.Count(INDEX, TYPE, qstr)
+	}
+	if count > 0 || in.PageNum > 1 {
+		repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, int(in.PageNum), int(in.PageSize), 0, false)
+		if repl != nil && *repl != nil && len(*repl) > 0 {
+			BidListConvert(in.Industry, repl)
+			for _, v := range *repl {
+				var searchList = &bxcore.SearchList{}
+				searchList.Area = MC.ObjToString(v["area"])
+				searchList.AreaUrl = IC.LabelMap[searchList.Area].Url
+				searchList.BuyerClass = MC.ObjToString(v["buyerclass"])
+				searchList.City = MC.ObjToString(v["city"])
+				searchList.FileExists = v["filetext"] != nil
+				searchList.Id = ME.EncodeArticleId2ByCheck(MC.ObjToString(v["id"]))
+				searchList.Industry = MC.ObjToString(v["industry"])
+				searchList.IndustryUrl = IC.LabelMap[searchList.Industry].Url
+				searchList.PublishTime = MC.Int64All(v["publishtime"])
+				searchList.Subtype = MC.ObjToString(v["subtype"])
+				searchList.SubtypeUrl = IC.LabelMap[searchList.Subtype].Url
+				searchList.Title = MC.ObjToString(v["title"])
+				list = append(list, searchList)
+			}
+		}
+	}
+	return
+}