Browse Source

fix:搜索页面搜索词为空超前项目处理

duxin 2 years ago
parent
commit
32fc329cc3

+ 1 - 1
entity/mananger/aheadManager.go

@@ -55,7 +55,7 @@ func (this *AheadManager) GetData(userId, keyWords string, isNew bool, t int64)
 		return nil
 		return nil
 	}
 	}
 	//查询数据
 	//查询数据
-	rDate := search.AdvancedProject(userId, keyWords)
+	rDate := search.AdvancedProject(userId, keyWords, t)
 	//累计请求计数
 	//累计请求计数
 	if rDate != nil && len(rDate) > 0 {
 	if rDate != nil && len(rDate) > 0 {
 		if num := redis.Incr(AheadCacheDb, cacheKey); num == 1 {
 		if num := redis.Incr(AheadCacheDb, cacheKey); num == 1 {

+ 3 - 2
entity/search/advancedProject.go

@@ -12,11 +12,12 @@ import (
 	"time"
 	"time"
 )
 )
 
 
-func AdvancedProject(userid, keyWord string) map[string]interface{} {
+func AdvancedProject(userid, keyWord string, t int64) map[string]interface{} {
 	mae := new(MarketAnalysisEntity)
 	mae := new(MarketAnalysisEntity)
 	mae.Types = 2
 	mae.Types = 2
 	mae.FormatParam.SubType = []string{"拟建", "采购意向"}
 	mae.FormatParam.SubType = []string{"拟建", "采购意向"}
 	mae.Size = 2
 	mae.Size = 2
+	mae.STypes = t
 	mae.FormatParam.STime = time.Now().AddDate(0, -3, 0).Unix()
 	mae.FormatParam.STime = time.Now().AddDate(0, -3, 0).Unix()
 	if !mae.KeyWordFormat(userid, keyWord) {
 	if !mae.KeyWordFormat(userid, keyWord) {
 		log.Printf("[SEARCH-ERR]关键词格式化化失败 userid:%s,keyWord:%s", userid, keyWord)
 		log.Printf("[SEARCH-ERR]关键词格式化化失败 userid:%s,keyWord:%s", userid, keyWord)
@@ -133,7 +134,7 @@ func (mae *MarketAnalysisEntity) KeyWordFormat(userid, keyWord string) (ret bool
 				return
 				return
 			}
 			}
 			aItems = KeyFormat(strings.Split(keyWord, " "))
 			aItems = KeyFormat(strings.Split(keyWord, " "))
-		} else { //没有关键词 订阅页面超前项目
+		} else if mae.STypes != 1 { //没有关键词 订阅页面超前项目
 			//未传搜索词按照关键词匹配
 			//未传搜索词按照关键词匹配
 			aItems, ret = Subscription(userid)
 			aItems, ret = Subscription(userid)
 		}
 		}

+ 3 - 2
entity/search/marketAnalysisEntity.go

@@ -80,8 +80,9 @@ type MarketAnalysisEntity struct {
 	//BaseParam   AnalysisRequestParam
 	//BaseParam   AnalysisRequestParam
 	FormatParam AnalysisRequestFormat
 	FormatParam AnalysisRequestFormat
 	//UId, Pid    string
 	//UId, Pid    string
-	Types int //1 f分析报告 2超前项目
-	Size  int
+	Types  int   //1 f分析报告 2超前项目
+	STypes int64 //1 搜索页面 2订阅页面
+	Size   int
 }
 }
 
 
 // AnalysisRequestFormat 格式化后参数
 // AnalysisRequestFormat 格式化后参数