Prechádzať zdrojové kódy

Merge branch 'dev2.0' of http://192.168.3.17/gitlab/qmx/jy into dev2.0

wangshan 8 rokov pred
rodič
commit
23cb23540f

+ 0 - 10
.gitignore

@@ -1,10 +0,0 @@
-pkg
-bin
-.project
-extend
-*/pkg
-*.exe
-*.log
-*/src/src
-*.data
-*/bin

+ 0 - 8
.idea/misc.xml

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-<<<<<<< HEAD
-  <component name="GOROOT" path="/usr/local/go" />
-=======
-  <component name="GOROOT" path="C:/go" />
->>>>>>> b673ea6b82d098a5040ba1bd5d56ac194a55394d
-</project>

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

@@ -15,7 +15,7 @@ import (
 
 type Entsearch struct {
 	*xweb.Action
-	bidsearchforent  xweb.Mapper `xweb:"/jylab/bidsearchforent.html"`
+	bidsearchforent  xweb.Mapper `xweb:"/jylab/bidsearchforent/index.html"`
 	pcSearchZbqyAjax xweb.Mapper `xweb:"/jylab/pcSearchZbqyAjax"`
 }
 
@@ -28,8 +28,8 @@ func (e *Entsearch) Bidsearchforent() error {
 	searchvalue := e.GetString("searchvalue")
 	area := e.GetString("area")
 	pricetype := e.GetString("pricetype")
-	minprice, _ := strconv.Atoi(e.GetString("minprice"))
-	maxprice, _ := strconv.Atoi(e.GetString("maxprice"))
+	minprice, _ := strconv.ParseFloat(e.GetString("minprice"), 64)
+	maxprice, _ := strconv.ParseFloat(e.GetString("maxprice"), 64)
 	if pricetype == "y" {
 		//搜索minprice和maxprice价格区间的数据
 	}
@@ -84,8 +84,8 @@ func (e *Entsearch) PcSearchZbqyAjax() error {
 	searchvalue := e.GetString("searchvalue")
 	area := e.GetString("area")
 	pricetype := e.GetString("pricetype")
-	minprice, _ := strconv.Atoi(e.GetString("minprice"))
-	maxprice, _ := strconv.Atoi(e.GetString("maxprice"))
+	minprice, _ := strconv.ParseFloat(e.GetString("minprice"), 64)
+	maxprice, _ := strconv.ParseFloat(e.GetString("maxprice"), 64)
 
 	if pricetype == "y" {
 		//搜索minprice和maxprice价格区间的数据

+ 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 - 3
src/jfw/jylabutil/entsearch.go

@@ -66,19 +66,19 @@ func getSearchQuery(area string, lower, upper float64) string {
 		if len(query) > 0 {
 			query += ","
 		}
-		query += `{"range":{"bidamount":{"gte":` + fmt.Sprint(lower) + `,"lte":` + fmt.Sprint(upper) + `}}}`
+		query += `{"range":{"bidamount":{"gte":` + fmt.Sprint(lower*10000) + `,"lte":` + fmt.Sprint(upper*10000) + `}}}`
 	} else {
 		if lower > 0 {
 			if len(query) > 0 {
 				query += ","
 			}
-			query += `{"range":{"bidamount":{"gte":` + fmt.Sprint(lower) + `}}}`
+			query += `{"range":{"bidamount":{"gte":` + fmt.Sprint(lower*10000) + `}}}`
 		}
 		if upper > 0 {
 			if len(query) > 0 {
 				query += ","
 			}
-			query += `{"range":{"bidamount":{"lte":` + fmt.Sprint(upper) + `}}}`
+			query += `{"range":{"bidamount":{"lte":` + fmt.Sprint(upper*10000) + `}}}`
 		}
 	}
 	return query

+ 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
 		}

+ 14 - 7
src/jfw/modules/entsesearch/src/search/entsesearch.go

@@ -47,16 +47,23 @@ func (e *EntSeSearch) RecList() {
 func (e *EntSeSearch) ProList() {
 	var searchname = e.GetString("searchname")
 	var scope = e.GetString("scope")
-	//var money = e.GetString("money")
-	var money_from,_ = strconv.Atoi(e.GetString("money_from"))
-	var money_to,_ = strconv.Atoi(e.GetString("money_to"))
+	var money_from = e.GetString("money_from")
+	var money_to = e.GetString("money_to")
+	var money_from_p = float64(0)
+	var money_to_p = float64(0)
+	if money_from !=""{
+		money_from_p,_ = strconv.ParseFloat(money_from, 64)
+	}
+	if money_to !=""{
+		money_to_p,_ = strconv.ParseFloat(money_to, 64)
+	}
 	var pageNum,_ = strconv.Atoi(e.GetString("pageNum"))
-	fmt.Println(searchname,scope,money_from,money_to)
+
+	fmt.Println(searchname,scope,money_from_p,money_to_p)
 	proList := make([]map[string]interface{},0)
-	fmt.Println("proList------------------1",proList)
 	if pageNum<=wx_maxPageNum {
-		proList = jylabutil.GetProjectByEntName(searchname,scope,money_from,money_to,pageNum,wx_pageSize)
-		fmt.Println("proList------------------2",proList)
+		proList = jylabutil.GetProjectByEntName(searchname,scope,money_from_p,money_to_p,pageNum,wx_pageSize)
+		fmt.Println("proList------------------2",len(proList))
 		for _,val := range proList{
 			var jgtime = val["jgtime"]
 			if jgtime!=nil{

BIN
src/jfw/modules/entsesearch/src/web/staticres/jylab/entsesearch/images/wx/jysorry_1.png


BIN
src/jfw/modules/entsesearch/src/web/staticres/jylab/entsesearch/images/wx/jyyjfk.png


+ 27 - 12
src/jfw/modules/entsesearch/src/web/templates/weixin/entseSearch.html

@@ -189,9 +189,9 @@
 	transform: translateZ(0);
 }
 .select{
-	height:40px;
+	height:45px;
 	width:100%;
-	line-height:40px;
+	line-height:45px;
 	border-bottom: 1px solid #ccc;
 }
 .select ul li{
@@ -202,15 +202,15 @@
 }
 .select ul li img{
 	width: 10px;
-    padding-bottom: 5px;
+    padding-bottom: 3px;
     margin-left: 8px;
 }
 .shuxian{
 	border-right: 1px solid #ccc;
     color: #2cb7ca;
-    line-height: 30px;
-    height: 30px;
-    margin-top: 4px;
+    line-height: 35px;
+    height: 35px;
+    margin-top: 5px;
 }
 .selecter{
 	padding:10px;
@@ -248,6 +248,7 @@
 }
 .money-inp input{
 	width:100%;
+	padding-right: 45px;
 }
 .money-inp .min-price{
 	width:42%;
@@ -320,7 +321,7 @@
 }
 
 #jytables{
-	//padding: .3rem;
+	/*padding: .3rem;*/
 	padding-bottom: .3rem;
 	padding-top: .4rem;
 }
@@ -374,14 +375,14 @@
 }
 
 #wrapper,.nullcontent{
-	//padding:0px 20px;
+	/*padding:0px 20px;*/
 	padding:0px 15px;
 	background-color:#fff;
 }
 .nullcontent{
 	padding-top: 10%;
 	position: absolute;
-	top: 125px;
+	top: 65px;
 	left: 0px;
 	right: 0px;
 	border-top: 1px solid #f4f4f9;
@@ -428,12 +429,16 @@
 						<li>价格区间</li>
 						<li class="money-inp">
 							<div class="min-price">
-								<input class="form-control money-input" id="money_from"  placeholder="最低价" type="number"/>
+								<input class="form-control money-input" id="money_from"  placeholder="最低价" type="number"
+									   onkeyup="(this.v=function(){this.value=/^\d+(\.\d{0,2})?$/.test(this.value)==true?this.value:'';}).call(this)"
+									   onblur="this.v();"/>
 								<span class="min-unit">万元</span>
 								<span class="fgx"></span>
 							</div>
 							<div class="max-price">
-								<input class="form-control money-input"  id="money_to" placeholder="最高价" type="number"/>
+								<input class="form-control money-input"  id="money_to" placeholder="最高价" type="number"
+									   onkeyup="(this.v=function(){this.value=/^\d+(\.\d{0,2})?$/.test(this.value)==true?this.value:'';}).call(this)"
+									   onblur="this.v();"/>
 								<span class="max-unit">万元</span>
 							</div>
 						</li>
@@ -532,8 +537,17 @@
 	<div class="tip_m">提示:为了获得更佳的体验,推荐使用电脑浏览器访问剑鱼网站jianyu360.com查看数据表格。</div>
 </div>
 <!--no data-->
+<!--<div class="nullcontent text-center  hidden">-->
+	<!--<div style="font-size:16px;color:#1d1d1d;">没有找到和该企业匹配的中标项目信息</div>-->
+<!--</div>-->
 <div class="nullcontent text-center  hidden">
-	<div style="font-size:16px;color:#1d1d1d;">没有找到和该企业匹配的中标项目信息</div>
+	<div >
+		<img style="width:150px;margin:0px 0 50px 0;" src="/jylab/entsesearch/images/wx/jysorry_1.png">
+	</div>
+	<div style="font-size:16px;color:#1d1d1d;">没有找到和该关键词匹配的信息</div>
+	<div style="width:100%;" class="text-center">
+		<img onClick="window.open('/swordfish/feedback')" style="width: 200px;margin-top: 25px;" src="/jylab/entsesearch/images/wx/jyyjfk.png">
+	</div>
 </div>
 </body>
 <script>
@@ -568,6 +582,7 @@
                 $(".tubiao").addClass("hidden");
                 $(".jydqsure").css("background","#ccc");
                 $(".jydqsure").removeClass("jydqsure_active");
+                $("#recList").hide();
             }
         });
 

+ 9 - 0
src/jfw/modules/followent/src/followent/followent.go

@@ -34,6 +34,9 @@ func init() {
 
 func (f *FollowEnt) EntList() error {
 	defer util.Catch()
+	if f.Session().Get("s_m_openid") == nil{
+		return f.Redirect("/swordfish/about")
+	}
 	f.T["followLimit"] = config.Sysconfig["followentlimit"]
 	datas, ok := mongodb.Find("jylab_followent", `{"s_userid":"`+f.GetSession("userId").(string)+`","s_entname":{$ne:""}}`, `{"l_createtime":-1}`, `{"_id":1,"s_entname":1,"s_userid":1,"s_openid":1,"l_createtime":1,"s_id":1,"i_ispush":1}`, false, 0, 10)
 	f.T["flag"] = false
@@ -72,6 +75,9 @@ func (f *FollowEnt) SaveEnt() {
 //企业最新信息
 func (f *FollowEnt) NewInfo(winner, id string) error {
 	defer util.Catch()
+	if f.Session().Get("s_m_openid") == nil{
+		return f.Redirect("/swordfish/about")
+	}
 	userId := f.GetSession("userId").(string) //用户id
 	var follow = "n"
 	s_id := ""
@@ -117,6 +123,9 @@ func (f *FollowEnt) NewInfo(winner, id string) error {
 //取消企业关注
 func (f *FollowEnt) QgFollow() error {
 	defer util.Catch()
+	if f.Session().Get("s_m_openid") == nil{
+		return f.Redirect("/swordfish/about")
+	}
 	status := "n"
 	userId := f.GetSession("userId").(string)
 	id := f.GetString("id")

+ 3 - 0
src/jfw/modules/followent/src/followent/myfwent.go

@@ -24,6 +24,9 @@ func init() {
 //
 func (m *Myfwent) Addfwent() error {
 	defer util.Catch()
+	if m.Session().Get("s_m_openid") == nil{
+		return m.Redirect("/swordfish/about")
+	}
 	userId := m.GetSession("userId").(string)
 	openid := m.GetSession("s_m_openid").(string)
 	followId := ""

+ 1 - 1
src/jfw/modules/push/src/qfw/push/dopush/dopushes.go

@@ -138,7 +138,7 @@ func PushInfoByEs(MaxPushSize int, Config *map[string]interface{}, i_ratemode in
 	} else {
 		q["o_jy.i_ratemode"] = i_ratemode
 	}
-	q["s_m_openid"] = "oHwE_wI94DGaSDks9ky5Yj8qqSx8"
+	//q["s_m_openid"] = "oHwE_wI94DGaSDks9ky5Yj8qqSx8"
 	query := session.DB("qfw").C("user").Find(&q).Select(&map[string]interface{}{
 		"_id":        1,
 		"o_jy":       1,

+ 1 - 0
src/jfw/modules/push/src/xlsx/readme.txt

@@ -0,0 +1 @@
+excel数据导出临时目录

+ 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;
 }

+ 38 - 16
src/web/templates/pc/biddingsearch_enterprise.html

@@ -14,7 +14,6 @@
 		<link href="/css/dev2/biddingSearch1.css?v={{Msg "seo" "version"}}" rel="stylesheet">
 		<script src="/js/jquery.cookie.js"></script>
 		<script src="/js/biddingSearch.js?v={{Msg "seo" "version"}}"></script>
-		<script type="text/javascript" src="/js/entsearchscript.js"></script>
 		<script language="javascript" type="text/javascript" src="/My97DatePicker/WdatePicker.js"></script>
 		
 		<style type="text/css">
@@ -107,6 +106,25 @@
 			    left: 198px;
 			    top: 148px;
 			}
+			#labmodalbody .code-close{
+				width: 40px;
+			    height: 40px;
+			    position: absolute;
+			    right: 40px;
+			    top: -20px;
+			    cursor: pointer;
+			    -webkit-transition: all 1s;
+			    -o-transition: all 1s;
+			    -moz-transition: all 1s;
+			    transition: all 1s;
+			}
+			#labmodalbody .code-close:hover{
+				-webkit-transform: scale(1.2);
+				   -moz-transform: scale(1.2);
+				    -ms-transform: scale(1.2);
+				     -o-transform: scale(1.2);
+				        transform: scale(1.2);
+			}
 			.layheader{
 				position: absolute;
 			    color: #fff;
@@ -144,6 +162,7 @@
 		    <div class="modal-dialog">
 		        <div class="modal-content" id="labmodalcont">
 		            <div class="modal-body" id="labmodalbody">
+					<img class="code-close" src="/images/j-wx-code-close.png" alt="" onclick="labClose();">
 						<div class="layheader">
 							<div>超级搜索</div>
 							<div>按行业、金额搜索、结果可按表格显示</div>
@@ -163,15 +182,15 @@
 				<div class="w searchHeader-container">
 					<!--整体页面切换tab-->
 					<div class="control-tabBtn">
-						<a href="#">超级搜索</a>
+						<a href="/jylab/supsearch/index.html">超级搜索</a>
 						<a href="#" class="on">中标企业搜索</a>
 					</div>
 					<!--搜索-->
 					<div class="searchInput clearfix">
-						<form action="/jylab/bidsearchforent" method="post" id="zbSeatchT" class="clearfix" onsubmit="return true">
+						<form action="/jylab/bidsearchforent/index.html" method="post" id="zbSeatchT" class="clearfix" onsubmit="return true">
 							<input class="searchname" autocomplete="off" type="search" name="keywords" id="searchinput" value="{{.T.searchvalue}}" placeholder="高速公路" />
 
-							<input type="button" class="searchBtn" value="搜索" />
+							<input type="submit" class="searchBtn" value="搜索" />
 							<!--<div class="searchSlideText">
 								<ul>
 									<li>大连<i>万达集团</i>股份有限公司北京投资管理分公司</li>
@@ -424,11 +443,18 @@
 		
 		$(function(){
 			haslogin({{.T.logid}});
+			$(".j-nav .j-nav-link:eq(2)").addClass("active");
+			$(window).scroll(function(){
+				if($(this).scrollTop() > 0){
+				$("#backTop").show();
+				}else{
+					$("#backTop").hide();
+				}
+			});
 			
 			//筛选关闭和打开
 			//根据cookie值设置筛选是否显示
 			var rsw = localStorage.getItem("entstore");
-			console.log("00000"+rsw);
 			if(rsw == null){
 				setTimeout(function(){
 					$(".searchTender").stop(false,true).slideDown(1000);
@@ -500,14 +526,9 @@
 			//点击超级搜索按钮
 			$(".superSearch").click(function(){
 				$("#labModal").modal("show");
-			})
-			
-			//关闭登录二维码
-			$(".code-close").click(function(){
-				$("#bidLogin").modal("hide");
-			})
-			
+			})	
         });
+		
 		function beforeSubmit(){			
 			//地区
 			var selectAreas = "";
@@ -531,14 +552,10 @@
 			//搜索关键词
 			var searchname = $("#zbSeatchT input[name='keywords']").val();
 			$("#zbSeatchT input[name='searchvalue']").val($.trim(searchname))
-			console.log("关键词============"+searchname);
 			if(submitflag){	
 				if($.trim(searchname) != ""){
-					console.log("搜索关键词不为空");
 					getTableInfo();
 				}else{
-					console.log("搜索关键词为空"+"--------------------");
-					
 					$(".tabTitle").removeClass("hidden");
 					$(".lucene").attr("style","display:block");
 					$(".lucene-table").attr("style","display:none");
@@ -572,6 +589,11 @@
 				
 			});
 		}
+		
+		//关闭超级搜索遮罩层
+		function labClose(){
+			$("#labModal").modal("hide");
+		}
 	</script>
 	</body>
 

+ 3 - 2
src/web/templates/weixin/search/mainSearch.html

@@ -2,7 +2,6 @@
 <head>
     <title>搜索</title>
     <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
-    <meta name="viewport" content="width=device-width, initial-scale=1">
     <meta name="renderer" content="webkit">
     <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0" user-scalable="no" />
     <meta charset="utf-8">
@@ -180,6 +179,8 @@
                     });
                 }
             })
+			$("#superSearch").click(function(){window.location.href='/jylab/superSearch';});
+			$("#entseSearch").click(function(){window.location.href='/jylab/entsesearch/search';});
         });
         document.onkeydown = function(e){
             if(!e){
@@ -233,7 +234,7 @@
 <body class="mainSearch">
 <!-->顶部搜索<-->
 <div id="searchDiv">
-    <form class="searchform" id="searchform" method="post" action="/jylab/superSearch">
+    <form class="searchform" id="searchform" method="get" action="/jylab/superSearch">
         <div class="wxhead">
             <input class="form-control searchvalue" id="searchvalue" name="searchvalue" maxlength ="50" value="{{if .T.shname}}{{.T.shname}}{{end}}" placeholder="示例:税务局 软件"/>
             <div class="inputDiv hidden">

+ 22 - 7
src/web/templates/weixin/search/superSearch.html

@@ -36,7 +36,8 @@
             "scope": "",
             "publishtime": "",
             "selectType": "",
-            "money":"",
+            "minprice":"",
+			"maxprice":"",
             "industry":"",
             "pageNum": 1
         };
@@ -239,7 +240,6 @@
                     industrySelect+=($(this).attr("data-value"))+",";
                 }
             });
-            console.log(industrySelect.substring(0,industrySelect.length-1));
             reqParam.industry=industrySelect.substring(0,industrySelect.length-1);
 
             //信息类型
@@ -268,9 +268,15 @@
             //金额
             var moneyRange=$(".money-dialog .active").attr("data-value");
             if(moneyRange!="all"){
-                moneyRange=$(".money-dialog .money-inp .minMrice").val()+"-"+$(".money-dialog .money-inp .maxMrice").val()
-            }
-            reqParam.money=moneyRange;
+                //moneyRange=$(".money-dialog .money-inp .minMrice").val()+"-"+$(".money-dialog .money-inp .maxMrice").val()
+       			reqParam.minprice=$(".money-dialog .money-inp .minMrice").val()
+				reqParam.maxprice=$(".money-dialog .money-inp .maxMrice").val()
+			}else{
+				reqParam.minprice="";
+				reqParam.maxprice="";
+			}
+			
+            //reqParam.money=moneyRange;
 
             //日期
             reqParam.publishtime=setPublishtime();
@@ -391,7 +397,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 +450,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