Selaa lähdekoodia

PC端搜索 附件条件

wangshan 3 vuotta sitten
vanhempi
commit
ab0994a526

+ 2 - 0
src/jfw/front/dataExport.go

@@ -349,6 +349,7 @@ func (d *DataExport) SuperSearchExport() error {
 		Haswinnertel: d.GetString("winnertel"),                    //是否有中标电话
 		SelectIds:    strings.TrimSpace(d.GetString("selectIds")), //选择信息id
 		Notkey:       d.GetString("notkey"),                       //排除词
+		FileExists:   d.GetString("fileExists"),                   //是否有附件
 	}
 	//数据回显
 	d.SetSession("Echo_timeslot", d.GetString("timeslot"))
@@ -364,6 +365,7 @@ func (d *DataExport) SuperSearchExport() error {
 	d.SetSession("Echo_hasBuyertel", reqData.Hasbuyertel)
 	d.SetSession("Echo_hasWinnertel", reqData.Haswinnertel)
 	d.SetSession("Echo_notkey", reqData.Notkey)
+	d.SetSession("Echo_fileExists", reqData.FileExists)
 
 	saveData := reqData.PassBidSearchExport()
 	saveData["selectType"] = strings.Join(jy.GetVipState(public.Mysql, public.MQFW, userId).

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

@@ -151,7 +151,7 @@ func GetNewArticle(typ int) (list []map[string]interface{}) {
 	if l, ok := redis.Get("other", rediskey).([]interface{}); ok && l != nil && len(l) > 0 {
 		list = util.ObjArrToMapArr(l)
 	} else {
-		_, _, lists := bidsearch.GetPcBidSearchData("", "", "", subtype, "", "", "", "", "", "", "", 1, bidsearch.SearchPageSize_PC, false, nil, bidSearch_field_1, "", false)
+		_, _, lists := bidsearch.GetPcBidSearchData("", "", "", subtype, "", "", "", "", "", "", "", "", 1, bidsearch.SearchPageSize_PC, false, nil, bidSearch_field_1, "", false)
 		if lists != nil && len(*lists) > 5 {
 			*lists = (*lists)[0:6]
 			for _, v := range *lists {
@@ -442,7 +442,7 @@ func (f *PcIndex) SearchResult(at, name string) error {
 				// if datas != nil && len(*datas) > limitcount {
 				// 	*datas = (*datas)[0:limitcount]
 				// } else {
-				_, _, datas = bidsearch.GetPcBidSearchData(keywords, "", "", "", key_industry, "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
+				_, _, datas = bidsearch.GetPcBidSearchData(keywords, "", "", "", key_industry, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
 				if datas != nil && len(*datas) > limitcount {
 					*datas = (*datas)[0:limitcount]
 				}

+ 6 - 3
src/jfw/front/supsearch.go

@@ -119,7 +119,7 @@ func (p *Pcsearch) ProposedProject() error {
 	var count int64
 	if len(s_word) > 0 {
 		status = 2
-		count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
+		count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, "", "", "", "", "", "", "", "", 0, bidsearch.SearchPageSize_PC, true, nil, bidSearch_field_1, "", false)
 		listSize := 0
 		if list != nil {
 			listSize = len(*list)
@@ -253,6 +253,7 @@ func (p *Pcsearch) PcSearchIndex() error {
 	subtype := p.GetString("subtype")                      //信息类型
 	minprice := p.GetString("minprice")                    //最低价格
 	maxprice := p.GetString("maxprice")                    //最高价格
+	fileExists := p.GetString("fileExists")                //是否有附件--所有用户都可用此功能 0:全部;1:有附件;-1:无附件
 
 	userId, _ := p.GetSession("userId").(string)
 
@@ -286,6 +287,7 @@ func (p *Pcsearch) PcSearchIndex() error {
 		hasWinnerTel = util.ObjToString(p.GetSession("Echo_hasWinnertel"))
 		industry = util.ObjToString(p.GetSession("Echo_industry"))
 		notkey = util.ObjToString(p.GetSession("Echo_notkey"))
+		fileExists = util.ObjToString(p.GetSession("Echo_fileExists"))
 	}
 
 	b_word, s_word := "", ""
@@ -299,7 +301,7 @@ func (p *Pcsearch) PcSearchIndex() error {
 	secondKWS := ""
 	if len(s_word) > 0 || len(industry) > 0 {
 		status = 2
-		secondKWS, _, _, _, 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)
+		secondKWS, _, _, _, 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, fileExists, 0, bidsearch.SearchPageSize_PC, true, queryItems, bidSearch_field_1, notkey, isPayedUser)
 	} else {
 		p.DisableHttpCache()
 		p.T["list"] = PCS_list("") //Newbids("")[0]
@@ -330,6 +332,7 @@ func (p *Pcsearch) PcSearchIndex() error {
 		p.T["buyerclass"] = buyerclass
 		p.T["buyertel"] = hasBuyerTel
 		p.T["winnertel"] = hasWinnerTel
+		p.T["fileExists"] = fileExists
 		p.T["notkey"] = notkey
 		p.SetSession("paramkey", b_word)
 		switch publishtime {
@@ -394,7 +397,7 @@ func Newbids(p string) []interface{} {
 		}
 
 		for i := 0; i < 10; i++ {
-			_, list = getLastNewsData("", "", "", subtype, "", "", "", "", "", "", "Y", intns[i], true, false, "")
+			_, list = getLastNewsData("", "", "", subtype, "", "", "", "", "", "", "", "Y", intns[i], true, false, "")
 			for k, v := range *list {
 				v["k"] = (k + 1) + i*50
 				t := time.Unix(util.Int64All(v["publishtime"]), 0)

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 917 - 915
src/jfw/front/swordfish.go


+ 27 - 11
src/jfw/modules/common/src/qfw/util/bidsearch/search.go

@@ -35,7 +35,7 @@ const (
 )
 
 //GetWxsearchlistData 移动端招标信息搜索
-func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel string, pageNum, pageSize int, selectTypeArr []string, field, notkey string) (list *[]map[string]interface{}, b_word, a_word, s_word string) {
+func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, pageNum, pageSize int, selectTypeArr []string, field, notkey string) (list *[]map[string]interface{}, b_word, a_word, s_word string) {
 	var hightlightContent bool = false //是否高亮正文
 	for _, v := range selectTypeArr {
 		if v == "detail" {
@@ -53,7 +53,7 @@ func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minpri
 	} else {
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 	}
-	qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, GetBidSearchQuery(scope, publishtime, subtype, winner, buyerclass), notkey)
+	qstr := GetSearchQuery(s_word, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(scope, publishtime, subtype, winner, buyerclass), notkey)
 	if hightlightContent { //全文搜索
 		list = elastic.GetAllByNgram(INDEX, TYPE, qstr, `"detail"`, bidSearch_sort, field, (pageNum-1)*pageSize, pageSize, 100, true)
 	} else { //标题搜索
@@ -69,7 +69,7 @@ func GetWxsearchlistData(keywords, scope, publishtime, subtype, industry, minpri
 }
 
 //GetPcBidSearchData pc端招标信息搜索
-func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel string, start, pageSize int, isGetCount bool, selectTypeArr []string, field, notkey string, ispayed bool) (count, totalPage int64, list *[]map[string]interface{}) {
+func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists string, start, pageSize int, isGetCount bool, selectTypeArr []string, field, notkey string, ispayed bool) (count, totalPage int64, list *[]map[string]interface{}) {
 	var findfields string
 	var hightlightContent bool = false //是否高亮正文
 	for _, v := range selectTypeArr {
@@ -83,7 +83,7 @@ func GetPcBidSearchData(searchvalue, area, publishtime, subtype, industry, minpr
 	} else {
 		findfields = fmt.Sprintf(`"%s"`, strings.Join(selectTypeArr, "\",\""))
 	}
-	qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, GetBidSearchQuery(area, publishtime, subtype, winner, buyerclass), notkey)
+	qstr := GetSearchQuery(searchvalue, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, publishtime, subtype, winner, buyerclass), notkey)
 	if isGetCount && qstr != "" && start == 0 {
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
@@ -202,7 +202,7 @@ func GetBidSearchQuery(area, publishtime, subtype, winner, buyerclass string) st
 	return query
 }
 
-func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, mustquery, notkey string) (qstr string) {
+func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, mustquery, notkey 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}}`
@@ -215,7 +215,12 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 	if mustquery != "" {
 		musts = append(musts, mustquery)
 	}
+
+	var isFileSearch bool = false //搜索范围是否有附件选择
 	if keyword != "" {
+		if strings.Contains(findfields, "filetext") { //搜索范围选择附件,是否有附件条件无效;
+			isFileSearch = true
+		}
 		keyword_multi_match := fmt.Sprintf(multi_match, "%s", findfields)
 		shoulds := []string{}
 		for _, v := range strings.Split(keyword, "+") {
@@ -283,6 +288,13 @@ func GetSearchQuery(keyword, industry, minprice, maxprice, hasBuyerTel, hasWinne
 		}
 		must_not = append(must_not, fmt.Sprintf(query_bool_should, strings.Join(notkey_must_not, ",")))
 	}
+	if !isFileSearch && fileExists != "" {
+		if fileExists == "1" { //有附件
+			must_not = append(must_not, fmt.Sprintf(query_missing, "filetext"))
+		} else if fileExists == "-1" { //无附件
+			musts = append(musts, fmt.Sprintf(query_missing, "filetext"))
+		}
+	}
 	qstr = fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(must_not, ","))
 	log.Println(qstr)
 	return
@@ -321,7 +333,7 @@ func PublicSearch(userId, selectType, publishtime string, bidSearchOldUserLimit
 }
 
 //所有的再次分词查询 只查标题
-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, *[]map[string]interface{}) {
+func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, publishtime, subtype, buyerclass, notkey string, queryItems []string, list *[]map[string]interface{}) (string, string, string, string, *[]map[string]interface{}) {
 	var pcAjaxFlag string
 	secondSearch := false
 	var secRel *[]map[string]interface{} = list
@@ -334,7 +346,7 @@ func IntegratedData(platform string, s_word, secondKWS, industry, minprice, maxp
 	if secondSearch {
 		if secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address); secondKWS != "" {
 			findfields := `"title"`
-			qstr := GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, GetBidSearchQuery(area, publishtime, subtype, "", buyerclass), notkey)
+			qstr := GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, findfields, GetBidSearchQuery(area, publishtime, subtype, "", buyerclass), notkey)
 			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)
@@ -419,6 +431,10 @@ func LisetData(stype, pageNum int, list *[]map[string]interface{}, secondFlag st
 				}
 				v["detail"] = detail
 				v["href"] = util.EncodeArticleId2ByCheck(util.GetRandom(20))
+				if v["filetext"] != nil {
+					delete(v, "filetext")
+					v["fileExists"] = true
+				}
 			}
 		}
 		if secondFlag != "" {
@@ -446,21 +462,21 @@ func LisetData(stype, pageNum int, list *[]map[string]interface{}, secondFlag st
 	return secondList, totalPage, hasNextPage
 }
 
-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{}) {
+func SearchData(platform string, request *http.Request, currentPage int, userId, secondKWS, s_word, area, 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{}) {
 	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)
+		list, b_word, a_word, s_word = GetWxsearchlistData(s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, start, SearchPageSize_APP, queryItems, field, notkey)
 		if list != nil && len(*list) != 0 {
 			count = int64(len(*list))
 		}
 	} else {
-		count, totalPage, list = GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, start, pageSize, isGetCount, queryItems, field, notkey, isPayedUser)
+		count, totalPage, list = GetPcBidSearchData(s_word, area, 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 == number {
 		var paramList = list
-		s_word, pcAjaxFlag, secondFlag, second, list = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, secondFlag, area, publishtime, subtype, buyerclass, notkey, queryItems, paramList)
+		s_word, pcAjaxFlag, secondFlag, second, list = IntegratedData(platform, s_word, secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, fileExists, secondFlag, area, publishtime, subtype, buyerclass, notkey, queryItems, paramList)
 	}
 
 	listSize := 0

+ 2 - 2
src/jfw/modules/common/src/qfw/util/jy/payUser.go

@@ -68,8 +68,6 @@ func (vs *VipState) GetQueryItems(selectType string, limitOldTime int64) (items
 				items = append(items, "mwinner")
 			} else if t == "agency" {
 				items = append(items, "magency")
-			} else if t == "file" {
-				items = append(items, "filetext")
 			} else if t == "title" {
 				items = append(items, "title")
 			} else if t == "ppa" {
@@ -88,6 +86,8 @@ func (vs *VipState) GetQueryItems(selectType string, limitOldTime int64) (items
 			items = append(items, "title")
 		} else if t == "content" {
 			items = append(items, "detail")
+		} else if t == "file" { //dev4.7.8 标讯优化:搜索范围附件-》全部用户可用
+			items = append(items, "filetext")
 		}
 	}
 	return

+ 1 - 1
src/jfw/modules/common/src/qfw/util/jylog/jylog.go

@@ -30,7 +30,7 @@ var LogPath = "./jylog"
 func init() {
 	os.Mkdir(LogPath, os.ModePerm)
 	//默认保留15天内的日志,-1为永久保留
-	initLog(15)
+	// initLog(15)
 }
 
 func initLog(saveDay int) {

+ 1 - 0
src/jfw/public/dataexport.go

@@ -108,6 +108,7 @@ type BidSearchExport struct {
 	Haswinnertel string //是否有中标电话
 	SelectIds    string //选择单条信息id
 	Notkey       string //排除词
+	FileExists   string //是否有附件
 }
 
 func (this *BidSearchExport) PassBidSearchExport() (returnData map[string]interface{}) {

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä