liuxiaolu 8 years ago
parent
commit
3c6988d6c7

+ 11 - 12
src/jfw/front/search.go

@@ -1,20 +1,20 @@
 package front
 
 import (
+	"fmt"
 	"github.com/go-xweb/xweb"
-	"strings"
+	"gopkg.in/mgo.v2/bson"
+	"jfw/wx"
 	"qfw/util"
 	"qfw/util/redis"
-	"jfw/wx"
-	"gopkg.in/mgo.v2/bson"
-	"fmt"
+	"strings"
 )
 
 type Search struct {
 	*xweb.Action
 	/********************剑鱼搜索dev2.0**************************/
-	mainSearch  xweb.Mapper `xweb:"/jylab/mainSearch"`				//剑鱼搜索主页面
-	superSearch xweb.Mapper `xweb:"/jylab/superSearch"`				//超级搜索
+	mainSearch  xweb.Mapper `xweb:"/jylab/mainSearch"`  //剑鱼搜索主页面
+	superSearch xweb.Mapper `xweb:"/jylab/superSearch"` //超级搜索
 }
 
 func init() {
@@ -49,14 +49,14 @@ func (s *Search) MainSearch() error {
 	}
 	return s.Render("/weixin/search/mainSearch.html", &s.T)
 }
-func (m *Search) SuperSearch() error{
+func (m *Search) SuperSearch() error {
 	defer util.Catch()
 	searchvalue := strings.Trim(m.GetString("searchvalue"), " ")
 	var list *[]map[string]interface{}
 	if userid := m.GetSession("userId"); userid != nil {
 		if len(searchvalue) > 0 {
 			searchname := strings.Replace(strings.Replace(searchvalue, " ", "+", -1), "++", "+", -1)
-			list = getWxsearchlistData(searchvalue, searchname, "", "", "","", 1, "all")
+			list = getWxsearchlistData(searchvalue, searchname, "", "", "", "", "", "", 1, "all")
 			history := redis.GetStr("other", "s_"+userid.(string))
 			arrs := strings.Split(history, ",")
 			if history == "" {
@@ -112,9 +112,8 @@ func (m *Search) SuperSearch() error{
 		m.T["avatar"] = myavatar
 		//行业信息数据
 		industry, sortArray := getindustrys()
-		m.T["industry"]=industry
-		m.T["sortArray"]=sortArray
+		m.T["industry"] = industry
+		m.T["sortArray"] = sortArray
 	}
-	return  m.Render("/weixin/search/superSearch.html", &m.T)
+	return m.Render("/weixin/search/superSearch.html", &m.T)
 }
-

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

@@ -59,8 +59,8 @@ func (p *Pcsearch) PcSearchIndex() error {
 	publishtime := p.GetString("publishtime") //发布时间
 	toptype := p.GetString("toptype")         //信息类型
 	subtype := p.GetString("subtype")         //信息类型
-	minprice, _ := p.GetFloat("minprice")     //最低价格
-	maxprice, _ := p.GetFloat("maxprice")     //最高价格
+	minprice := p.GetString("minprice")       //最低价格
+	maxprice := p.GetString("maxprice")       //最高价格
 	industry := p.GetString("industry")       //选中的行业
 	selectType := p.GetString("selectType")   //标题或全文
 	selectTypesess := p.GetSession("selectType")
@@ -76,10 +76,10 @@ func (p *Pcsearch) PcSearchIndex() error {
 	log.Println(searchvalue, "___:", p.Method())
 	if len(searchvalue) > 0 {
 		status = 2
-		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, 0, true, selectType)
+		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType)
 	} else if p.Method() == "POST" {
 		status = 2
-		count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, 0, true)
+		count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, true)
 	} else {
 		p.DisableHttpCache()
 		Newbids()
@@ -207,7 +207,7 @@ func Newbids() {
 			}
 		}
 		for i := 0; i < 10; i++ {
-			_, list = getLastNewsData("", "", "", "", "", intns[i], true)
+			_, list = getLastNewsData("", "", "", "", "", "", "", intns[i], true, false)
 			jyutil.BidListConvert("", list)
 			for k, v := range *list {
 				v["k"] = (k + 1) + i*50

+ 147 - 82
src/jfw/front/swordfish.go

@@ -30,7 +30,7 @@ const (
 	bidSearch_maxPageSize = 10 //招标搜索分页--最大页数
 	wx_maxPageNum         = 20
 	wx_pageSize           = 50
-	bidSearch_field_1     = `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","biddingcontent","projectname"`
+	bidSearch_field_1     = `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","s_subscopeclass","projectname"`
 	bidSearch_field       = bidSearch_field_1 + `,"detail"`
 	bidSearch_sort        = `{"publishtime":-1}`
 )
@@ -139,7 +139,7 @@ func (m *Front) NewSordfish() error {
 			return m.SetBody([]byte(ret.(string)))
 		} else {
 			m.DisableHttpCache()
-			lastBids := elastic.GetPage("bidding", "bidding", "{}", bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","biddingcontent"`, 0, 18)
+			lastBids := elastic.GetPage("bidding", "bidding", "{}", bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","s_subscopeclass"`, 0, 18)
 			if lastBids != nil && len(*lastBids) > 0 {
 				jyutil.BidListConvert("", lastBids)
 				lbnHtml, olHtml := structureLastBidsHtml(lastBids)
@@ -283,6 +283,8 @@ func (m *Front) Searchinfolist(p string) error {
 	toptype := m.GetString("toptype")
 	subtype := m.GetString("subtype")
 	industry := m.GetString("industry")
+	minprice := m.GetString("minprice") //最低价格
+	maxprice := m.GetString("maxprice") //最高价格
 	selectType := m.GetString("selectType")
 	selectTypesess := m.GetSession("selectType")
 	if selectTypesess != nil && selectTypesess != "" {
@@ -296,10 +298,10 @@ func (m *Front) Searchinfolist(p string) error {
 	var list *[]map[string]interface{}
 	pages := make([]interface{}, 0)
 	if len(searchvalue) > 0 {
-		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, 0, true, selectType)
+		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType)
 	} else if m.Method() == "POST" {
 		status = 2
-		count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, 0, true)
+		count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, false)
 	} else {
 		status = 2
 		if redis.Get("other", "index_list") == nil {
@@ -318,7 +320,7 @@ func (m *Front) Searchinfolist(p string) error {
 				}
 			}
 			for i := 0; i < 10; i++ {
-				count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, intns[i], true)
+				count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, intns[i], true, false)
 				for k, v := range *list {
 					v["k"] = (k + 1) + i*50
 					t := time.Unix(util.Int64All(v["publishtime"]), 0)
@@ -444,20 +446,22 @@ func (m *Front) PcAjaxReq() {
 	publishtime := m.GetString("publishtime")
 	selectType := m.GetString("selectType")
 	industry := m.GetString("industry")
+	minprice := m.GetString("minprice") //最低价格
+	maxprice := m.GetString("maxprice") //最高价格
 	m.SetSession("selectType", selectType)
 	var list *[]map[string]interface{}
 	var count int64
 	status, _ := m.GetInteger("status")
 	if reqType == "filter" {
 		if status == 1 {
-			count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, 0, true, selectType)
+			count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType)
 		} else if status == 2 {
-			count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, 0, true)
+			count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, true)
 		}
 	} else if reqType == "bidSearch" {
-		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, start, true, selectType)
+		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, start, true, selectType)
 	} else if reqType == "lastNews" {
-		_, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, start, false)
+		_, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, start, false, true)
 	}
 	if list != nil && len(*list) > 0 {
 		for _, v := range *list {
@@ -489,11 +493,13 @@ func (m *Front) PcAjaxReq() {
 /**
 **页面搜索
 **/
-func getBidSearchData(searchvalue, area, publishtime, subtype, industry string, start int, isGetCount bool, selectType string) (count int64, list *[]map[string]interface{}) {
-	query := getBidSearchQuery(area, publishtime, subtype, industry)
+func getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice string, start int, isGetCount bool, selectType string) (count int64, list *[]map[string]interface{}) {
 	//selectType:全文搜索(all)、标题搜索(title)
-	var qstr string
-	qstr = elastic.GetNgramQuery(searchvalue, query, `"title","detail"` /*FINDF*/)
+	findfields := `"title"`
+	if selectType == "all" {
+		findfields = `"title","detail"`
+	}
+	qstr := getSearchQuery(searchvalue, industry, minprice, maxprice, findfields, getBidSearchQuery(area, publishtime, subtype))
 	if isGetCount && qstr != "" {
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
@@ -501,10 +507,10 @@ func getBidSearchData(searchvalue, area, publishtime, subtype, industry string,
 		var repl *[]map[string]interface{}
 		if selectType == "all" {
 			//全文搜索
-			repl = elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, true, false, 115)
+			repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 115, true)
 		} else {
 			//标题搜索
-			repl = elastic.GetByNgram(INDEX, TYPE, searchvalue, query, `"title"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize)
+			repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 0, false)
 		}
 		if repl != nil && *repl != nil && len(*repl) > 0 {
 			jyutil.BidListConvert(industry, repl)
@@ -517,20 +523,15 @@ func getBidSearchData(searchvalue, area, publishtime, subtype, industry string,
 	}
 	return
 }
-func getLastNewsData(searchvalue, area, publishtime, subtype, industry string, start int, isGetCount bool) (count int64, list *[]map[string]interface{}) {
+func getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice string, start int, isGetCount bool, highlight bool) (count int64, list *[]map[string]interface{}) {
 	//最新招标信息
-	query := getBidSearchQuery(area, publishtime, subtype, industry)
-	strquery := `{"query":{"bool":{"must":[` + query + `],"must_not":[],"should":[],"minimum_should_match" : 1}}}`
+	findfields := `"title","detail"`
+	qstr := getSearchQuery(searchvalue, industry, minprice, maxprice, findfields, getBidSearchQuery(area, publishtime, subtype))
 	if isGetCount {
-		count = elastic.Count(INDEX, TYPE, strquery)
-		//count = elastic.Count(INDEX, TYPE, elastic.MakeQuery(query, "", "", -1, -1))
+		count = elastic.Count(INDEX, TYPE, qstr)
 	}
 	if !isGetCount || count > 0 {
-		//repl := elastic.GetPage(INDEX, TYPE, query, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize)
-		if query == "{}" {
-			query = ""
-		}
-		repl := elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, true, false, 115)
+		repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 115, highlight)
 		if repl != nil && *repl != nil && len(*repl) > 0 {
 			jyutil.BidListConvert(industry, repl)
 			list = repl
@@ -542,7 +543,7 @@ func getLastNewsData(searchvalue, area, publishtime, subtype, industry string, s
 	}
 	return
 }
-func getBidSearchQuery(area, publishtime, subtype, industry string) string {
+func getBidSearchQuery(area, publishtime, subtype string) string {
 	query := ``
 	if area != "" {
 		query += `{"terms":{"area":[`
@@ -602,19 +603,6 @@ func getBidSearchQuery(area, publishtime, subtype, industry string) string {
 		}
 		query += `]}}`
 	}
-	if industry != "" {
-		if len(query) > 0 {
-			query += ","
-		}
-		query += `{"regexp":{"industry":".*(`
-		for k, v := range strings.Split(industry, ",") {
-			if k > 0 {
-				query += `|`
-			}
-			query += "," + v + ","
-		}
-		query += `).*"}}`
-	}
 	return query
 }
 func getLastNewsQuery(area, publishtime, subtype string) string {
@@ -771,6 +759,8 @@ func (m *Front) Wxsearchlist() error {
 	toptype := m.GetString("toptype")
 	subtype := m.GetString("subtype")
 	industry := m.GetString("industry")
+	minprice := m.GetString("minprice")
+	maxprice := m.GetString("maxprice")
 	scope := m.GetString("scope")
 	publishtime := m.GetString("publishtime")
 	selectType := m.GetString("selectType")
@@ -778,6 +768,8 @@ func (m *Front) Wxsearchlist() error {
 	m.SetSession("toptype", toptype)
 	m.SetSession("subtype", subtype)
 	m.SetSession("industry", industry)
+	m.SetSession("minprice", minprice)
+	m.SetSession("maxprice", maxprice)
 	m.SetSession("scope", scope)
 	m.SetSession("publishtime", publishtime)
 	var list *[]map[string]interface{}
@@ -786,7 +778,7 @@ func (m *Front) Wxsearchlist() error {
 			if selectType == "" { //默认设置为全文搜索
 				selectType = "all"
 			}
-			list = getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, 1, selectType)
+			list = getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, 1, selectType)
 
 			r := redis.GetStr("other", "s_"+userid.(string))
 			arrs := strings.Split(r, ",")
@@ -831,6 +823,7 @@ func (m *Front) Wxsearchlist() error {
 
 //搜索结果,ajax分页请求
 func (m *Front) WxsearchlistPaging() {
+
 	defer util.Catch()
 	userid := m.GetSession("userId")
 	var list *[]map[string]interface{}
@@ -844,51 +837,53 @@ func (m *Front) WxsearchlistPaging() {
 		publishtime := m.GetString("publishtime")
 		selectType := m.GetString("selectType")
 		industry := m.GetString("industry")
-		list = getWxsearchlistData(searchvalue, searchname, scope, publishtime, subtype, industry, pageNum, selectType)
+		minprice := m.GetString("minprice")
+		maxprice := m.GetString("maxprice")
+		list = getWxsearchlistData(searchvalue, searchname, scope, publishtime, subtype, industry, minprice, maxprice, pageNum, selectType)
 
 		//历史记录和订阅查询
 		//if userId := m.GetSession("userId"); userId != nil {
-			one, _ := mongodb.FindOneByField("user", bson.M{"_id": bson.ObjectIdHex(userid.(string))}, `{"o_jy":1}`)
-			history := redis.GetStr("other", "s_"+userid.(string))
-			arrs := strings.Split(history, ",")
+		one, _ := mongodb.FindOneByField("user", bson.M{"_id": bson.ObjectIdHex(userid.(string))}, `{"o_jy":1}`)
+		history := redis.GetStr("other", "s_"+userid.(string))
+		arrs := strings.Split(history, ",")
 
-			if history == "" {
-				arrs = make([]string, 0)
-			}
-			var historyFlag = 0
-			for _, v := range arrs {
-				if v == strings.Trim(searchvalue, " ") {
-					historyFlag = 1
-					break
-				}
-			}
-			if historyFlag != 1 {
-				arrs = append(arrs, searchvalue)
-				if len(arrs) > 5 {
-					arrs = arrs[1:6]
-				}
-				redis.Del("other", "s_"+userid.(string))
-				redis.Put("other", "s_"+userid.(string), strings.Join(arrs, ","), -1)
+		if history == "" {
+			arrs = make([]string, 0)
+		}
+		var historyFlag = 0
+		for _, v := range arrs {
+			if v == strings.Trim(searchvalue, " ") {
+				historyFlag = 1
+				break
 			}
-			l := len(arrs) - 1
-			for i := 0; i < len(arrs)/2; i++ {
-				tmp := arrs[l-i]
-				arrs[l-i] = arrs[i]
-				arrs[i] = tmp
+		}
+		if historyFlag != 1 {
+			arrs = append(arrs, searchvalue)
+			if len(arrs) > 5 {
+				arrs = arrs[1:6]
 			}
-			m.T["history"] = arrs
+			redis.Del("other", "s_"+userid.(string))
+			redis.Put("other", "s_"+userid.(string), strings.Join(arrs, ","), -1)
+		}
+		l := len(arrs) - 1
+		for i := 0; i < len(arrs)/2; i++ {
+			tmp := arrs[l-i]
+			arrs[l-i] = arrs[i]
+			arrs[i] = tmp
+		}
+		m.T["history"] = arrs
 
-			if one != nil && len(*one) > 0 {
-				o_jy, _ := (*one)["o_jy"].(map[string]interface{})
-				a_key, _ := o_jy["a_key"].([]interface{})
-				var keys []interface{}
-				for _, v := range a_key {
-					keyMap, _ := v.(map[string]interface{})
-					key, _ := keyMap["key"].([]interface{})
-					keys = append(keys, key)
-				}
-				m.T["msgset"] = keys
+		if one != nil && len(*one) > 0 {
+			o_jy, _ := (*one)["o_jy"].(map[string]interface{})
+			a_key, _ := o_jy["a_key"].([]interface{})
+			var keys []interface{}
+			for _, v := range a_key {
+				keyMap, _ := v.(map[string]interface{})
+				key, _ := keyMap["key"].([]interface{})
+				keys = append(keys, key)
 			}
+			m.T["msgset"] = keys
+		}
 
 	}
 
@@ -916,14 +911,19 @@ func (m *Front) DelWxHistorySearch() {
 }
 
 //微信端搜索
-func getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry string, pageNum int, selectType string) (list *[]map[string]interface{}) {
-	query := getBidSearchQuery(scope, publishtime, subtype, industry) //scope是地区对应传进的areas, stype是类型对应scope
+func getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, minprice, maxprice string, pageNum int, selectType string) (list *[]map[string]interface{}) {
+	//scope是地区对应传进的areas, stype是类型对应scope
 	fmt.Print("keywords>>>", keywords, "searchvalue>>", searchvalue)
+	findfields := `"title"`
+	if selectType == "all" {
+		findfields = `"title","detail"`
+	}
+	qstr := getSearchQuery(searchvalue, industry, minprice, maxprice, findfields, getBidSearchQuery(scope, publishtime, subtype))
 	if len(keywords) > 0 {
 		if selectType == "all" { //全文搜索
-			list = elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"`, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize, true, false, 100)
+			list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize, 100, true)
 		} else { //标题搜索
-			list = elastic.GetByNgram(INDEX, TYPE, searchvalue, query, `"title"` /*FINDF*/, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize)
+			list = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, (pageNum-1)*wx_pageSize, wx_pageSize, 100, false)
 		}
 
 		if list != nil {
@@ -2048,7 +2048,7 @@ func (f *Front) SearchResult(at, name string) error {
 			if count1 < startPage || startPage < 0 {
 				startPage = 0
 			}
-			datas = elastic.GetPage(INDEX, TYPE, query, bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","biddingcontent","projectname"`, startPage, limitcount)
+			datas = elastic.GetPage(INDEX, TYPE, query, bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","s_subscopeclass","projectname"`, startPage, limitcount)
 			redis.Put("other", "classify_"+name, datas, 2*60*60)
 		} else {
 			b, _ := json.Marshal(list)
@@ -2203,3 +2203,68 @@ func (m *Front) Subscribe() error {
 	m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
 	return m.Render("/pc/subscribe.html", &m.T)
 }
+
+//获取高级查询所需的参数
+func getShouldQueryMap(findfield, searchvalue, industry string) []map[string]string {
+	mps := []map[string]string{}
+	for _, v := range strings.Split(industry, ",") {
+		mp := map[string]string{}
+		for _, v := range strings.Split(searchvalue, "+") {
+			mp[v] = findfield
+		}
+		mp[v] = "s_subscopeclass"
+		mps = append(mps, mp)
+	}
+	return mps
+}
+
+func getSearchQuery(keyword, industry, minprice, maxprice, findfields, mustquery string) (qstr string) {
+	multi_match := `{"multi_match": {"query": "%s","type": "phrase", "fields": [%s],"analyzer": "my_ngram"}}`
+	match_phrase := `{"match_phrase": {"s_subscopeclass": "%s"}}`
+	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
+	query_bool := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
+	rge := `{"range": {"bidamount": {%s}}},{"range": {"budget": {%s}}}`
+	gte := `"gte": %s`
+	lte := `"lte": %s`
+	bools := []string{}
+	if keyword != "" {
+		multi_match = fmt.Sprintf(multi_match, "%s", findfields)
+		shoulds := []string{}
+		for _, v := range strings.Split(keyword, "+") {
+			shoulds = append(shoulds, fmt.Sprintf(multi_match, elastic.ReplaceYH(v)))
+		}
+		bools = append(bools, fmt.Sprintf(elastic.NgramMust, strings.Join(shoulds, ",")))
+	}
+	if industry != "" {
+		shoulds := []string{}
+		for _, v := range strings.Split(industry, ",") {
+			shoulds = append(shoulds, fmt.Sprintf(match_phrase, ","+v+","))
+		}
+		bools = append(bools, fmt.Sprintf(query_bool, strings.Join(shoulds, ",")))
+	}
+	if minprice != "" || maxprice != "" {
+		sq := ``
+		if minprice != "" {
+			min, _ := strconv.ParseFloat(minprice, 64)
+			minprice = fmt.Sprintf("%.0f", min*10000)
+		}
+		if maxprice != "" {
+			max, _ := strconv.ParseFloat(maxprice, 64)
+			maxprice = fmt.Sprintf("%.0f", max*10000)
+		}
+		log.Println(minprice, maxprice)
+		if minprice != "0" {
+			sq += fmt.Sprintf(gte, minprice)
+		}
+		if minprice != "0" && maxprice != "0" {
+			sq += `,`
+		}
+		if maxprice != "0" {
+			sq += fmt.Sprintf(lte, maxprice)
+		}
+		bools = append(bools, fmt.Sprintf(query_bool, fmt.Sprintf(rge, sq, sq)))
+	}
+	qstr = fmt.Sprintf(query, mustquery, strings.Join(bools, ","), len(bools))
+	log.Println("getSearchQuery:", qstr)
+	return
+}

+ 3 - 2
src/jfw/jyutil/jyutil.go

@@ -109,8 +109,9 @@ func BidListConvert(industry string, list *[]map[string]interface{}) {
 	}
 	for _, v := range *list {
 		value := ""
-		biddingcontent, _ := v["biddingcontent"].([]interface{})
-		bct := util.ObjArrToStringArr(biddingcontent)
+		subscopeclass, _ := v["s_subscopeclass"].(string)
+		subscopeclass = strings.Trim(subscopeclass, ",")
+		bct := strings.Split(subscopeclass, ",")
 		if bct == nil || len(bct) == 0 {
 			continue
 		}

+ 9 - 0
src/web/staticres/css/wxlist.css

@@ -58,4 +58,13 @@
 	padding: 1px 3px;
 	color: #fff;
 	font-size: 14px;
+}
+.restime span.industry{
+	border: 1px solid #25c78c;
+	background:#25c78c;
+	border-radius: 3px;
+	margin: 0px 5px;
+	padding: 1px 3px;
+	color: #fff;
+	font-size: 14px;
 }

+ 11 - 3
src/web/templates/weixin/search/superSearch.html

@@ -239,7 +239,6 @@
                     industrySelect+=($(this).attr("data-value"))+",";
                 }
             });
-            console.log(industrySelect.substring(0,industrySelect.length-1));
             reqParam.industry=industrySelect.substring(0,industrySelect.length-1);
 
             //信息类型
@@ -391,7 +390,16 @@
                 if(area != ""){
                     area = '<span class="location">'+area+'</span>';
                 }
-
+				//行业
+				var industry=list[i].industry;
+				if(!industry){
+                    industry="";
+				}else{
+                    industry=$.trim(industry);
+				}
+				if(industry!=""){
+                    industry='<span class="industry">'+industry+'</span>';
+				}
 
                 //时间
                 var tdf = list[i].publishtime;
@@ -435,7 +443,7 @@
                     +'</div>'
                     +'<div style="clear:both;"></div>'
                     +'<div class="restime time-diff">'
-                    +area+datatype+tdf
+                    +area+datatype+industry+tdf
                     +'</div>'
                     +'<div style="clear:both;"></div>'
                     +detail