duxin il y a 3 ans
Parent
commit
92ea3116a5

+ 1 - 1
src/jfw/front/supsearch.go

@@ -292,7 +292,7 @@ func (p *Pcsearch) PcSearchIndex() error {
 	secondKWS := ""
 	if len(s_word) > 0 || len(industry) > 0 {
 		status = 2
-		_, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData(2, p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, bidsearch.SearchPageSize_PC, true, queryItems, bidSearch_field_1, notkey, isPayedUser)
+		_, _, _, _, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", p.Request, 1, util.ObjToString(p.GetSession("userId")), secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, bidsearch.SearchPageSize_PC, true, queryItems, bidSearch_field_1, notkey, isPayedUser)
 	} else {
 		p.DisableHttpCache()
 		p.T["list"] = PCS_list("") //Newbids("")[0]

+ 2 - 2
src/jfw/front/swordfish.go

@@ -150,7 +150,7 @@ func (m *Front) PcAjaxReq() {
 			}
 		}
 		if isLimit == 1 {
-			_, _, _, pcAjaxFlag, secondFlag, count, totalPage, list = bidsearch.SearchData(1, m.Request, currentPage, util.ObjToString(m.GetSession("userId")), secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, start, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser)
+			_, _, _, pcAjaxFlag, secondFlag, count, totalPage, list = bidsearch.SearchData("pc", m.Request, currentPage, util.ObjToString(m.GetSession("userId")), secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, start, bidsearch.SearchPageSize_PC, true, queryItems, field, notkey, isPayedUser)
 		}
 	}
 	secondList, totalPage, _ = bidsearch.LisetData(1, currentPage, list, secondFlag, config.Sysconfig, isPayedUser) //只有前20条
@@ -375,7 +375,7 @@ func (m *Front) WxsearchlistPaging() {
 				}
 			}
 			if isLimit == 1 {
-				secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData(4, m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser)
+				secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("wx", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser)
 			}
 			//新增历史记录
 			arrs = bidsearch.AddHistory(history, searchvalue)

+ 1 - 1
src/jfw/modules/app/src/app/front/swordfish.go

@@ -283,7 +283,7 @@ func (m *Front) WxsearchlistPaging() {
 			filed = bidSearch_field
 		}
 		if isLimit == 1 {
-			secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData(3, m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser)
+			secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("app", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser)
 		}
 	}
 

+ 8 - 17
src/jfw/modules/common/src/qfw/util/bidsearch/search.go

@@ -307,7 +307,7 @@ func PublicSearch(userId, selectType, publishtime string, bidSearchOldUserLimit
 }
 
 //所有的再次分词查询 只查标题
-func IntegratedData(stype int, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, secondFlag, area, publishtime, subtype, buyerclass, notkey string, queryItems []string, list *[]map[string]interface{}) (string, string, string, string) {
+func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, secondFlag, area, publishtime, subtype, buyerclass, notkey string, queryItems []string, list *[]map[string]interface{}) (string, string, string, string) {
 	var pcAjaxFlag string
 	secondSearch := false
 	for _, item := range queryItems {
@@ -323,7 +323,7 @@ func IntegratedData(stype int, s_word, secondKWS, industry, minprice, maxprice,
 		secRel := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, 0, 2*SearchPageSize_PC, 0, false)
 		if secRel != nil && len(*secRel) > 0 {
 			public.BidListConvert(industry, secRel)
-			if stype == 3 || stype == 4 {
+			if platform == "app" || platform == "wx" {
 				for _, v := range *secRel {
 					v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
 				}
@@ -432,21 +432,12 @@ func LisetData(stype, pageNum int, list *[]map[string]interface{}, secondFlag st
 	return secondList, totalPage, hasNextPage
 }
 
-//1 2 pc 3 app 4 wx
-func SearchData(stype int, request *http.Request, currentPage int, userId, secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel 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{}) {
-	var (
-		platform    string
-		searchvalue = s_word
-	)
-	number := util.If(stype == 3 || stype == 4, 1, 0)
-	if stype == 3 {
-		platform = "app"
-		list, b_word, a_word, s_word = GetWxsearchlistData(s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, start, SearchPageSize_APP, queryItems, field, notkey)
-	} else if stype == 4 {
-		platform = "wx"
+func SearchData(platform string, request *http.Request, currentPage int, userId, secondKWS, s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel 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{}) {
+	var searchvalue = s_word
+	number := util.If(platform == "app" || platform == "wx", 1, 0)
+	if platform == "app" || platform == "wx" {
 		list, b_word, a_word, s_word = GetWxsearchlistData(s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, start, SearchPageSize_APP, queryItems, field, notkey)
 	} else {
-		platform = "pc"
 		count, totalPage, list = GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, start, pageSize, isGetCount, queryItems, field, notkey, isPayedUser)
 	}
 
@@ -455,10 +446,10 @@ func SearchData(stype int, request *http.Request, currentPage int, userId, secon
 		listSize = len(*list)
 	}
 	if len([]rune(s_word)) > 3 && int(count) < SearchPageSize_PC && start == number {
-		s_word, pcAjaxFlag, secondFlag, second = IntegratedData(stype, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, secondFlag, area, publishtime, subtype, buyerclass, notkey, queryItems, list)
+		s_word, pcAjaxFlag, secondFlag, second = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, secondFlag, area, publishtime, subtype, buyerclass, notkey, queryItems, list)
 	}
 	public.SaveUserSearchLog(request, userId, -1, platform, "超级搜索", map[string]interface{}{
-		"search_word":        util.If(stype == 3 || stype == 4, searchvalue, s_word),
+		"search_word":        util.If(platform == "app" || platform == "wx", searchvalue, s_word),
 		"search_area":        area,
 		"search_price":       []string{minprice, maxprice},
 		"search_publishtime": publishtime,