浏览代码

feat:更新

wangshan 3 年之前
父节点
当前提交
2d58073b21
共有 2 个文件被更改,包括 6 次插入14 次删除
  1. 3 14
      jyBXCore/rpc/internal/logic/getsearchlistlogic.go
  2. 3 0
      jyBXCore/rpc/util/userInfo.go

+ 3 - 14
jyBXCore/rpc/internal/logic/getsearchlistlogic.go

@@ -75,6 +75,7 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 	in.SelectType = strings.Join(queryItems, ",")
 	//b_word, s_word := "", ""
 	res.IsLimit = 1
+	//以后可能会出现 关键词 C++ 等带+的关键词
 	if in.KeyWords != "" {
 		_, _, in.KeyWords = util.InterceptSearchKW(in.KeyWords, false, len(in.Industry) == 0)
 	}
@@ -98,20 +99,8 @@ func (l *GetSearchListLogic) GetSearchList(in *bxcore.SearchReq) (*bxcore.Search
 			}
 			//二次搜索- 一次搜索结果少于一页数据;关键词长度大于三;第一,二页请求;搜索范围包括title;四个条件
 			if len([]rune(in.KeyWords)) > 3 && int(count) < util.SearchPageSize && in.PageNum < 3 && strings.Contains(in.SelectType, "title") {
-				if iksk := util.HttpEs(in.KeyWords, "ik_smart", IC.DB.Es.Addr); iksk != "" {
-					//log.Println("分词:", iksk) 分词后查询数据量有可能小于不分词查询数据量  -- 原因:未分词前是全文查询 分词后是标题查询;
-					iksk = fmt.Sprintf("%s+%s", in.KeyWords, iksk)
-					var kbool = map[string]bool{}
-					var karr = []string{}
-					for _, v := range strings.Split(iksk, "+") {
-						if kbool[v] {
-							continue
-						}
-						karr = append(karr, v)
-						kbool[v] = true
-					}
-					in.KeyWords = strings.Join(karr, "+")
-					in.SelectType = "title"
+				if in.KeyWords = util.HttpEs(in.KeyWords, "ik_smart", IC.DB.Es.Addr); in.KeyWords != "" {
+					in.SelectType = "title,content"
 					_count, _list := util.GetBidSearchData(in)
 					if count < _count {
 						count = _count

+ 3 - 0
jyBXCore/rpc/util/userInfo.go

@@ -17,6 +17,9 @@ type VipState struct {
 
 func GetVipState(mysql *mysql.Mysql, mg mongodb.MongodbSim, userId string) (vs *VipState) {
 	vs = &VipState{}
+	if userId == "" {
+		return
+	}
 	phone := ""
 	data, ok := mg.FindById("user", userId, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1,"o_vipjy":1,"l_registedate":1`)
 	if data != nil && len(*data) > 0 && ok {