renzheng 7 жил өмнө
parent
commit
5524946fda
44 өөрчлөгдсөн 776 нэмэгдсэн , 870 устгасан
  1. 4 3
      src/config.json
  2. 49 308
      src/jfw/front/entsearch.go
  3. 1 1
      src/jfw/front/follow.go
  4. 1 1
      src/jfw/front/front.go
  5. 9 3
      src/jfw/front/search.go
  6. 5 10
      src/jfw/front/shorturl.go
  7. 19 101
      src/jfw/front/supsearch.go
  8. 39 32
      src/jfw/front/swordfish.go
  9. 10 5
      src/jfw/jylabutil/entsearch.go
  10. 1 1
      src/jfw/modules/entsesearch/src/config.json
  11. 1 1
      src/jfw/modules/entsesearch/src/main.go
  12. 1 1
      src/jfw/modules/entsesearch/src/search/entsesearch.go
  13. 1 1
      src/jfw/modules/followent/src/config.json
  14. 1 6
      src/jfw/modules/followent/src/followent/followent.go
  15. 1 1
      src/jfw/modules/followent/src/followent/myfwent.go
  16. 1 1
      src/jfw/modules/followent/src/main.go
  17. 4 3
      src/jfw/modules/push/src/config.json
  18. 30 6
      src/jfw/modules/push/src/main.go
  19. 2 2
      src/jfw/modules/push/src/qfw/push/bid/fixpushjob.go
  20. 1 1
      src/jfw/modules/push/src/qfw/push/cache.go
  21. 138 21
      src/jfw/modules/push/src/qfw/push/dopush/dopushes.go
  22. 1 1
      src/jfw/modules/pushent/src/config.json
  23. 1 1
      src/jfw/modules/pushent/src/followpush/push.go
  24. 1 1
      src/jfw/modules/pushent/src/main.go
  25. 1 1
      src/jfw/modules/pushproject/src/config.json
  26. 254 252
      src/jfw/modules/pushproject/src/followpush/push.go
  27. 1 1
      src/jfw/modules/pushproject/src/main.go
  28. 15 10
      src/jfw/modules/weixin/src/config.json
  29. 28 22
      src/jfw/modules/weixin/src/wx/wx.go
  30. 1 1
      src/jfw/rpcfollow/rpc.go
  31. 1 1
      src/main.go
  32. 1 1
      src/seo.json
  33. 6 2
      src/web/staticres/css/dev2/biddingSearch.css
  34. 3 1
      src/web/staticres/css/wxsearch.css
  35. BIN
      src/web/staticres/images/wxreply/reply_1.png
  36. 22 5
      src/web/staticres/js/proproject.js
  37. 18 5
      src/web/staticres/js/superSearch.js
  38. 9 8
      src/web/staticres/js/wxEntsesearch.js
  39. 54 37
      src/web/staticres/js/wxSupersearch.js
  40. 12 1
      src/web/templates/active/ext-tengxun.html
  41. 22 9
      src/web/templates/pc/biddingsearch_enterprise.html
  42. 1 0
      src/web/templates/pc/proproject.html
  43. 1 0
      src/web/templates/pc/supsearch.html
  44. 4 1
      src/web/templates/weixin/search/mainSearch.html

+ 4 - 3
src/config.json

@@ -4,7 +4,7 @@
     "mongodbName": "qfw",
     "influxaddr": "http://192.168.3.207:8086",
     "influxdb": "jy_logs",
-    "elasticsearch": "http://192.168.3.18:9800",
+    "elasticsearch": "http://192.168.3.18:9200",
     "elasticPoolSize": 30,
     "redisaddrs": "other=192.168.3.14:3379,push=192.168.3.14:3379,sso=192.168.3.14:3379,session=192.168.3.14:3379",
     "webport": "8089",
@@ -12,7 +12,7 @@
     "weixinrpc": "127.0.0.1:8083",
     "cacheflag": false,
     "agreement": "http",
-    "webdomain": "http://webws.qmx.top",
+    "webdomain": "http://webwcj.qmx.top",
     "redirect": {
         "searchinfo": "/jylab/mainSearch",
         "rssset": "/wxkeyset/keyset/index",
@@ -34,7 +34,8 @@
         "zqluckdraw": "/active/zqLuckdraw",
 		"followent":"/jylab/followent/entList",
 		"labindex":"/jylab/index",
-		"qrToLab":"/jylab/qrToLab/%s"
+		"qrToLab":"/jylab/qrToLab/%s",
+		"searchKeyword":"/jylab/searchKeyword/%s"
     },
     "jy_activeset": {
         "activitystartcode": "3201000000",

+ 49 - 308
src/jfw/front/entsearch.go

@@ -4,10 +4,8 @@ import (
 	"fmt"
 	"jfw/config"
 	"jfw/jylabutil"
-	"jfw/jyutil"
 	"math/rand"
 	"qfw/util"
-	"qfw/util/redis"
 	"strconv"
 	"time"
 
@@ -18,8 +16,7 @@ import (
 type Entsearch struct {
 	*xweb.Action
 
-	bidsearchforentindex xweb.Mapper `xweb:"/jylab/bidsearchforent/index.html"`
-	//	bidsearchforent       xweb.Mapper `xweb:"/jylab/bidsearchforent/list.html"`
+	bidsearchforentindex  xweb.Mapper `xweb:"/jylab/bidsearchforent/index.html"`
 	pcSearchZbqyAjax      xweb.Mapper `xweb:"/jylab/pcSearchZbqyAjax"`
 	recList               xweb.Mapper `xweb:"/jylab/bidsearchforent/recList"`
 	searchEntAndSupStatus xweb.Mapper `xweb:"/jylab/searchEntAndSupStatus"`
@@ -59,92 +56,11 @@ func (e *Entsearch) Bidsearchforentindex() error {
 		minprice = 0
 		maxprice = 0
 	}
-	var status = 0
-	var count int64
-	var Lastlist *[]map[string]interface{}
 	if len(searchvalue) > 0 {
-		list := []map[string]interface{}{}
-		list = jylabutil.GetProjectByEntName(searchvalue, area, minprice, maxprice, 1, 50)
-
-		for k, v := range list {
-			v["k"] = k + 1
-			if v["area"] == "A" {
-				v["area"] = ""
-			}
-			t1 := time.Unix(util.Int64All(v["publishtime"]), 0)
-			v["time1"] = util.TimeDiff(t1)
-			if v["jgtime"] != "" && v["jgtime"] != nil {
-				t2 := time.Unix(util.Int64All(v["jgtime"]), 0)
-				timeStr := t2.Format("2006-01-02")
-				v["time2"] = timeStr
-			} else {
-				v["time2"] = ""
-			}
-			if v["bidamount"] != nil {
-				v["bidamount"] = fmt.Sprintf("%.2f", v["bidamount"])
-			}
-			itemList := v["list"].([]interface{})
-			var subtypeid string
-			var bidstatusid string
-			for _, j := range itemList {
-				z := j.(map[string]interface{})
-				if (z["subtype"] == "中标" || z["subtype"] == "成交") && z["winner"] == searchvalue {
-					subtypeid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-				} else if (z["bidstatus"] == "中标" || z["bidstatus"] == "成交") && z["winner"] == searchvalue {
-					bidstatusid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-				}
-				v["linkid"] = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-			}
-			if subtypeid != "" {
-				v["linkid"] = subtypeid
-			} else if bidstatusid != "" {
-				v["linkid"] = bidstatusid
-			}
-		}
-		e.T["list"] = list
-	} else if e.Method() == "POST" {
-		mine := e.GetString("minprice")
-		maxe := e.GetString("maxprice")
-		if area == "" && mine == "" && maxe == "" {
-			if redis.Get("other", "index_listbident") == nil {
-				NewbidsForIndex()
-				data := redis.Get("other", "index_listbident").([]interface{})
-				e.T["list"] = data[0]
-			} else {
-				data := redis.Get("other", "index_listbident").([]interface{})
-				e.T["list"] = data[0]
-			}
-		} else {
-			status = 2
-			count, Lastlist = getLastNewsData("", area, "", "", "", mine, maxe, "", 0, true, true)
-		}
+		e.T["count"], e.T["totalPage"], e.T["list"] = getSearchResult(searchvalue, area, minprice, maxprice, 1)
 	} else {
 		e.DisableHttpCache()
-		NewbidsForIndex()
-		data := redis.Get("other", "index_listbident").([]interface{})
-		e.T["list"] = data[0]
-	}
-	if status == 2 {
-		if Lastlist != nil {
-			for _, v := range *Lastlist {
-				v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
-				stp, _ := v["subtype"].(string)
-				if stp == "" {
-					stp, _ = v["toptype"].(string)
-				}
-				area, _ := v["area"].(string)
-				ind := util.ObjToString(v["industry"])
-				v["stypeadd"], v["areaadd"], v["indadd"] = classify(stp, area, ind)
-				//正文匹配检索关键词
-				highlight, _ := v["highlight"].(map[string][]string)
-				detail := ""
-				for _, val := range highlight["detail"] {
-					detail += clearHtml.ReplaceAllString(val, "")
-				}
-				v["detail"] = detail
-			}
-		}
-		e.T["list"] = Lastlist
+		e.T["list"] = Newbids("")[0]
 	}
 	if minprice == 0 {
 		e.T["minprice"] = ""
@@ -158,12 +74,49 @@ func (e *Entsearch) Bidsearchforentindex() error {
 	}
 	e.T["searchvalue"] = searchvalue
 	e.T["area"] = area
-	e.T["count"] = count
 	e.T["pricetype"] = pricetype
 	e.T["shareid"] = se.EncodeString(shareid)
 
 	return e.Render("/pc/biddingsearch_enterprise.html", &e.T)
 }
+func getSearchResult(searchvalue, area string, minprice, maxprice float64, currentPage int) (int, int, []map[string]interface{}) {
+	if currentPage > pc_maxPageNum {
+		currentPage = pc_maxPageNum
+	}
+	count, list := jylabutil.GetProjectByEntName(searchvalue, area, minprice, maxprice, `"projectname","jgtime","bidamount","list","sourceinfoid"`, currentPage, pc_pageSize, true)
+	limitCount := pc_pageSize * pc_maxPageNum
+	if count > limitCount {
+		count = limitCount
+	}
+	totalPage := (count + pc_pageSize - 1) / pc_pageSize
+	for _, v := range list {
+		if v["bidamount"] != nil {
+			v["bidamount"] = fmt.Sprintf("%.2f", v["bidamount"])
+		}
+		itemList := v["list"].([]interface{})
+		delete(v, "list")
+		var subtypeid string
+		var bidstatusid string
+		for _, j := range itemList {
+			z := j.(map[string]interface{})
+			if (z["subtype"] == "中标" || z["subtype"] == "成交") && z["winner"] == searchvalue {
+				subtypeid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
+			} else if (z["bidstatus"] == "中标" || z["bidstatus"] == "成交") && z["winner"] == searchvalue {
+				bidstatusid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
+			}
+			v["linkid"] = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
+		}
+		if subtypeid != "" {
+			v["linkid"] = subtypeid
+		} else if bidstatusid != "" {
+			v["linkid"] = bidstatusid
+		}
+		if v["linkid"] == nil {
+			v["linkid"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["sourceinfoid"]))
+		}
+	}
+	return count, totalPage, list
+}
 
 //异步请求方法
 func (e *Entsearch) PcSearchZbqyAjax() error {
@@ -173,8 +126,7 @@ func (e *Entsearch) PcSearchZbqyAjax() error {
 	pricetype := e.GetString("pricetype")
 	minprice, _ := strconv.ParseFloat(e.GetString("minprice"), 64)
 	maxprice, _ := strconv.ParseFloat(e.GetString("maxprice"), 64)
-	currentPage, _ := strconv.Atoi(e.GetString("currentPage"))
-	tabularflag := e.GetString("tabularflag")
+	currentPage, _ := e.GetInteger("currentPage")
 	if pricetype == "y" {
 		//搜索minprice和maxprice价格区间的数据
 	}
@@ -185,231 +137,20 @@ func (e *Entsearch) PcSearchZbqyAjax() error {
 	}
 
 	if len(searchvalue) > 0 {
-		list := []map[string]interface{}{}
-		list = jylabutil.GetProjectByEntName(searchvalue, area, minprice, maxprice, currentPage, 50)
-		//jyutil.BidListConvert("", &list)
-
-		for k, v := range list {
-			v["k"] = k + 1 + (currentPage-1)*50
-			if v["area"] == "A" {
-				v["area"] = ""
-			}
-			t1 := time.Unix(util.Int64All(v["createtime"]), 0)
-			v["time1"] = util.TimeDiff(t1)
-			if v["jgtime"] != "" && v["jgtime"] != nil {
-				t2 := time.Unix(util.Int64All(v["jgtime"]), 0)
-				timeStr := t2.Format("2006-01-02")
-				v["time2"] = timeStr
-			} else {
-				v["time2"] = ""
-			}
-			if v["bidamount"] != nil {
-				v["bidamount"] = fmt.Sprintf("%.2f", v["bidamount"])
-			}
-			itemList := v["list"].([]interface{})
-			var subtypeid string
-			var bidstatusid string
-			for _, j := range itemList {
-				z := j.(map[string]interface{})
-				if z["subtype"] == "中标" || z["subtype"] == "成交" {
-					subtypeid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-				} else if z["bidstatus"] == "中标" || z["bidstatus"] == "成交" {
-					bidstatusid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-				}
-				v["linkid"] = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-			}
-			if subtypeid != "" {
-				v["linkid"] = subtypeid
-			} else if bidstatusid != "" {
-				v["linkid"] = bidstatusid
-			}
-		}
+		count, totalPage, list := getSearchResult(searchvalue, area, minprice, maxprice, currentPage)
 		e.ServeJson(map[string]interface{}{
-			"list": list,
+			"list":      list,
+			"count":     count,
+			"totalPage": totalPage,
 		})
 	} else {
-		if area == "" && minprice == 0 && maxprice == 0 {
-			data := redis.Get("other", "index_listbident").([]interface{})
-			e.ServeJson(map[string]interface{}{
-				"list": data[currentPage-1],
-			})
-		} else {
-			var list *[]map[string]interface{}
-			minpriceStr := strconv.FormatFloat(minprice, 'E', -1, 64)
-			maxpriceStr := strconv.FormatFloat(maxprice, 'E', -1, 64)
-			_, list = getLastNewsData(searchvalue, area, "", "", "", minpriceStr, maxpriceStr, tabularflag, (currentPage-1)*50+1, true, false)
-			for k, v := range *list {
-				v["k"] = (k + 1) + (currentPage-1)*50
-				if v["area"] == "A" {
-					v["area"] = ""
-				}
-				t := time.Unix(util.Int64All(v["publishtime"]), 0)
-				v["timetemp"] = fmt.Sprint(util.Int64All(v["publishtime"]))
-				v["linkid"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
-				v["time1"] = util.TimeDiff(t)
-				if v["jgtime"] != "" && v["jgtime"] != nil {
-					t2 := time.Unix(util.Int64All(v["jgtime"]), 0)
-					timeStr := t2.Format("2006-01-02")
-					v["time2"] = timeStr
-				} else {
-					v["time2"] = ""
-				}
-				var stp = ""
-				if v["subtype"] != nil {
-					stp, _ = v["subtype"].(string)
-				} else {
-					stp = ""
-				}
-				if stp == "" && v["toptype"] != nil {
-					stp, _ = v["toptype"].(string)
-				}
-				area, _ := v["area"].(string)
-				ind := util.ObjToString(v["industry"])
-				v["stypeadd"], v["areaadd"], v["indadd"] = classify(stp, area, ind)
-				v["bidtype"] = stp
-				if v["bidamount"] != nil {
-					v["bidamount"] = fmt.Sprintf("%.2f", v["bidamount"])
-				}
-			}
-			e.ServeJson(map[string]interface{}{
-				"list": *list,
-			})
-		}
+		e.ServeJson(map[string]interface{}{
+			"list": Newbids("")[currentPage-1],
+		})
 	}
-
 	return nil
 }
 
-//点击"搜索"执行的方法
-func (e *Entsearch) Bidsearchforent() error {
-	defer util.Catch()
-	searchvalue := e.GetString("searchvalue")
-	var shareid = e.GetString("id")
-	e.T["logid"] = config.Seoconfig["jyzbqyss"].(string)
-	if len(shareid) == 0 {
-		shareid = fmt.Sprintf("%s%d", config.Seoconfig["jysslby"].(string)+fmt.Sprintf("%d", time.Now().UnixNano())[8:14], rand.Intn(9))
-	}
-	area := e.GetString("area")
-	pricetype := e.GetString("pricetype")
-	minprice, _ := strconv.ParseFloat(e.GetString("minprice"), 64)
-	maxprice, _ := strconv.ParseFloat(e.GetString("maxprice"), 64)
-	if pricetype == "y" {
-		//搜索minprice和maxprice价格区间的数据
-	}
-	if pricetype == "n" || pricetype == "" {
-		//搜索所有的价格
-		minprice = 0
-		maxprice = 0
-	}
-
-	if minprice == 0 {
-		e.T["minprice"] = ""
-	} else {
-		e.T["minprice"] = minprice
-	}
-	if maxprice == 0 {
-		e.T["maxprice"] = ""
-	} else {
-		e.T["maxprice"] = maxprice
-	}
-
-	e.T["searchvalue"] = searchvalue
-	e.T["area"] = area
-	e.T["pricetype"] = pricetype
-	e.T["shareid"] = se.EncodeString(shareid)
-
-	if len(searchvalue) > 0 {
-		list := []map[string]interface{}{}
-		list = jylabutil.GetProjectByEntName(searchvalue, area, minprice, maxprice, 1, 50)
-		//jyutil.BidListConvert("", &list)
-		if len(list) > 0 {
-			for _, v := range list {
-				v["_id"] = util.DecodeArticleId2ByCheck(util.ObjToString(v["_id"]))
-				itemList := v["list"].([]interface{})
-				var subtypeid string
-				var bidstatusid string
-				for _, j := range itemList {
-					z := j.(map[string]interface{})
-					if z["subtype"] == "中标" || z["subtype"] == "成交" {
-						subtypeid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-					} else if z["bidstatus"] == "中标" || z["bidstatus"] == "成交" {
-						bidstatusid = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-					}
-					v["linkid"] = util.EncodeArticleId2ByCheck(util.ObjToString(z["infoid"]))
-				}
-				if subtypeid != "" {
-					v["linkid"] = util.DecodeArticleId2ByCheck(subtypeid)
-				} else if bidstatusid != "" {
-					v["linkid"] = util.DecodeArticleId2ByCheck(bidstatusid)
-				}
-			}
-
-		}
-		e.T["list"] = list
-	} else {
-		data := redis.Get("other", "index_listbident").([]interface{})
-		e.T["list"] = data[0]
-	}
-
-	return e.Render("/pc/biddingsearch_enterprise.html", &e.T)
-}
-
-func NewbidsForIndex() {
-	var list *[]map[string]interface{}
-	pages := make([]interface{}, 0)
-	if redis.Get("other", "index_listbident") == nil {
-		intns := make([]int, 0)
-		for i := 0; i < 10; i++ {
-			if len(intns) == 0 {
-				intns = append(intns, rand.Intn(100))
-			} else {
-				for {
-					v := rand.Intn(intns[(i-1)] + 100)
-					if v-intns[(i-1)] >= 30 {
-						intns = append(intns, v)
-						break
-					}
-				}
-			}
-		}
-		for i := 0; i < 10; i++ {
-			_, list = getLastNewsData("", "", "", "", "", "", "", "Y", intns[i], true, false)
-			jyutil.BidListConvert("", list)
-			for k, v := range *list {
-				v["k"] = (k + 1) + i*50
-				if v["area"] == "A" {
-					v["area"] = ""
-				}
-				t := time.Unix(util.Int64All(v["publishtime"]), 0)
-				v["timetemp"] = fmt.Sprint(util.Int64All(v["publishtime"]))
-				v["linkid"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
-				if v["bidamount"] != nil {
-					v["bidamount"] = fmt.Sprintf("%.2f", v["bidamount"])
-				}
-				v["time1"] = util.TimeDiff(t)
-				var stp = ""
-				if v["subtype"] != nil {
-					stp, _ = v["subtype"].(string)
-				} else {
-					stp = ""
-				}
-				if stp == "" && v["toptype"] != nil {
-					stp, _ = v["toptype"].(string)
-				}
-				var ind = ""
-				if v["industry"] != nil {
-					ind = v["industry"].(string)
-				}
-				area, _ := v["area"].(string)
-				v["stypeadd"], v["areaadd"], v["indadd"] = classify(stp, area, ind)
-				v["bidtype"] = stp
-			}
-			pages = append(pages, list)
-		}
-		redis.Put("other", "index_listbident", pages, 60*60*24*2)
-	}
-}
-
 func (e *Entsearch) RecList() {
 	var entName = e.GetString("entName")
 	limit, _ := strconv.Atoi(config.Sysconfig["recommendEntLimit"].(string))

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

@@ -7,7 +7,7 @@ import (
 	"jfw/wx"
 	"log"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	rpc "qfw/util/rpc"
 	"strings"

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

@@ -10,7 +10,7 @@ import (
 	"log"
 	"math/rand"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"strconv"
 	"strings"

+ 9 - 3
src/jfw/front/search.go

@@ -12,9 +12,10 @@ import (
 type Search struct {
 	*xweb.Action
 	/********************剑鱼搜索dev2.0**************************/
-	mainSearch  xweb.Mapper `xweb:"/jylab/mainSearch"`       //剑鱼搜索主页面
-	superSearch xweb.Mapper `xweb:"/jylab/superSearch"`      //超级搜索页面
-	getHK       xweb.Mapper `xweb:"/jylab/mainSearch/getHK"` //获取历史记录,订阅关键词
+	mainSearch    xweb.Mapper `xweb:"/jylab/mainSearch"` //剑鱼搜索主页面
+	searchKeyword xweb.Mapper `xweb:"/jylab/searchKeyword/(.*)"`
+	superSearch   xweb.Mapper `xweb:"/jylab/superSearch"`      //超级搜索页面
+	getHK         xweb.Mapper `xweb:"/jylab/mainSearch/getHK"` //获取历史记录,订阅关键词
 }
 
 func init() {
@@ -42,8 +43,13 @@ func (s *Search) MainSearch() error {
 	myavatar, _ := s.Session().Get("s_avatar").(string)
 	s.T["nickname"] = mynickname
 	s.T["avatar"] = myavatar
+	s.T["searchWord"] = s.GetString("searchWord")
 	return s.Render("/weixin/search/mainSearch.html", &s.T)
 }
+func (s *Search) SearchKeyword(searchWord string) error {
+	s.SetSession("mainSearch_searchWord", searchWord)
+	return s.Redirect("/jylab/mainSearch?searchWord=" + searchWord)
+}
 
 //获取历史记录和关键词
 func (s *Search) GetHK() error {

+ 5 - 10
src/jfw/front/shorturl.go

@@ -10,7 +10,6 @@ import (
 	"math/rand"
 	"net/http"
 	"qfw/util"
-	elastic "qfw/util/elastic"
 	"qfw/util/redis"
 	"regexp"
 	"strings"
@@ -148,17 +147,13 @@ func (s *Short) Article(stype, id string) error {
 		if res == nil || res == "" {
 			s.T["keywords"] = kds
 			s.DisableHttpCache()
-			data := elastic.GetByIdField("bidding", "bidding", sid, `"href"`)
-			if data == nil || len(*data) == 0 {
-				return s.Render("/_error.html")
-			}
-			href, _ := (*data)["href"].(string)
-			href = strings.Replace(href, "\n", "", -1)
-			if href != "" && !strings.HasPrefix(href, "http") {
-				href = "http://" + href
-			}
 			po, bo, wo, obj := pcVRT(sid, industry)
 			if obj != nil && len(obj) > 0 {
+				href, _ := obj["href"].(string)
+				href = strings.Replace(href, "\n", "", -1)
+				if href != "" && !strings.HasPrefix(href, "http") {
+					href = "http://" + href
+				}
 				if len(po) > 0 {
 					s.T["projectOther"] = po
 				}

+ 19 - 101
src/jfw/front/supsearch.go

@@ -53,31 +53,15 @@ func (p *Pcsearch) ProposedProject() error {
 	if subtype == "" {
 		subtype = "拟建"
 	}
-	var count int64
+	var totalPage int64
 	var list *[]map[string]interface{}
 	var status = 1
 	if len(searchvalue) > 0 {
 		status = 2
-		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, "", "", "", 0, true, "", "")
-		/*} else if p.Method() == "POST" {
-		if area == "" && publishtime == "" {
-			if redis.Get("other", "index_listnijian") == nil {
-				Newbids("nijian")
-				data := redis.Get("other", "index_listnijian").([]interface{})
-				p.T["list"] = data[0]
-			} else {
-				data := redis.Get("other", "index_listnijian").([]interface{})
-				p.T["list"] = data[0]
-			}
-		} else {
-			status = 2
-			count, list = getLastNewsData(searchvalue, area, publishtime, subtype, "", "", "", "", 0, true, true)
-		}*/
+		_, totalPage, list = getBidSearchData(searchvalue, area, publishtime, subtype, "", "", "", 0, true, "", "")
 	} else {
 		p.DisableHttpCache()
-		Newbids("nijian")
-		data := redis.Get("other", "index_listnijian").([]interface{})
-		p.T["list"] = data[0]
+		p.T["list"] = Newbids("nijian")[0]
 	}
 	if status == 2 {
 		if list != nil {
@@ -104,7 +88,7 @@ func (p *Pcsearch) ProposedProject() error {
 	p.T["subtype"] = subtype
 	p.T["publishtime"] = publishtime
 	p.T["timeslot"] = p.GetString("timeslot")
-	p.T["count"] = count
+	p.T["totalPage"] = totalPage
 	p.T["keywords"] = keywords
 	p.T["searchvalue"] = searchvalue
 	p.T["login"] = p.Session().Get("user")
@@ -146,60 +130,8 @@ func (p *Pcsearch) Getstatus() error {
 func (p *Pcsearch) GetNewBids() error {
 	pagenum, _ := p.GetInteger("pageNumber")
 	pageType := p.GetString("pageType")
-	var list *[]map[string]interface{}
-	pages := make([]interface{}, 0)
-	subtype := ""
-	if pageType == "nijian" {
-		subtype = "拟建"
-	}
-	var count int64
-	count = 500
-	pagenum = util.IntAll(pagenum)
-	if redis.Get("other", "index_list"+pageType) == nil {
-		intns := make([]int, 0)
-		for i := 0; i < 10; i++ {
-			if len(intns) == 0 {
-				intns = append(intns, rand.Intn(100))
-			} else {
-				for {
-					v := rand.Intn(intns[(i-1)] + 100)
-					if v-intns[(i-1)] >= 30 {
-						intns = append(intns, v)
-						break
-					}
-				}
-			}
-		}
-
-		for i := 0; i < 10; i++ {
-			_, list = getLastNewsData("", "", "", subtype, "", "", "", "", intns[i], true, false)
-			for k, v := range *list {
-				v["k"] = (k + 1) + i*50
-				t := time.Unix(util.Int64All(v["publishtime"]), 0)
-				v["timetemp"] = fmt.Sprint(util.Int64All(v["publishtime"]))
-				v["_id"] = util.EncodeArticleId2ByCheck(v["_id"].(string))
-				v["time"] = util.TimeDiff(t)
-				var stp = ""
-				if v["subtype"] != nil {
-					stp, _ = v["subtype"].(string)
-				} else {
-					stp = ""
-				}
-				if stp == "" && v["toptype"] != nil {
-					stp, _ = v["toptype"].(string)
-				}
-				area, _ := v["area"].(string)
-				indtry := util.ObjToString(v["industry"])
-				v["stypeadd"], v["areaadd"], v["indadd"] = classify(stp, area, indtry)
-			}
-			pages = append(pages, list)
-		}
-		redis.Put("other", "index_list"+pageType, pages, 60*60*24*2)
-	}
-	data := redis.Get("other", "index_list"+pageType).([]interface{})
 	p.ServeJson(map[string]interface{}{
-		"list":  data[pagenum-1],
-		"count": count,
+		"list": Newbids(pageType)[pagenum-1],
 	})
 	return nil
 }
@@ -237,31 +169,15 @@ func (p *Pcsearch) PcSearchIndex() error {
 	//if selectType == "" {
 	selectType = "title"
 	//}
-	var count int64
 	var list *[]map[string]interface{}
 	var status = 1
+	var count, totalPage int64
 	if len(searchvalue) > 0 || len(industry) > 0 {
 		status = 2
-		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType, "")
-		/* } /*else if p.Method() == "POST"  {
-		if area == "" && publishtime == "" {
-			if redis.Get("other", "index_list") == nil {
-				Newbids("")
-				data := redis.Get("other", "index_list").([]interface{})
-				p.T["list"] = data[0]
-			} else {
-				data := redis.Get("other", "index_list").([]interface{})
-				p.T["list"] = data[0]
-			}
-		} else {
-			status = 2
-			count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, "", 0, true, true)
-		}*/
+		count, totalPage, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType, "")
 	} else {
 		p.DisableHttpCache()
-		Newbids("")
-		data := redis.Get("other", "index_list").([]interface{})
-		p.T["list"] = data[0]
+		p.T["list"] = Newbids("")[0]
 	}
 	if status == 2 {
 		if list != nil {
@@ -290,7 +206,6 @@ func (p *Pcsearch) PcSearchIndex() error {
 	p.T["timeslot"] = p.GetString("timeslot")
 	p.T["toptype"] = toptype
 	p.T["subtype"] = subtype
-	p.T["count"] = count
 	p.T["keywords"] = keywords
 	p.T["searchvalue"] = searchvalue
 	p.T["selectType"] = selectType
@@ -298,6 +213,8 @@ func (p *Pcsearch) PcSearchIndex() error {
 	p.T["minprice"] = minprice
 	p.T["maxprice"] = maxprice
 	p.T["login"] = p.Session().Get("user")
+	p.T["totalPage"] = totalPage
+	p.T["count"] = count
 	p.SetSession("paramkey", keywords)
 	if publishtime == "lately-7" {
 		p.SetSession("parampublishtime", "最近7天")
@@ -364,14 +281,14 @@ func getindustrys() (industry map[string][]string, sortArray []string) {
 }
 
 //
-func Newbids(p string) {
-	var list *[]map[string]interface{}
-	pages := make([]interface{}, 0)
-	subtype := ""
-	if len(p) > 0 {
-		subtype = "拟建"
-	}
-	if redis.Get("other", "index_list"+p) == nil {
+func Newbids(p string) []interface{} {
+	pages, _ := redis.Get("other", "index_list"+p).([]interface{})
+	if len(pages) == 0 {
+		var list *[]map[string]interface{}
+		subtype := ""
+		if len(p) > 0 {
+			subtype = "拟建"
+		}
 		intns := make([]int, 0)
 		for i := 0; i < 10; i++ {
 			if len(intns) == 0 {
@@ -412,6 +329,7 @@ func Newbids(p string) {
 		}
 		redis.Put("other", "index_list"+p, pages, 60*60*24*2)
 	}
+	return pages
 }
 
 //二维码图片

+ 39 - 32
src/jfw/front/swordfish.go

@@ -1,6 +1,7 @@
 package front
 
 import (
+	"context"
 	"encoding/base64"
 	"encoding/json"
 	"fmt"
@@ -13,7 +14,7 @@ import (
 	"log"
 	"math/rand"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"regexp"
 	"strconv"
@@ -27,13 +28,13 @@ import (
 )
 
 const (
-	bidSearch_pageSize    = 50 //招标搜索分页--每页显示数量
-	bidSearch_maxPageSize = 10 //招标搜索分页--最大页数
-	wx_maxPageNum         = 20
-	wx_pageSize           = 50
-	bidSearch_field_1     = `"_id","title","publishtime","toptype","subtype","type","area","s_subscopeclass"`
-	bidSearch_field       = bidSearch_field_1 + `,"bidopentime","winner","buyer","bidamount","budget","projectname","projectcode","projectinfo"`
-	bidSearch_sort        = `{"publishtime":-1}`
+	pc_pageSize       = 50 //招标搜索分页--每页显示数量
+	pc_maxPageNum     = 10 //招标搜索分页--最大页数
+	wx_maxPageNum     = 20
+	wx_pageSize       = 50
+	bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","s_subscopeclass"`
+	bidSearch_field   = bidSearch_field_1 + `,"bidopentime","winner","buyer","bidamount","budget","projectname","projectcode","projectinfo"`
+	bidSearch_sort    = `{"publishtime":-1}`
 )
 
 var M *Model
@@ -310,12 +311,12 @@ func (m *Front) Searchinfolist(p string) error {
 		selectType = "all"
 	}
 	var status = 1
-	var count int64
+	var count, totalPage int64
 	tabularflag := ""
 	var list *[]map[string]interface{}
 	pages := make([]interface{}, 0)
 	if len(searchvalue) > 0 || len(industry) > 0 {
-		count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType, "")
+		count, totalPage, 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, minprice, maxprice, "", 0, true, false)
@@ -391,6 +392,7 @@ func (m *Front) Searchinfolist(p string) error {
 		m.T["toptype"] = toptype
 		m.T["subtype"] = subtype
 		m.T["count"] = count
+		m.T["totalPage"] = totalPage
 		m.T["status"] = status
 		m.T["keywords"] = keywords
 		m.T["searchvalue"] = searchvalue
@@ -468,8 +470,12 @@ func (m *Front) PcAjaxReq() {
 	reqType := m.GetString("reqType")
 	//获取最新招标信息
 	if reqType == "lastBids" {
-		ls := elastic.GetPage(INDEX, TYPE, "{}", bidSearch_sort, bidSearch_field_1, 0, 18)
-		jyutil.BidListConvert("", ls)
+		//ls := elastic.GetPage(INDEX, TYPE, "{}", bidSearch_sort, bidSearch_field_1, 0, 18)
+		//jyutil.BidListConvert("", ls)
+		ls := Newbids("")
+		if len(ls) >= 18 {
+			ls = ls[:18]
+		}
 		m.ServeJson(map[string]interface{}{
 			"list": ls,
 		})
@@ -480,10 +486,10 @@ func (m *Front) PcAjaxReq() {
 		return
 	}
 	currentPage, _ := m.GetInteger("pageNumber")
-	if currentPage > bidSearch_maxPageSize {
-		currentPage = bidSearch_maxPageSize
+	if currentPage > pc_maxPageNum {
+		currentPage = pc_maxPageNum
 	}
-	start := (currentPage - 1) * bidSearch_pageSize
+	start := (currentPage - 1) * pc_pageSize
 	area := m.GetString("area")
 	subtype := m.GetString("subtype")
 	searchvalue := FilteKey(m.GetString("searchvalue"))
@@ -497,17 +503,17 @@ func (m *Front) PcAjaxReq() {
 		selectType = "all"
 	}
 	var list *[]map[string]interface{}
-	var count int64
+	var count, totalPage int64
 	status, _ := m.GetInteger("status")
 	if len(searchvalue) > 0 || len(industry) > 0 {
 		if reqType == "filter" {
 			if status == 1 {
-				count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType, tabularflag)
+				count, totalPage, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, 0, true, selectType, tabularflag)
 			} else if status == 2 {
 				//count, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, tabularflag, 0, true, true)
 			}
 		} else if reqType == "bidSearch" {
-			count, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, start, true, selectType, tabularflag)
+			count, totalPage, list = getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, start, true, selectType, tabularflag)
 		} else if reqType == "lastNews" {
 			_, list = getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, tabularflag, start, false, true)
 		}
@@ -535,22 +541,23 @@ func (m *Front) PcAjaxReq() {
 		}
 	}
 	m.ServeJson(map[string]interface{}{
-		"list":  list,
-		"count": count,
+		"list":      list,
+		"count":     count,
+		"totalPage": totalPage,
 	})
 }
 
 /**
 **页面搜索
 **/
-func getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice string, start int, isGetCount bool, selectType, tabularflag string) (count int64, list *[]map[string]interface{}) {
+func getBidSearchData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice string, start int, isGetCount bool, selectType, tabularflag string) (count, totalPage int64, list *[]map[string]interface{}) {
 	//selectType:全文搜索(all)、标题搜索(title)
 	findfields := `"title"`
 	if selectType == "all" {
 		findfields = `"title","detail"`
 	}
 	qstr := getSearchQuery(searchvalue, industry, minprice, maxprice, findfields, getBidSearchQuery(area, publishtime, subtype))
-	if isGetCount && qstr != "" {
+	if isGetCount && qstr != "" && start == 0 {
 		count = elastic.Count(INDEX, TYPE, qstr)
 	}
 	if !isGetCount || count > 0 {
@@ -558,17 +565,17 @@ func getBidSearchData(searchvalue, area, publishtime, subtype, industry, minpric
 		if selectType == "all" {
 			//全文搜索
 			if tabularflag == "Y" {
-				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 115, true)
+				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, pc_pageSize, 115, true)
 			} else {
-				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, start, bidSearch_pageSize, 115, true)
+				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, start, pc_pageSize, 115, true)
 
 			}
 		} else {
 			//标题搜索
 			if tabularflag == "Y" {
-				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 0, false)
+				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, pc_pageSize, 0, false)
 			} else {
-				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, start, bidSearch_pageSize, 0, false)
+				repl = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, start, pc_pageSize, 0, false)
 			}
 		}
 		if repl != nil && *repl != nil && len(*repl) > 0 {
@@ -576,10 +583,11 @@ func getBidSearchData(searchvalue, area, publishtime, subtype, industry, minpric
 			list = repl
 		}
 	}
-	limitCount := int64(bidSearch_pageSize * bidSearch_maxPageSize)
+	limitCount := int64(pc_pageSize * pc_maxPageNum)
 	if count > limitCount {
 		count = limitCount
 	}
+	totalPage = (count + pc_pageSize - 1) / pc_pageSize
 	return
 }
 func getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice, maxprice, tabularflag string, start int, isGetCount bool, highlight bool) (count int64, list *[]map[string]interface{}) {
@@ -591,20 +599,20 @@ func getLastNewsData(searchvalue, area, publishtime, subtype, industry, minprice
 	}
 	if !isGetCount || count > 0 {
 		if tabularflag == "Y" {
-			repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, 115, highlight)
+			repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, start, pc_pageSize, 115, highlight)
 			if repl != nil && *repl != nil && len(*repl) > 0 {
 				jyutil.BidListConvert(industry, repl)
 				list = repl
 			}
 		} else {
-			repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, start, bidSearch_pageSize, 115, highlight)
+			repl := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field_1, start, pc_pageSize, 115, highlight)
 			if repl != nil && *repl != nil && len(*repl) > 0 {
 				jyutil.BidListConvert(industry, repl)
 				list = repl
 			}
 		}
 	}
-	limitCount := int64(bidSearch_pageSize * bidSearch_maxPageSize)
+	limitCount := int64(pc_pageSize * pc_maxPageNum)
 	if count > limitCount {
 		count = limitCount
 	}
@@ -1019,7 +1027,6 @@ func getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, ind
 
 //查看原文跳转
 func (m *Front) VisitRedirect() {
-	fmt.Sprintln("^6^^^^^")
 	defer util.Catch()
 	sid := m.GetString("id")
 	//	regex, _ := regexp.Compile("(Android|Mobile)")
@@ -1863,7 +1870,7 @@ func searhWebContentblog(querymap map[string]string) (*[]map[string]interface{},
 	if client == nil {
 		return nil, nil
 	}
-	searchResult, err := client.Search().Index("content").Type("content").Source(query).Do()
+	searchResult, err := client.Search().Index("content").Type("content").Source(query).Do(context.TODO())
 	if err != nil {
 		return nil, nil
 	}

+ 10 - 5
src/jfw/jylabutil/entsearch.go

@@ -3,7 +3,7 @@ package jylabutil
 
 import (
 	"fmt"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"strings"
 )
 
@@ -36,18 +36,23 @@ upper	上限单位万
 pagenum	页码
 pagesize每页数量
 */
-func GetProjectByEntName(entname string, area string, lower, upper float64, pagenum, pagesize int) []map[string]interface{} {
+func GetProjectByEntName(entname string, area string, lower, upper float64, fields string, pagenum, pagesize int, getCount bool) (int, []map[string]interface{}) {
 	if pagenum < 1 {
 		pagenum = 1
 	}
 	mastquery := getSearchQuery(entname, area, lower, upper)
+	var count int
+	if getCount && pagenum == 1 {
+		countQuery := `{"query":{"bool":{"must":[` + mastquery + `]}}}`
+		count = int(elastic.Count("projectset", "projectset", countQuery))
+	}
 	list := *elastic.GetByNgram(
 		"projectset", "projectset",
 		``, mastquery,
-		`"s_winner","biddingcontent"`,
-		`{"jgtime":-1,"createtime":-1}`, ``, (pagenum-1)*pagesize, pagesize,
+		"",
+		`{"jgtime":-1,"createtime":-1}`, fields, (pagenum-1)*pagesize, pagesize,
 	)
-	return list
+	return count, list
 }
 
 func getSearchQuery(entname, area string, lower, upper float64) string {

+ 1 - 1
src/jfw/modules/entsesearch/src/config.json

@@ -4,7 +4,7 @@
     "mongodbName": "qfw",
     "influxaddr": "http://192.168.3.207:8086",
     "influxdb": "jy_logs",
-    "elasticsearch": "http://192.168.3.18:9800",
+    "elasticsearch": "http://192.168.3.18:9200",
     "elasticPoolSize": 30,
     "redisaddrs": "other=192.168.3.14:3379,push=192.168.3.14:3379,sso=192.168.3.14:3379,session=192.168.3.14:3379",
     "webport": "8090",

+ 1 - 1
src/jfw/modules/entsesearch/src/main.go

@@ -3,7 +3,7 @@ package main
 import (
 	"config"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	_ "search"
 	"tag"

+ 1 - 1
src/jfw/modules/entsesearch/src/search/entsesearch.go

@@ -87,7 +87,7 @@ func (e *EntSeSearch) ProList() {
 
 	//fmt.Println(searchname, scope, money_from_p, money_to_p)
 	if pageNum <= wx_maxPageNum {
-		proList = jylabutil.GetProjectByEntName(searchname, scope, money_from_p, money_to_p, pageNum, wx_pageSize)
+		_, proList = jylabutil.GetProjectByEntName(searchname, scope, money_from_p, money_to_p, `"projectname","jgtime","bidamount","sourceinfoid"`, pageNum, wx_pageSize, false)
 		for _, val := range proList {
 			var jgtime = val["jgtime"]
 			if jgtime != nil {

+ 1 - 1
src/jfw/modules/followent/src/config.json

@@ -4,7 +4,7 @@
     "mongodbName": "qfw",
     "influxaddr": "http://192.168.3.207:8086",
     "influxdb": "jy_logs",
-    "elasticsearch": "http://192.168.3.18:9800",
+    "elasticsearch": "http://192.168.3.18:9200",
     "elasticPoolSize": 30,
     "redisaddrs": "other=192.168.3.14:3379,push=192.168.3.14:3379,sso=192.168.3.14:3379,session=192.168.3.14:3379",
     "webport": "8091",

+ 1 - 6
src/jfw/modules/followent/src/followent/followent.go

@@ -2,9 +2,8 @@ package followent
 
 import (
 	"config"
-	"log"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"strconv"
 	"strings"
@@ -214,10 +213,6 @@ func createId(winner string) string {
 		data["l_createtime"] = time.Now().Unix()
 		winnerid = mongodb.Save("winner", data)
 		data["_id"] = winnerid
-		flag := elastic.Save("winner", "winner", data)
-		if !flag {
-			log.Println("企业保存elastic出错!")
-		}
 	} else {
 		//log.Println(*tem, "---------", util.BsonIdToSId((*tem)["_id"]))
 		winnerid = util.ObjToString(util.BsonIdToSId((*tem)["_id"]))

+ 1 - 1
src/jfw/modules/followent/src/followent/myfwent.go

@@ -5,7 +5,7 @@ import (
 	"encoding/json"
 	"log"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"strings"
 	"time"

+ 1 - 1
src/jfw/modules/followent/src/main.go

@@ -4,7 +4,7 @@ import (
 	"config"
 	_ "followent"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"tag"
 	"time"

+ 4 - 3
src/jfw/modules/push/src/config.json

@@ -3,7 +3,7 @@
     "bidViewDomain": "https://wblmjy.qmx.top",
     "durationMinutes": 10,
     "elasticPoolSize": 10,
-    "elasticsearch": "http://192.168.3.14:9800",
+    "elasticsearch": "http://192.168.3.18:9200",
     "lastid": "59c0adb2f0c367251336c5ff",
     "mail_content": "\u003ctr\u003e\u003ctd\u003e\u003cnum\u003e%d\u003c/num\u003e\u003c/td\u003e\u003ctd\u003e\u003cdiv class='tit'\u003e\u003ca style='color: #000;text-decoration: none;' href='%s?mail' \u003e%s\u003c/a\u003e\u003c/div\u003e\u003c/td\u003e\u003ctd style='float: right;' class='infos' \u003e\u003cspan class='%s'\u003e%s\u003c/span\u003e\u003cspan class='%s'\u003e%s\u003c/span\u003e\u003cspan class='%s'\u003e%s\u003c/span\u003e\u003cspan class='time'\u003e%s\u003c/span\u003e\u003c/td\u003e\u003c/tr\u003e",
     "mail_html": "\u003cbody\u003e\u003cstyle\u003e *,body,html{margin:0;padding:0;font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;font-size:16px; }#all{margin:0 auto;width:1024px;overflow:hidden;}.head{margin:5x;margin-top:20px;}.des{padding-bottom:15px;border-bottom:1px solid #e8ecee;color: #686868;}td a:hover {color: #fe7379;text-decoration: underline;} .tit{width:560px;overflow: hidden;    white-space: nowrap;text-overflow: ellipsis;}.area {background-color: #2cb7ca;border-radius: 3px;color: #fff;padding: 1px 2px;}.type {background-color: #ffba00;border-radius: 3px;color: #fff;padding: 1px 2px;margin-left:5px;}.industry {background-color: #25c78c;border-radius: 3px;color: #fff;padding: 1px 2px;margin-left:5px;}.infos span{display:inline-block;margin-left:5px;}td{padding-top:8px;padding-bottom:8px;height:20px;line-height:20px;}num{padding:0 5px 0 0; font-size:16px;color:#2cb7ca;font-weight:bolder;}.keys{color:blue;} \u003c/style\u003e\u003cdiv id='all'\u003e\u003cdiv class='head'\u003e\u003cIMG width='100px' src=http://www.zhaobiao.info/images/swordfish/sf_01.png /\u003e\u003c/div\u003e\u003cdiv class='head des'\u003e根据您设置的关键词 :\u003cspan class='keys'\u003e%s\u003c/span\u003e,剑鱼为您推送30天之内的信息。点击标题可查看详情信息\u003c/div\u003e\u003ctable cellpadding='0' cellspacing='0'\u003e%s\u003c/table\u003e\u003c/div\u003e \u003c/body\u003e",
@@ -17,7 +17,7 @@
         }
     ],
     "maxPushSize": 50,
-    "mgoAddr": "192.168.3.14:27080",
+    "mgoAddr": "192.168.3.18:27080",
     "mgoSize": 4,
     "province": {
         "上海": 9,
@@ -56,8 +56,9 @@
         "黑龙江": 8
     },
     "redisServers": "push=192.168.3.14:3379",
+	"httpPort": "51513",
     "rpcPort": "8766",
-    "weixinRpcServer": "192.168.3.14:10084",
+    "weixinRpcServer": "127.0.0.1:8083",
     "wxcontent": "剑鱼推送",
     "wxgroup": "%s信息",
     "wxtitle": "您有新的%s信息!",

+ 30 - 6
src/jfw/modules/push/src/main.go

@@ -5,6 +5,9 @@ package main
 
 import (
 	"log"
+	"net/http"
+	"strconv"
+	"strings"
 	//"net"
 	//"net/http"
 	//"net/rpc"
@@ -15,7 +18,7 @@ import (
 	_ "net/http/pprof"
 	"qfw/push/rpcpush"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/mongodb"
 	"qfw/util/redis"
 	//"strings"
@@ -78,16 +81,20 @@ func main() {
 	l, _ := net.Listen("tcp", ":"+port)
 	go http.Serve(l, nil)
 	**/
-	//go Servers()
+	go Servers()
 	log.Println("启动推送系统")
 	flag := make(chan bool)
 	<-flag
 }
 
 //补推地址
-/**
+
 func Servers() {
-	http.HandleFunc("/push", func(w http.ResponseWriter, r *http.Request) {
+	httpPort, _ := push.PushConfig["httpPort"].(string)
+	if httpPort == "" {
+		return
+	}
+	/*http.HandleFunc("/push", func(w http.ResponseWriter, r *http.Request) {
 		openid := r.FormValue("openid")
 		words := r.FormValue("words")
 		words = strings.Replace(words, " ", "+", -1)
@@ -95,7 +102,24 @@ func Servers() {
 		log.Println(openid, words, pushsize)
 		res := dopush.SetBidding(openid, words, pushsize)
 		w.Write([]byte(util.If(res, "success", "fail").(string)))
+	})*/
+	//passowrd=ABCcHUFcSYBOzYuEntyc3IkDDAoQBZgYWR1KA4vLwcR
+	http.HandleFunc("/repairNinePush", func(w http.ResponseWriter, r *http.Request) {
+		p := strings.TrimSpace(r.FormValue("p"))
+		password := ""
+		if len(p) > 3 {
+			password = util.DecodeArticleId2ByCheck(p)[0]
+		}
+		res := false
+		if password == "p!u@s#h201710191717" {
+			startTime, _ := strconv.ParseInt(r.FormValue("s"), 10, 64)
+			endTime, _ := strconv.ParseInt(r.FormValue("e"), 10, 64)
+			log.Println(startTime, endTime)
+			if startTime < endTime {
+				res = dopush.RepairNinePush(startTime, endTime)
+			}
+		}
+		w.Write([]byte(util.If(res, "success", "fail").(string)))
 	})
-	http.ListenAndServe(":51513", nil)
+	http.ListenAndServe(":"+httpPort, nil)
 }
-**/

+ 2 - 2
src/jfw/modules/push/src/qfw/push/bid/fixpushjob.go

@@ -46,6 +46,6 @@ func (b *FixPushJob) Execute() bool {
 
 func fp() {
 	defer util.Catch()
-	dopush.PushInfoByEs(MaxPushSize, &push.FixPushConfig, 2)
-	util.WriteSysConfig(push.Fixconfig, push.FixPushConfig)
+	dopush.PushNineUsers(MaxPushSize, 2)
+	//util.WriteSysConfig(push.Fixconfig, push.FixPushConfig)
 }

+ 1 - 1
src/jfw/modules/push/src/qfw/push/cache.go

@@ -8,7 +8,7 @@ import (
 	"fmt"
 	"log"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/mongodb"
 	"runtime"
 	"strings"

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

@@ -9,7 +9,7 @@ import (
 	"qfw/push"
 	"qfw/push/dfa"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/mongodb"
 	"strings"
 	"sync"
@@ -25,6 +25,7 @@ const (
 	SortQuery      = `{"publishtime":"desc"}`
 	DB             = "bidding"
 	IDRange        = `{"range":{"id":{"gt":"%s","lte":"%s"}}},{"range":{"publishtime":{"gt": %d}}}`
+	TimeRange      = `{"range":{"comeintime":{"gte":%d,"lte":%d}}}`
 	MaxId          = `{"query":{"filtered":{"filter":{"bool":{"must":{"range":{"id":{"gt":"%s"}}}}}}},"_source":["_id","comeintime"],"sort":{"id":"desc"},"from":0,"size":1}`
 	PushTitle      = `[<span class='area'>%s</span>]%s`
 	Infoformat     = `{"term":{"infoformat":%d}}`
@@ -42,6 +43,7 @@ var (
 	searchWaitGroup   = &sync.WaitGroup{}
 	eachInfoWaitGroup = &sync.WaitGroup{}
 	userMapLock       = &sync.Mutex{}
+	pushLock          = &sync.Mutex{}
 	biddingDatas      *[]map[string]interface{}
 	allUsers          *map[string]*push.MemberInterest
 	MaxSearch         = 10000 //缓存中总共加载这么多条
@@ -96,13 +98,13 @@ func PushInfoByEs(MaxPushSize int, Config *map[string]interface{}, i_ratemode in
 		log.Println("未查找到需要推送的用户...")
 		return false
 	}
-	if !InitBiddingCache(_id, lastid, lastTime) {
+	if !InitBiddingCache(_id, lastid, lastTime, 0, 0, false) {
 		log.Println("加载数据到内存中的时候,未查找到数据...")
 		return false
 	}
 	//
-	DoPush(a_p, s_p, MaxPushSize, Now, i_ratemode)
-	log.Println("推送结束..", comeintime, lastid)
+	DoPush(a_p, s_p, MaxPushSize, Now, true)
+	log.Println("推送结束-i_ratemode-comeintime-lastid", i_ratemode, comeintime, lastid)
 	biddingDatas = nil
 	allUsers = nil
 	(*Config)["StartTime"] = util.FormatDateWithObj(&comeintime, util.Date_Full_Layout)
@@ -110,6 +112,82 @@ func PushInfoByEs(MaxPushSize int, Config *map[string]interface{}, i_ratemode in
 	return true
 }
 
+//九点推送的用户
+func PushNineUsers(MaxPushSize int, i_ratemode int) bool {
+	pushLock.Lock()
+	defer pushLock.Unlock()
+	log.Println("九点推送,开始执行任务。。。")
+	Now := time.Now()
+	session := mongodb.GetMgoConn()
+	defer mongodb.DestoryMongoConn(session)
+	q := map[string]interface{}{
+		"ratemode": 2,
+	}
+	query := session.DB("qfw").C("tempush").Find(&q).Select(&map[string]interface{}{
+		"_id":      -1,
+		"s_openid": 1,
+		"tmpinfos": 1,
+		"info":     1,
+	}).Iter()
+	userMap := map[*push.MemberInterest]*list.List{}
+	//遍历用户数组
+	count := 0
+	for tmp := make(map[string]interface{}); query.Next(tmp); {
+		if tmp["tmpinfos"] == nil {
+			continue
+		}
+		log.Println("九点推送,openid:", tmp["s_openid"])
+		tmpinfos, _ := tmp["tmpinfos"].([]interface{})
+		if len(tmpinfos) == 0 {
+			continue
+		}
+		info, _ := tmp["info"].(map[string]interface{})
+		if len(info) == 0 {
+			continue
+		}
+		//
+		user := &push.MemberInterest{
+			Id:         util.ObjToString(info["id"]),
+			PushMode:   util.IntAllDef(info["pushMode"], 1),
+			Email:      util.ObjToString(info["email"]),
+			Openid:     util.ObjToString(info["openid"]),
+			Ratemode:   util.IntAllDef(info["ratemode"], 1),
+			Rmstart:    util.IntAllDef(info["rmstart"], 1),
+			Rmend:      util.IntAllDef(info["rmend"], 1),
+			Smartset:   util.IntAllDef(info["smartset"], 0),
+			Dataexport: util.IntAllDef(info["dataexport"], 0),
+		}
+		keys, _ := info["keys"].([]interface{})
+		user.Interest = util.ObjArrToStringArr(keys)
+		//
+		listInfos := list.New()
+		for _, tif := range tmpinfos {
+			tifMap, _ := tif.(map[string]interface{})
+			listInfos.PushBack(&tifMap)
+		}
+		userMap[user] = listInfos
+		tmp = make(map[string]interface{})
+		count++
+	}
+	if count == 0 {
+		log.Println("九点推送,未查找到需要推送的用户...")
+		return false
+	}
+	log.Println("九点推送,本次查询用户总数:", count)
+	for temp_k, temp_list := range userMap {
+		pushpool <- true
+		go func(k *push.MemberInterest, listInfos *list.List) {
+			defer func() {
+				<-pushpool
+			}()
+			mongodb.Del("tempush", &bson.M{"s_openid": k.Openid})
+			DealSend(k, listInfos, Now, MaxPushSize, k.Ratemode, InfoMap[1])
+		}(temp_k, temp_list)
+	}
+	log.Println("九点推送,推送结束。。。")
+	return true
+}
+
 //初始化用户缓存
 func InitUserCache(i_ratemode int) (*Pjob, *Pjob) {
 	defer util.Catch()
@@ -118,9 +196,7 @@ func InitUserCache(i_ratemode int) (*Pjob, *Pjob) {
 		"i_appid":  2,
 		"i_ispush": map[string]interface{}{"$ne": 0},
 	}
-	if i_ratemode == 1 {
-		q["o_jy.i_ratemode"] = map[string]interface{}{"$in": []int{1, 3}}
-	} else {
+	if i_ratemode == 2 {
 		q["o_jy.i_ratemode"] = i_ratemode
 	}
 	//18 o8-2pwHj1s_tv3nnRxrH9cD2ngkk
@@ -154,7 +230,7 @@ func InitUserCache(i_ratemode int) (*Pjob, *Pjob) {
 		log.Println("openid:", tmp["s_m_openid"])
 		util.Try(func() {
 			_id := fmt.Sprintf("%x", string(tmp["_id"].(bson.ObjectId)))
-			o_msgset := tmp["o_jy"].(map[string]interface{})
+			o_msgset, _ := tmp["o_jy"].(map[string]interface{})
 			var allkeysTemp []elastic.KeyConfig
 			_bs, err := json.Marshal(o_msgset["a_key"])
 			if err == nil {
@@ -279,9 +355,16 @@ func MakeKeyUser(keys []string, user *push.MemberInterest, key_user *map[string]
 }
 
 //加载数据到内存中
-func InitBiddingCache(_id, lastid string, lastTime int64) bool {
+func InitBiddingCache(_id, lastid string, lastTime int64, startTime, endTime int64, isRepair bool) bool {
 	//filter全局查询
-	c_query := fmt.Sprintf(FilterQuery, fmt.Sprintf(IDRange, _id, lastid, lastTime-7*86400))
+	c_query := ""
+	//第一次发布程序之后,修补九点推送的用户数据
+	if isRepair {
+		c_query = fmt.Sprintf(FilterQuery, fmt.Sprintf(TimeRange, startTime, endTime))
+	} else {
+		c_query = fmt.Sprintf(FilterQuery, fmt.Sprintf(IDRange, _id, lastid, lastTime-7*86400))
+	}
+	log.Println("es query:", c_query)
 	//testquery := `{"terms":{"_id":["59cefaa12cf26913ca07fd56"]}}`
 	//testquery := ``
 	//c_query = fmt.Sprintf(FilterQuery, testquery)
@@ -290,7 +373,7 @@ func InitBiddingCache(_id, lastid string, lastTime int64) bool {
 	if count == 0 {
 		return false
 	}
-	if count > MaxSearch {
+	if count > MaxSearch && !isRepair {
 		count = MaxSearch
 		log.Println("目前数据多于", MaxSearch, ",只加载了", MaxSearch, "条!")
 	}
@@ -332,10 +415,11 @@ func InitBiddingCache(_id, lastid string, lastTime int64) bool {
 }
 
 //开始推送
-func DoPush(a_p *Pjob, s_p *Pjob, MaxPushSize int, Now time.Time, ratemode int) {
+func DoPush(a_p *Pjob, s_p *Pjob, MaxPushSize int, Now time.Time, isPush bool) {
 	defer util.Catch()
+	pushLock.Lock()
+	defer pushLock.Unlock()
 	userMap := EachAllBidInfo(a_p, s_p)
-	log.Println("本次推送", len(*userMap), "人")
 	for temp_k, temp_list := range *userMap {
 		pushpool <- true
 		go func(k *push.MemberInterest, listInfos *list.List) {
@@ -345,16 +429,16 @@ func DoPush(a_p *Pjob, s_p *Pjob, MaxPushSize int, Now time.Time, ratemode int)
 			var rtflog = false
 			h := time.Now().Hour()
 			openid := k.Openid
-			if k.Ratemode == 3 {
+			if k.Ratemode == 2 || k.Ratemode == 3 {
 				inofsdata := mongodb.FindOne("tempush", &bson.M{"s_openid": openid})
-				if k.Rmstart <= h && h < k.Rmend {
+				if k.Ratemode == 3 && k.Rmstart <= h && h < k.Rmend {
 					rtflog = true
 					//把暂存数据取出合并后发送,并删除此用户暂存库中的数据
 					if inofsdata != nil {
 						if (*inofsdata)["tmpinfos"] != nil {
-							infos := (*inofsdata)["tmpinfos"].([]interface{})
+							infos, _ := (*inofsdata)["tmpinfos"].([]interface{})
 							for _, tif := range infos {
-								tifMap := tif.(map[string]interface{})
+								tifMap, _ := tif.(map[string]interface{})
 								listInfos.PushBack(&tifMap)
 							}
 						}
@@ -362,6 +446,19 @@ func DoPush(a_p *Pjob, s_p *Pjob, MaxPushSize int, Now time.Time, ratemode int)
 					mongodb.Del("tempush", &bson.M{"s_openid": openid})
 				} else {
 					//自定义时间外的数据暂存数据库tempush中
+					myInfo := &bson.M{
+						"id":         k.Id,
+						"keys":       k.Interest,
+						"pushMode":   k.PushMode,
+						"email":      k.Email,
+						"openid":     k.Openid,
+						"ratemode":   k.Ratemode,
+						"rmstart":    k.Rmstart,
+						"rmend":      k.Rmend,
+						"allKeys":    k.AllKeys,
+						"smartset":   k.Smartset,
+						"dataexport": k.Dataexport,
+					}
 					var pushArray = []interface{}{}
 					for e := listInfos.Front(); e != nil; e = e.Next() {
 						k2 := *(e.Value.(*map[string]interface{}))
@@ -374,7 +471,7 @@ func DoPush(a_p *Pjob, s_p *Pjob, MaxPushSize int, Now time.Time, ratemode int)
 					upSet := new(bson.M)
 					//直接替换
 					if inofsdata == nil || pLength >= MaxPushSize {
-						upSet = &bson.M{"$set": &bson.M{"tmpinfos": &pushArray}}
+						upSet = &bson.M{"$set": &bson.M{"tmpinfos": &pushArray, "ratemode": k.Ratemode, "info": myInfo}}
 					} else { //保留最新的50条
 						infos, _ := (*inofsdata)["tmpinfos"].([]interface{})
 						rLength := len(infos)
@@ -385,9 +482,9 @@ func DoPush(a_p *Pjob, s_p *Pjob, MaxPushSize int, Now time.Time, ratemode int)
 								relationinfoTemp = append(relationinfoTemp, infos[start:]...)
 							}
 							relationinfoTemp = append(relationinfoTemp, pushArray...)
-							upSet = &bson.M{"$set": &bson.M{"tmpinfos": &relationinfoTemp}}
+							upSet = &bson.M{"$set": &bson.M{"tmpinfos": &relationinfoTemp, "ratemode": k.Ratemode, "info": myInfo}}
 						} else { //追加
-							upSet = &bson.M{"$pushAll": &bson.M{"tmpinfos": &pushArray}}
+							upSet = &bson.M{"$set": &bson.M{"ratemode": k.Ratemode, "info": myInfo}, "$pushAll": &bson.M{"tmpinfos": &pushArray}}
 						}
 					}
 					mongodb.Update("tempush", &bson.M{"s_openid": openid}, upSet, true, false)
@@ -395,7 +492,7 @@ func DoPush(a_p *Pjob, s_p *Pjob, MaxPushSize int, Now time.Time, ratemode int)
 			} else {
 				rtflog = true
 			}
-			if rtflog {
+			if rtflog && isPush {
 				DealSend(k, listInfos, Now, MaxPushSize, k.Ratemode, InfoMap[1])
 			}
 		}(temp_k, temp_list)
@@ -530,3 +627,23 @@ func EachInfoToUser(users *map[string]*push.MemberInterest, info *map[string]int
 		s.PushBack(info)
 	}
 }
+
+//九点推送补漏
+func RepairNinePush(startTime, endTime int64) bool {
+	log.Println("开始修补数据...")
+	a_p, s_p := InitUserCache(2)
+	if a_p == nil {
+		log.Println("修补数据,未查找到需要的用户...")
+		return false
+	}
+	if !InitBiddingCache("", "", 0, startTime, endTime, true) {
+		log.Println("修补数据,加载数据到内存中的时候,未查找到数据...")
+		return false
+	}
+	//
+	DoPush(a_p, s_p, 50, time.Now(), false)
+	log.Println("修补数据结束...")
+	biddingDatas = nil
+	allUsers = nil
+	return true
+}

+ 1 - 1
src/jfw/modules/pushent/src/config.json

@@ -1,7 +1,7 @@
 {
     "durationMinutes": "3",
     "elasticPoolSize": 30,
-    "elasticsearch": "http://192.168.3.18:9800",
+    "elasticsearch": "http://192.168.3.18:9200",
     "lastid": "596f21935d11e1c7455ddc7f",
     "mongodbName": "qfw",
     "mongodbPoolSize": "20",

+ 1 - 1
src/jfw/modules/pushent/src/followpush/push.go

@@ -6,7 +6,7 @@ import (
 	"fmt"
 	"log"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	qrpc "qfw/util/rpc"
 	"sort"
 	"strconv"

+ 1 - 1
src/jfw/modules/pushent/src/main.go

@@ -9,7 +9,7 @@ import (
 	_ "net/http/pprof"
 	"net/rpc"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"rpcpush"
 	"time"

+ 1 - 1
src/jfw/modules/pushproject/src/config.json

@@ -1,7 +1,7 @@
 {
     "durationMinutes": "3",
     "elasticPoolSize": 30,
-    "elasticsearch": "http://192.168.3.18:9800",
+    "elasticsearch": "http://192.168.3.18:9200",
     "lastid": "",
     "mongodbName": "qfw",
     "mongodbPoolSize": "20",

+ 254 - 252
src/jfw/modules/pushproject/src/followpush/push.go

@@ -6,7 +6,7 @@ import (
 	"fmt"
 	"log"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	qrpc "qfw/util/rpc"
 	"sort"
 	"strconv"
@@ -20,14 +20,33 @@ import (
 )
 
 var (
-	MaxId     = `{"query":{"filtered":{"filter":{"bool":{"must":{"range":{"id":{"gt":"%s"}}}}}}},"_source":["_id","comeintime"],"sort":{"id":"desc"},"from":0,"size":1}`
-	Query     = `{ "query": { "bool": { "must": [%s], "should": [%s], "minimum_should_match": 1 } }, "_source": [ "_id","title","publishtime","area","type","toptype","subtype","projectname","projectcode","href","infoformat" ], "sort": [ { "publishtime": "desc" } ], "from": 0, "size": 50 }`
-	IDRange   = `{"range":{"id":{"gt":"%s","lte":"%s"}}}`
-	TERM      = `{"term":{"%s":"%s"}}`
-	DB        = "bidding"
-	KEEPCOUNT = 100
+	MaxId           = `{"query":{"filtered":{"filter":{"bool":{"must":{"range":{"id":{"gt":"%s"}}}}}}},"_source":["_id","comeintime"],"sort":{"id":"desc"},"from":0,"size":1}`
+	Query           = `{ "query": { "bool": { "must": [%s], "should": [%s], "minimum_should_match": 1 } }, "_source": [ %s ], "sort": [ %s ], "from": 0, "size": 50 }`
+	FilterQuery     = `{"query": {"filtered": {"filter": {"bool": {"must": [%s]}}}}}`
+	IDRange         = `{"range":{"id":{"gt":"%s","lte":"%s"}}}`
+	TERM            = `{"term":{"%s":"%s"}}`
+	SortQuery       = `{"publishtime":"desc"}`
+	ShowField       = `"_id","title","publishtime","area","type","toptype","subtype","projectname","projectcode","href","infoformat"`
+	DB              = "bidding"
+	KEEPCOUNT       = 100
+	MaxSearch       = 10000 //缓存中总共加载这么多条
+	OnceMax         = 400   //ES一次查询这么多条
+	searchpool      = make(chan bool, 8)
+	pushpool        = make(chan bool, 50)
+	findpool        = make(chan bool, 10)
+	eachpool        = make(chan bool, 100)
+	Pushlock        = sync.Mutex{}
+	searchWaitGroup = &sync.WaitGroup{}
 )
 
+type PushUser struct {
+	Id          interface{}
+	OpenId      string
+	ProjectCode string
+	ProjectName string
+	Title       string
+}
+
 //开始推送
 func pushByEs(_id string) bool {
 	defer util.Catch()
@@ -40,7 +59,6 @@ func pushByEs(_id string) bool {
 		log.Println("未查找到数据...", fmt.Sprintf(MaxId, _id))
 		return false
 	}
-	idrange := fmt.Sprintf(IDRange, _id, lastid)
 	sess := tools.MQFW.GetMgoConn()
 	defer tools.MQFW.DestoryMongoConn(sess)
 	cur := sess.DB(tools.MQFW.DbName).C(FOLLOW_COLLECTION).Find(&map[string]interface{}{
@@ -58,24 +76,129 @@ func pushByEs(_id string) bool {
 		"_id":           1,
 	}).Iter()
 	j := 0
+	users := []*PushUser{}
 	for tmp := make(map[string]interface{}); cur.Next(tmp); j++ {
-		util.Try(func() {
-			scode := util.ObjToString(tmp["s_projectcode"])
-			sname := util.ObjToString(tmp["s_projectname"])
-			openid := util.ObjToString(tmp["s_openid"])
-			go FindData(tmp["_id"], util.ObjToString(tmp["s_title"]), sname, scode, openid, idrange, true, true)
-		}, func(e interface{}) {
-			log.Println(e)
+		scode := util.ObjToString(tmp["s_projectcode"])
+		sname := util.ObjToString(tmp["s_projectname"])
+		openid := util.ObjToString(tmp["s_openid"])
+		if strings.TrimSpace(openid) == "" || (strings.TrimSpace(scode) == "" && strings.TrimSpace(sname) == "") {
+			continue
+		}
+		users = append(users, &PushUser{
+			OpenId:      openid,
+			Id:          tmp["_id"],
+			Title:       util.ObjToString(tmp["s_title"]),
+			ProjectCode: scode,
+			ProjectName: sname,
 		})
 		tmp = make(map[string]interface{})
 	}
+	if len(users) == 0 {
+		log.Println("未查找到需要推送的用户...")
+		return false
+	}
+	initFlag, res := InitBiddingCache(_id, lastid)
+	if !initFlag {
+		log.Println("加载数据到内存中的时候,未查找到数据...")
+		return false
+	}
+	//遍历数据,挂到用户身上
+	userMap := EachAllBidInfo(&users, res)
+	//遍历用户,推送
+	for k, v := range *userMap {
+		pushpool <- true
+		func(tmp *[]map[string]interface{}) {
+			defer func() {
+				<-pushpool
+			}()
+			push(k.Id, k.ProjectName, k.ProjectCode, k.Title, k.OpenId, v, true, true)
+		}(v)
+	}
 	log.Println("push-over,user-count:", j)
 	Sysconfig["lastid"] = lastid
 	return true
 }
 
-var findpool = make(chan bool, 10)
-var Pushlock = sync.Mutex{}
+//遍历数据并执行推送操作
+func EachAllBidInfo(users *[]*PushUser, res *[]map[string]interface{}) *map[*PushUser]*[]map[string]interface{} {
+	userMap := map[*PushUser]*[]map[string]interface{}{}
+	for _, v := range *res {
+		eachpool <- true
+		func(tmp map[string]interface{}) {
+			defer func() {
+				<-eachpool
+			}()
+			scode := util.ObjToString(tmp["s_projectcode"])
+			sname := util.ObjToString(tmp["s_projectname"])
+			for _, user := range *users {
+				if scode != user.ProjectCode && sname != user.ProjectName {
+					continue
+				}
+				s := userMap[user]
+				if s == nil {
+					s = &[]map[string]interface{}{}
+					userMap[user] = s
+				}
+				*s = append(*s, tmp)
+			}
+		}(v)
+	}
+	return &userMap
+}
+
+//加载数据到内存中
+func InitBiddingCache(_id, lastid string) (bool, *[]map[string]interface{}) {
+	//filter全局查询
+	c_query := fmt.Sprintf(FilterQuery, fmt.Sprintf(IDRange, _id, lastid))
+	log.Println("es query:", c_query)
+	//testquery := `{"terms":{"_id":["59cefaa12cf26913ca07fd56"]}}`
+	//testquery := ``
+	//c_query = fmt.Sprintf(FilterQuery, testquery)
+	var res []map[string]interface{}
+	count := int(elastic.Count(DB, DB, c_query))
+	log.Println("本次推送共查到数据", count, "条")
+	if count == 0 {
+		return false, &res
+	}
+	if count > MaxSearch {
+		count = MaxSearch
+		log.Println("目前数据多于", MaxSearch, ",只加载了", MaxSearch, "条!")
+	}
+	if OnceMax > count {
+		OnceMax = count
+	}
+	totalPage := int((count + OnceMax - 1) / OnceMax)
+	log.Println("数据一共", totalPage, "页!")
+	//如果res长度和cout相差5条,重试
+	for t := 1; t <= 3; t++ {
+		res = []map[string]interface{}{}
+		for i := 0; i < totalPage; i++ {
+			searchpool <- true
+			searchWaitGroup.Add(1)
+			go func(start int) {
+				defer func() {
+					searchWaitGroup.Done()
+					<-searchpool
+				}()
+				r := elastic.GetAllByNgram(DB, DB, c_query, "", SortQuery, ShowField, start*OnceMax, OnceMax, 0, false)
+				res = append(res, *r...)
+				log.Println("第", start+1, "页数据加载完成!")
+			}(i)
+		}
+		searchWaitGroup.Wait()
+		if len(res) >= count-5 {
+			break
+		}
+		log.Println("第", t, "次加载数据完成,数据总数", len(res), ",由于数据量不够,重新加载!")
+	}
+	resLenght := len(res)
+	if resLenght == 0 {
+		return false, &res
+	}
+
+	log.Println(resLenght, "条数据已经加载完成!")
+	return true, &res
+}
 
 //不保存不推送-只保存不推送-保存推送
 func FindData(fid interface{}, title, sname, scode, openid, idrange string, bsave, bpush bool) *Arr {
@@ -92,258 +215,137 @@ func FindData(fid interface{}, title, sname, scode, openid, idrange string, bsav
 	}
 	var pushArray = &Arr{}
 	if len(q1) > 0 {
-		res := elastic.Get(DB, DB, fmt.Sprintf(Query, idrange, strings.Join(q1, ",")))
+		res := elastic.Get(DB, DB, fmt.Sprintf(Query, idrange, strings.Join(q1, ","), ShowField, SortQuery))
 		if res != nil && *res != nil && len(*res) > 0 {
 			//顺序处理,后序会有性能瓶颈,filterdata
-			util.Try(func() {
-				if !bsave {
-					for _, info := range *res {
-						tmp := map[string]interface{}{}
-						sid := util.BsonIdToSId(info["_id"])
-						if title != sid { //title在此处传的是关注信息id
-							tmp["s_id"] = sid
-							tmp["s_eid"] = util.EncodeArticleId2ByCheck(sid)
-							tmp["s_title"] = info["title"]
-							tmp["l_publishtime"] = info["publishtime"]
-							tmp["s_province"] = info["area"]
-							tmp["s_type"] = util.ObjToString(info["type"])
-							tmp["s_toptype"] = util.ObjToString(info["toptype"])
-							tmp["s_subtype"] = util.ObjToString(info["subtype"])
-							tmp["s_projectname"] = util.ObjToString(info["projectname"])
-							tmp["s_projectcode"] = util.ObjToString(info["projectcode"])
-							tmp["s_url"] = util.ObjToString(info["href"])
-							*pushArray = append(*pushArray, &tmp)
-						}
-					}
-				} else {
-					Pushlock.Lock()
-					defer Pushlock.Unlock()
-					filterData := &filterdata.FilterData{}
-					filterData.Start(openid)
-					defer filterData.End()
-					//1.组织信息、
-					//a_relationinfo s_id s_title s_projectname  s_projectcode  l_publishtime s_url
-					var ids []string
-					for _, info := range *res {
-						sid := util.BsonIdToSId(info["_id"])
-						if title == sid && !bpush {
-							continue
-						}
-						tmp := map[string]interface{}{}
-						tmp["s_id"] = sid
-						tmp["s_eid"] = util.EncodeArticleId2ByCheck(sid)
-						tmp["s_title"] = info["title"]
-						tmp["l_publishtime"] = info["publishtime"]
-						tmp["s_province"] = info["area"]
-						tmp["s_type"] = util.ObjToString(info["type"])
-						tmp["s_toptype"] = util.ObjToString(info["toptype"])
-						tmp["s_subtype"] = util.ObjToString(info["subtype"])
-						tmp["s_projectname"] = util.ObjToString(info["projectname"])
-						tmp["s_projectcode"] = util.ObjToString(info["projectcode"])
-						tmp["s_url"] = util.ObjToString(info["href"])
-						if filterData.IsExists(sid) {
-							continue
-						}
-						ids = append(ids, sid)
-						*pushArray = append(*pushArray, &tmp)
-					}
-					go func() {
-						//2.推送、
-						if pushArray.Len() > 0 {
-							sort.Sort(pushArray)
-							//更新用户关注的a_relationinfo、保存到推送记录表、推送给用户
-							//log.Println(fid, ids)
-							//项目公告保留包括本身在内的最新100条
-							updateFlag := false
-							if fid != nil {
-								followObject, fok := tools.MQFW.FindOneByField(FOLLOW_COLLECTION, &bson.M{"_id": fid}, `{"l_publishtime":1,"a_relationinfo":1,"s_id":1}`)
-								if fok && followObject != nil && len(*followObject) > 0 {
-									relationinfo, _ := (*followObject)["a_relationinfo"].([]interface{})
-									s_id, _ := (*followObject)["s_id"].(string)
-									rLength := len(relationinfo)
-									pLength := pushArray.Len()
-									setMap := bson.M{"a_lastpushids": ids}
-									if bpush {
-										setMap["l_lastpushtime"] = (*((*pushArray)[0]))["l_publishtime"]
-									} else {
-										setMap["l_lastpushtime"] = (*followObject)["l_publishtime"]
-									}
-									updateMap := &bson.M{"$set": setMap}
-									if rLength > 0 && rLength+pLength > KEEPCOUNT { //保留100条
-										start := rLength + pLength - KEEPCOUNT
-										firstInfo, _ := relationinfo[0].(map[string]interface{})
-										firstInfoId, _ := firstInfo["s_id"].(string)
-										var relationinfoTemp []interface{}
-										//保留本身
-										if s_id == firstInfoId && !bpush {
-											relationinfoTemp = relationinfo[:1]
-											if start+1 < rLength {
-												relationinfoTemp = append(relationinfoTemp, relationinfo[start+1:]...)
-											}
-										} else {
-											if start < rLength {
-												relationinfoTemp = append(relationinfoTemp, relationinfo[start:]...)
-											}
-										}
-										for _, v := range *pushArray {
-											relationinfoTemp = append(relationinfoTemp, v)
-										}
-										setMap["a_relationinfo"] = relationinfoTemp
-									} else { //追加
-										(*updateMap)["$pushAll"] = bson.M{"a_relationinfo": pushArray}
-									}
-									updateFlag = tools.MQFW.Update(FOLLOW_COLLECTION, &bson.M{"_id": fid}, updateMap, false, false)
-								}
-							}
-							if updateFlag && bpush {
-								//进入推送逻辑
-								tit := sname
-								if tit == "" {
-									tit = title
-								}
-								if tit == "" {
-									tit = scode
-								}
-								if tit != "" {
-									//go func() {
-									followid := util.BsonIdToSId(fid)
-									infoid := tools.MQFW.Save(FOLLOW_PUSH_LOG, &bson.M{
-										"s_openid":       openid,
-										"a_relationinfo": pushArray,
-										"l_date":         time.Now().Unix(),
-										"s_title":        title,
-										"s_projectcode":  scode,
-										"s_projectname":  sname,
-										"s_followid":     followid,
-									})
-									if infoid != "" {
-										lastTime := util.Int64All((*(*pushArray)[0])["l_publishtime"])
-										pushtt := fmt.Sprintf(WxTitle, tit)
-										Tip1 := ""
-										minute := time.Now().Unix() - lastTime
-										if minute > -1 && minute < 61 {
-											Tip1 = fmt.Sprintf("%d秒前发布的:\n", minute)
-										} else {
-											minute = minute / 60
-											if minute < 121 {
-												if minute < 1 {
-													minute = 1
-												}
-												Tip1 = fmt.Sprintf("%d分钟前发布的:\n", minute)
-											}
-										}
-										LastTip := ""
-										pushnum := len(*pushArray)
-										if pushnum > 1 {
-											LastTip = fmt.Sprintf("...(共%d条)", pushnum)
-										}
-										LastLen = LastLen - len([]rune(pushtt)) - len([]rune(Tip1))
-										Remark := ""
-										bshow := false
-										for n := 1; n < pushnum+1; n++ {
-											Remark += fmt.Sprintf("%d %s\n", n, (*(*pushArray)[n-1])["s_title"])
-											if len([]rune(Remark)) > LastLen {
-												if n == pushnum {
-													bshow = true
-												}
-												break
-											}
-										}
-										if bshow {
-											LastTip = ""
-										}
-										go log.Println("push", openid, pushnum, tit)
-										weixinrpc.SendWinXin(&qrpc.NotifyMsg{
-											Openid:  openid,
-											Title:   fmt.Sprintf(WxTitle, tit),
-											Remark:  Tip1 + Remark + LastTip,
-											Detail:  WxContent,
-											Service: WxGroup,
-											Url:     ViewDomain + "/front/sess/" + se.EncodeString(openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",wxpushfollowlist") + "__" + infoid + "__" + followid,
-										})
-									}
-									//}()
-								}
-								//推送结束
-							}
-						}
-					}()
-				}
-			}, func(e interface{}) {
-				log.Println("给用户推送关注信息时出错:", e)
-			})
+			pushArray = push(fid, sname, scode, title, openid, res, bsave, bpush)
 		}
 	}
 	return pushArray
 }
 
-/**
 //开始推送
-func push(muser *map[*map[string]interface{}]*[]*map[string]interface{}) {
-	if muser != nil && len(*muser) > 0 {
-		for userSet, infos := range *muser {
-			openid := (*userSet)["s_openid"].(string)
-			filterdata.FilterData.Start(openid)
-			util.Try(func() {
-				//1.组织信息、
-				//a_relationinfo s_id s_title s_projectname  s_projectcode  l_publishtime s_url
-				var pushArray = &Arr{}
-				var ids []string
-				if infos != nil && len(*infos) > 0 {
-					for _, info := range *infos {
-						tmp := map[string]interface{}{}
-						sid := fmt.Sprintf("%x", string((*info)["_id"].(bson.ObjectId)))
-						ids = append(ids, sid)
-						tmp["s_id"] = sid
-						tmp["s_eid"] = util.EncodeArticleId(sid)
-						tmp["s_title"] = (*info)["title"]
-						tmp["l_publishtime"] = (*info)["publishtime"]
-						tmp["s_province"] = (*info)["area"]
-						tmp["s_type"] = util.ObjToString((*info)["type"])
-						tmp["s_toptype"] = util.ObjToString((*info)["toptype"])
-						tmp["s_subtype"] = util.ObjToString((*info)["subtype"])
-						tmp["s_projectname"] = util.ObjToString((*info)["projectname"])
-						tmp["s_projectcode"] = util.ObjToString((*info)["projectcode"])
-						tmp["s_url"] = util.ObjToString((*info)["href"])
-						if filterdata.FilterData.IsExists(sid) {
-							continue
-						}
-						*pushArray = append(*pushArray, &tmp)
-					}
+func push(fid interface{}, sname, scode, title, openid string, res *[]map[string]interface{}, bsave, bpush bool) *Arr {
+	var pushArray = &Arr{}
+	util.Try(func() {
+		if !bsave {
+			for _, info := range *res {
+				tmp := map[string]interface{}{}
+				sid := util.BsonIdToSId(info["_id"])
+				if title != sid { //title在此处传的是关注信息id
+					tmp["s_id"] = sid
+					tmp["s_eid"] = util.EncodeArticleId2ByCheck(sid)
+					tmp["s_title"] = info["title"]
+					tmp["l_publishtime"] = info["publishtime"]
+					tmp["s_province"] = info["area"]
+					tmp["s_type"] = util.ObjToString(info["type"])
+					tmp["s_toptype"] = util.ObjToString(info["toptype"])
+					tmp["s_subtype"] = util.ObjToString(info["subtype"])
+					tmp["s_projectname"] = util.ObjToString(info["projectname"])
+					tmp["s_projectcode"] = util.ObjToString(info["projectcode"])
+					tmp["s_url"] = util.ObjToString(info["href"])
+					*pushArray = append(*pushArray, &tmp)
+				}
+			}
+		} else {
+			Pushlock.Lock()
+			defer Pushlock.Unlock()
+			filterData := &filterdata.FilterData{}
+			filterData.Start(openid)
+			defer filterData.End()
+			//1.组织信息、
+			//a_relationinfo s_id s_title s_projectname  s_projectcode  l_publishtime s_url
+			var ids []string
+			for _, info := range *res {
+				sid := util.BsonIdToSId(info["_id"])
+				if title == sid && !bpush {
+					continue
 				}
-				filterdata.FilterData.End(0)
+				tmp := map[string]interface{}{}
+				tmp["s_id"] = sid
+				tmp["s_eid"] = util.EncodeArticleId2ByCheck(sid)
+				tmp["s_title"] = info["title"]
+				tmp["l_publishtime"] = info["publishtime"]
+				tmp["s_province"] = info["area"]
+				tmp["s_type"] = util.ObjToString(info["type"])
+				tmp["s_toptype"] = util.ObjToString(info["toptype"])
+				tmp["s_subtype"] = util.ObjToString(info["subtype"])
+				tmp["s_projectname"] = util.ObjToString(info["projectname"])
+				tmp["s_projectcode"] = util.ObjToString(info["projectcode"])
+				tmp["s_url"] = util.ObjToString(info["href"])
+				if filterData.IsExists(sid) {
+					continue
+				}
+				ids = append(ids, sid)
+				*pushArray = append(*pushArray, &tmp)
+			}
+			go func() {
 				//2.推送、
 				if pushArray.Len() > 0 {
 					sort.Sort(pushArray)
 					//更新用户关注的a_relationinfo、保存到推送记录表、推送给用户
-					if tools.MQFW.Update(FOLLOW_COLLECTION, &bson.M{
-						"_id": (*userSet)["_id"],
-					}, &bson.M{
-						"$set": bson.M{
-							"l_lastpushtime": (*((*pushArray)[0]))["l_publishtime"],
-							"a_lastpushids":  ids,
-						},
-						"$pushAll": bson.M{
-							"a_relationinfo": pushArray,
-						},
-					}, false, false) {
-						tit := util.ObjToString((*userSet)["s_projectname"])
+					//log.Println(fid, ids)
+					//项目公告保留包括本身在内的最新100条
+					updateFlag := false
+					if fid != nil {
+						followObject, fok := tools.MQFW.FindOneByField(FOLLOW_COLLECTION, &bson.M{"_id": fid}, `{"l_publishtime":1,"a_relationinfo":1,"s_id":1}`)
+						if fok && followObject != nil && len(*followObject) > 0 {
+							relationinfo, _ := (*followObject)["a_relationinfo"].([]interface{})
+							s_id, _ := (*followObject)["s_id"].(string)
+							rLength := len(relationinfo)
+							pLength := pushArray.Len()
+							setMap := bson.M{"a_lastpushids": ids}
+							if bpush {
+								setMap["l_lastpushtime"] = (*((*pushArray)[0]))["l_publishtime"]
+							} else {
+								setMap["l_lastpushtime"] = (*followObject)["l_publishtime"]
+							}
+							updateMap := &bson.M{"$set": setMap}
+							if rLength > 0 && rLength+pLength > KEEPCOUNT { //保留100条
+								start := rLength + pLength - KEEPCOUNT
+								firstInfo, _ := relationinfo[0].(map[string]interface{})
+								firstInfoId, _ := firstInfo["s_id"].(string)
+								var relationinfoTemp []interface{}
+								//保留本身
+								if s_id == firstInfoId && !bpush {
+									relationinfoTemp = relationinfo[:1]
+									if start+1 < rLength {
+										relationinfoTemp = append(relationinfoTemp, relationinfo[start+1:]...)
+									}
+								} else {
+									if start < rLength {
+										relationinfoTemp = append(relationinfoTemp, relationinfo[start:]...)
+									}
+								}
+								for _, v := range *pushArray {
+									relationinfoTemp = append(relationinfoTemp, v)
+								}
+								setMap["a_relationinfo"] = relationinfoTemp
+							} else { //追加
+								(*updateMap)["$pushAll"] = bson.M{"a_relationinfo": pushArray}
+							}
+							updateFlag = tools.MQFW.Update(FOLLOW_COLLECTION, &bson.M{"_id": fid}, updateMap, false, false)
+						}
+					}
+					if updateFlag && bpush {
+						//进入推送逻辑
+						tit := sname
 						if tit == "" {
-							tit = util.ObjToString((*userSet)["s_title"])
+							tit = title
 						}
 						if tit == "" {
-							tit = util.ObjToString((*userSet)["s_projectcode"])
+							tit = scode
 						}
 						if tit != "" {
 							//go func() {
-							followid := fmt.Sprintf("%x", string((*userSet)["_id"].(bson.ObjectId)))
+							followid := util.BsonIdToSId(fid)
 							infoid := tools.MQFW.Save(FOLLOW_PUSH_LOG, &bson.M{
 								"s_openid":       openid,
 								"a_relationinfo": pushArray,
 								"l_date":         time.Now().Unix(),
-								"s_title":        util.ObjToString((*userSet)["s_title"]),
-								"s_projectcode":  util.ObjToString((*userSet)["s_projectcode"]),
-								"s_projectname":  util.ObjToString((*userSet)["s_projectname"]),
+								"s_title":        title,
+								"s_projectcode":  scode,
+								"s_projectname":  sname,
 								"s_followid":     followid,
 							})
 							if infoid != "" {
@@ -394,13 +396,13 @@ func push(muser *map[*map[string]interface{}]*[]*map[string]interface{}) {
 							}
 							//}()
 						}
+						//推送结束
 					}
 				}
-			}, func(e interface{}) {
-				filterdata.FilterData.End(0)
-				log.Println("给用户推送关注信息时出错:", e)
-			})
+			}()
 		}
-	}
+	}, func(e interface{}) {
+		log.Println("给用户推送关注信息时出错:", e)
+	})
+	return pushArray
 }
-**/

+ 1 - 1
src/jfw/modules/pushproject/src/main.go

@@ -9,7 +9,7 @@ import (
 	_ "net/http/pprof"
 	"net/rpc"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"rpcpush"
 	"time"

+ 15 - 10
src/jfw/modules/weixin/src/config.json

@@ -6,17 +6,17 @@
     "weixinport": "8080",
     "weixinrpcport": "8083",
     "webrpcport": "127.0.0.1:8084",
-    "webdomain": "http://wxrz.qmx.top/wx/service",
-    "appid": "wx9852f95aa927e646",
+    "webdomain": "http://webwcj.qmx.top",
+    "appid": "wx76e1309b01a7b17e",
     "apptoken": "top2016top2016",
-    "appsecret": "d4624c36b6795d1d99dcf0547af5443d",
-    "proxysess": "http://webws.qmx.top/front/sess/%s",
+    "appsecret": "dd00e71cb2370432d9de848b674eb8e7",
+    "proxysess": "http://webwcj.qmx.top/front/sess/%s",
     "followCompany": 10,
     "welcomemsg": "用剑鱼,所有功能完全免费,\n和传统的会员制说再见!\n\n<a href='%s'>点击这里</a>设置关键词,或直接回复“订阅 关键词”,如“订阅 教学设备”,您将随时随地接收招标信息!\n\n剑鱼,让投标无限可能!",
 	"tpl_push_id": "mdObA5vJtFPzRbokU7OB1tEG9nniY2VXdXk7DfasZVQ",
     "tpl_bidopen_id": "3URB-9evmkJ9wntI8iGMEl8_elSAC3wL3ZrQQX-q0cg",
     "tpl_managernotify_id": "LB0XHcbNQKcbgUdDfDncuJW10jay4EfoJ9j-UVh2j5A",
-    "weixinAutoRpl": "如果您在使用时需要帮助,可以给剑鱼君留言;\n或者<a href='http://www.myfans.cc/30a78e9b78'>点击这里</a>,进入【剑鱼招标社区】与剑鱼粉丝一起交流!\n\n您也可以点击下方菜单搜索、订阅招标信息;\n<a href='%s'>点击这里</a>设置关键词,或直接回复“订阅 关键词”,如“订阅 教学设备”,随时随地接收招标信息!",
+    "weixinAutoRpl": "感谢使用剑鱼!\n\n1. <a href='http://mp.weixin.qq.com/mp/homepage?__biz=MzIyNTM1NDUyNw==&hid=1&sn=f9e98da1975f85011ee138a4ee5cfbe8#wechat_redirect'>【产品帮助】</a>\n\n2. <a href='http://www.myfans.cc/30a78e9b78'>【招标社区】</a>\n\n3. <a href='%s'>【搜索招标信息】</a>\n\n4. <a href='%s'>【订阅招标信息】</a>\n\n5.   <a href='%s'>点击这里,查看“%s”的相关招标信息</a>\n\n6.   快速订阅:回复“订阅”加上你的关键词,比如“订阅 教学设备”\n\n7.   如需人工协助,请回复“客服”",
     "autoReplay": {
         "title": "剑鱼招标订阅,和丟标说拜拜",
         "url": "https://mp.weixin.qq.com/s?__biz=MzIyNTM1NDUyNw==&mid=100000001&idx=1&sn=58e6008f0577d529a56c9ed78724decf&scene=1&srcid=0628FMQzB61orhqGhfw7fOqT&key=77421cf58af4a653210128f66c0cd4486112d12cb69b77c0c8f926d725679273cf44f733f8993123ef0295c72b8946ba&ascene=0&uin=NDMwMjg4NTU1&devicetype",
@@ -25,10 +25,10 @@
     },
     "fastSubscribe": {
         "skill": "http://mp.weixin.qq.com/mp/homepage?__biz=MzIyNTM1NDUyNw==&hid=3&sn=badf2d7da08654c58b58169e773f58f0#wechat_redirect",
-        "success": "您已成功订阅该关键词“%s”。\n您可点击下方菜单“招标订阅”查看修改订阅关键词。\n<a href='%s'>点击这里,获得更多订阅技巧。</a>",
-        "fail": "对不起,您已订阅十个关键词,请点击下方菜单“招标订阅”修改订阅关键词\n<a href='%s'>点击这里,获得更多订阅技巧。</a>",
-        "exists": "您已订阅过关键词“%s”,\n您可点击下方菜单“招标订阅”查看修改订阅关键词;\n<a href='%s'>点击这里,获得更多订阅技巧。</a>",
-        "firsttake": "您已成功订阅该关键词“%s”。\n<a href='%s'>点击这里,获得更多订阅技巧。</a>",
+        "success": "您已成功订阅该关键词“%s”。您可点击下方菜单“我→招标订阅”查看修改订阅关键词。<a href='%s'>点击这里,获得更多订阅技巧。</a>",
+        "fail": "对不起,您已订阅十个关键词,请点击下方菜单“我→招标订阅”修改订阅关键词,<a href='%s'>点击这里,获得更多订阅技巧。</a>",
+        "exists": "您已订阅过关键词“%s”,您可点击下方菜单“我→招标订阅”查看修改订阅关键词,<a href='%s'>点击这里,获得更多订阅技巧。</a>",
+        "firsttake": "您已成功订阅该关键词“%s”。<a href='%s'>点击这里,获得更多订阅技巧。</a>",
         "hints": [
             "您已成功订阅该关键词“%s”。\n您订阅的关键词较多,可能会收不到推送信息。<a href='%s'>点击这里,获得更多订阅技巧。</a>",
             "您已成功订阅该关键词“%s”。\n您订阅的关键词字数过多,可能会收不到推送信息。<a href='%s'>点击这里,获得更多订阅技巧。</a>",
@@ -55,5 +55,10 @@
         "company_repeat": "您已关注过此企业 “%s”。<a href='%s'>点击此处查看我关注的企业列表信息。</a>",
         "company_fail": "抱歉!无法添加企业“%s”,<a href='%s'>因为您关注的企业,达到了系统上限,您可以点击此处删除多余的企业,然后重新添加。</a>"
     },
-    "influxdb": "http://jianyu:Topnet@20150501@wxrz.qmx.top:8086"
+    "influxdb": "http://jianyu:Topnet@20150501@wxrz.qmx.top:8086",
+	"subscribeReply":{
+		"title": "用剑鱼,给投标无限可能!",
+		"picUrl": "https://www.zhaobiao.info/images/wxreply/reply_1.png",
+		"description": "或直接回复“订阅”加上你的关键词,如“订阅 教学设备”完成订阅!"
+	}
 }

+ 28 - 22
src/jfw/modules/weixin/src/wx/wx.go

@@ -12,7 +12,6 @@ import (
 	"log"
 	"net/http"
 	"qfw/util"
-	"qfw/util/elastic"
 	"qfw/util/redis"
 	jrpc "qfw/util/rpc"
 	"regexp"
@@ -144,8 +143,14 @@ func MsgTxtHandler(w ResponseWriter, r *Request) {
 		openid := r.FromUserName
 		user, err := Mux.GetUserInfo(openid)
 		if err == nil {
-			url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
-			w.ReplyText(fmt.Sprintf(config.Sysconfig["weixinAutoRpl"].(string), url))
+			searchUrl := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",searchinfo"))
+			rsssetUrl := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
+			searchWord := strings.TrimSpace(r.Content)
+			if len(searchWord) > 0 && len([]rune(searchWord)) > 8 {
+				searchWord = string([]rune(searchWord)[:8]) + "..."
+			}
+			searchWordUrl := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",searchKeyword")) + "__" + searchWord
+			w.ReplyText(fmt.Sprintf(config.Sysconfig["weixinAutoRpl"].(string), searchUrl, rsssetUrl, searchWordUrl, searchWord))
 		}
 	}
 }
@@ -444,11 +449,12 @@ func Subscribe(w ResponseWriter, r *Request) {
 					if subkey != "" {
 						w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["key_fail"]), subkey, url))
 					} else {
+						subscribeReply := config.Sysconfig["subscribeReply"].(map[string]interface{})
 						w.ReplyNews([]Article{Article{
-							Title:       "用剑鱼,给投标无限可能!",
+							Title:       subscribeReply["title"].(string),
 							Url:         url,
-							PicUrl:      config.Sysconfig["webdomain"].(string) + "/images/wol.png",
-							Description: "或者在聊天框回复“订阅 关键词”,如“订阅 教学设备”,来获取招标信息!",
+							PicUrl:      subscribeReply["picUrl"].(string),
+							Description: subscribeReply["description"].(string),
 						}})
 						//w.ReplyText(fmt.Sprintf(welcomemsg, url))
 					}
@@ -476,11 +482,12 @@ func Subscribe(w ResponseWriter, r *Request) {
 				} else {
 					url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
 					//w.ReplyText(fmt.Sprintf(welcomemsg, url))
+					subscribeReply := config.Sysconfig["subscribeReply"].(map[string]interface{})
 					w.ReplyNews([]Article{Article{
-						Title:       "用剑鱼,给投标无限可能!",
+						Title:       subscribeReply["title"].(string),
 						Url:         url,
-						PicUrl:      config.Sysconfig["webdomain"].(string) + "/images/wol.png",
-						Description: "或者在聊天框回复“订阅 关键词”,如“订阅 教学设备”,来获取招标信息!",
+						PicUrl:      subscribeReply["picUrl"].(string),
+						Description: subscribeReply["description"].(string),
 					}})
 				}
 			} else if pccodepre == "18" {
@@ -516,21 +523,23 @@ func Subscribe(w ResponseWriter, r *Request) {
 				} else {
 					url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
 					//w.ReplyText(fmt.Sprintf(welcomemsg, url))
+					subscribeReply := config.Sysconfig["subscribeReply"].(map[string]interface{})
 					w.ReplyNews([]Article{Article{
-						Title:       "用剑鱼,给投标无限可能!",
+						Title:       subscribeReply["title"].(string),
 						Url:         url,
-						PicUrl:      config.Sysconfig["webdomain"].(string) + "/images/wol.png",
-						Description: "或者在聊天框回复“订阅 关键词”,如“订阅 教学设备”,来获取招标信息!",
+						PicUrl:      subscribeReply["picUrl"].(string),
+						Description: subscribeReply["description"].(string),
 					}})
 				}
 			} else {
 				url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
 				//w.ReplyText(fmt.Sprintf(welcomemsg, url))
+				subscribeReply := config.Sysconfig["subscribeReply"].(map[string]interface{})
 				w.ReplyNews([]Article{Article{
-					Title:       "用剑鱼,给投标无限可能!",
+					Title:       subscribeReply["title"].(string),
 					Url:         url,
-					PicUrl:      config.Sysconfig["webdomain"].(string) + "/images/wol.png",
-					Description: "或者在聊天框回复“订阅 关键词”,如“订阅 教学设备”,来获取招标信息!",
+					PicUrl:      subscribeReply["picUrl"].(string),
+					Description: subscribeReply["description"].(string),
 				}})
 			}
 			//正则查看是不是临时二维码
@@ -543,11 +552,12 @@ func Subscribe(w ResponseWriter, r *Request) {
 		} else {
 			url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
 			//w.ReplyText(fmt.Sprintf(welcomemsg, url))
+			subscribeReply := config.Sysconfig["subscribeReply"].(map[string]interface{})
 			w.ReplyNews([]Article{Article{
-				Title:       "用剑鱼,给投标无限可能!",
+				Title:       subscribeReply["title"].(string),
 				Url:         url,
-				PicUrl:      config.Sysconfig["webdomain"].(string) + "/images/wol.png",
-				Description: "或者在聊天框回复“订阅 关键词”,如“订阅 教学设备”,来获取招标信息!",
+				PicUrl:      subscribeReply["picUrl"].(string),
+				Description: subscribeReply["description"].(string),
 			}})
 			//正则查看是不是临时二维码
 			if digitreg.MatchString(source) {
@@ -824,10 +834,6 @@ func Findent(entname string) string {
 		data["l_createtime"] = time.Now().Unix()
 		winnerid = tools.MQFW.Save("winner", data)
 		data["_id"] = winnerid
-		flag := elastic.Save("winner", "winner", data)
-		if !flag {
-			log.Println("企业保存elastic出错!")
-		}
 	} else {
 		winnerid = util.ObjToString(util.BsonIdToSId((*tem)["_id"]))
 	}

+ 1 - 1
src/jfw/rpcfollow/rpc.go

@@ -5,7 +5,7 @@ import (
 	tools "jfw/tools"
 	"log"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	frpc "qfw/util/rpc"
 	"time"
 

+ 1 - 1
src/main.go

@@ -13,7 +13,7 @@ import (
 	"net/http"
 	"net/rpc"
 	"qfw/util"
-	"qfw/util/elastic"
+	elastic "qfw/util/elastic_v5"
 	"qfw/util/redis"
 	"time"
 

+ 1 - 1
src/seo.json

@@ -327,7 +327,7 @@
 	},
 	"jyadd":"http://127.0.0.1",
 	"limitcount":20,
-	"ZBADDRESS":"http://ws.jy.com",
+	"ZBADDRESS":"",
 	"jysy":"10",
 	"jydyy":"11",
 	"jysslby":"12",

+ 6 - 2
src/web/staticres/css/dev2/biddingSearch.css

@@ -44,6 +44,7 @@
   background: #2cb7ca url(/images/biddingSearch/sea-header-btnImg-bai.png) 12px center no-repeat;
   background-size: 15px 16px;
   color: #ffffff;
+  text-decoration: none;
 }
 
 #searchInner .searchHeader .searchHeader-container .searchInput {
@@ -214,11 +215,13 @@ border-radius:2px;
 }
 
 #searchInner .searchHeader .searchHeader-container .searchInput .search-right-wx .search-right-wx-inner .wx-inner-bottom {
-  padding: 10px;
-  border-top: 1px solid #e0e0e0;
+  padding: 0px 10px 0px 20px;
   line-height: 21px;
   word-wrap: break-word;
 /*  word-break: keep-all;*/
+	position: relative;
+	top: -10px;
+	font-size: 14px;
 }
 
 #searchInner .searchHeader .searchHeader-container .searchInput .search-right-wx .search-right-wx-inner .wx-inner-bottom i {
@@ -596,6 +599,7 @@ border-radius:2px;
 /*  height: 100%;*/
   font-size: 16px;
   color: #252627;
+    text-decoration: none;
 }
 
 #searchInner .searchControl .seaTender-inner .tabTitle li a.active {

+ 3 - 1
src/web/staticres/css/wxsearch.css

@@ -2039,7 +2039,9 @@ body{
 	line-height: 37px;
 	font-size: 13px;
 }
-
+#entsearchPage .rec:last-child{
+	border-bottom: none;
+}
 #entsearchPage #jytables{
 	/*padding: .3rem;*/
 	padding-bottom: .3rem;

BIN
src/web/staticres/images/wxreply/reply_1.png


+ 22 - 5
src/web/staticres/js/proproject.js

@@ -125,7 +125,7 @@ function getNewBids(pnum){
 			}else{
 				$(".nbnext").removeClass("disabled");
 			}
-			appendDatas(r.list);
+			appendDatas(r.list,true);
 		}else{
 			submitflag=true;
 			$(".tabContainer").hide();
@@ -168,6 +168,9 @@ function getVIPData(){
 	   data:param,
        dataType:'json', 
        success:function(r){
+			if(typeof(totalPage) != "undefined" && currentPage == 1){
+				totalPage = r.totalPage;
+			}
 			if(r&&r.list!=null&&r.list.length>0){
 				$(".tabContainer").show();
 				$(".pagination").show();
@@ -178,7 +181,7 @@ function getVIPData(){
 				}else{
 					$(".nbnext").removeClass("disabled");
 				}
-				appendDatas(r.list);
+				appendDatas(r.list,false);
 			}else{
 				if(currentPage>1){
 					$(".nbnext").addClass("disabled");
@@ -245,7 +248,7 @@ function getNewBiddings(){
 }
 //
 
-function appendDatas(datas){
+function appendDatas(datas,isNew){
 	var listHtml = '';
 	var tableHtml = '';
 	var searchvalueArray = searchvalue.split("+");
@@ -253,6 +256,13 @@ function appendDatas(datas){
 	if(datas.length<pageSize){
 		$(".nbnext").addClass("disabled");
 	}
+	if(!isNew && typeof(totalPage) != "undefined"){
+		if(currentPage == totalPage){
+			$(".nbnext").addClass("disabled");
+		}else{
+			$(".nbnext").removeClass("disabled");
+		}
+	}
 	for(var i=0;i<datas.length;i++){
 		var index = (currentPage - 1) * pageSize + i + 1;
 		var title = datas[i].title;
@@ -260,8 +270,12 @@ function appendDatas(datas){
 		title = keyWordHighlight(title,searchvalueArray.join("|"),"<font class='com-highlight'>$1</font>");
 		
 		var type = datas[i].subtype;
+		var bbs = "border-bottom: 1px solid #EBEBEB;";
+		if(i == datas.length-1){
+			bbs = "";
+		}
 		listHtml += '<li>'
-					+'<div class="liLuceneList" style="border-bottom: 1px solid #EBEBEB;">'
+					+'<div class="liLuceneList" style="'+bbs+'">'
 					+'<div class="luce-left"><em>'+index+'.</em>'
 					+'<div class="left-title">'
 					+'<a onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank"> '+title+'</a>'
@@ -514,6 +528,9 @@ function searchOnsubmit(){
 				industry : "",
 			};
 	$.post("/front/pcAjaxReq",param,function(r){
+		if(typeof(totalPage) != "undefined" && currentPage == 1){
+			totalPage = r.totalPage;
+		}
 		if(r.list == null || r.list.length == 0){
 			if(currentPage>1){
 				$(".nbnext").addClass("disabled");
@@ -531,7 +548,7 @@ function searchOnsubmit(){
 			$(".tabContainer").show();
 			$(".pagination").show();
 			$(".hasNoData").hide();
-			appendDatas(r.list)
+			appendDatas(r.list,false)
 		}
 	});
 }

+ 18 - 5
src/web/staticres/js/superSearch.js

@@ -256,7 +256,7 @@ function getNewBids(pnum){
 			}else{
 				$(".nbnext").removeClass("disabled");
 			}
-			appendDatas(r.list);
+			appendDatas(r.list,false,true);
 		}else{
 			submitflag=true;
 			$(".tabContainer").hide();
@@ -296,7 +296,7 @@ function getNewBiddings(){
 			}else{
 				$(".nbnext").removeClass("disabled");
 			}
-			appendDatas(r.list,false);
+			appendDatas(r.list,false,true);
 		}else{
 			if(currentPage>1){
 				$(".nbnext").addClass("disabled");
@@ -315,7 +315,7 @@ function getNewBiddings(){
 }
 //
 
-function appendDatas(datas,flag){
+function appendDatas(datas,flag,isNew){
 	var listHtml = '';
 	var tableHtml = '';
 	var searchvalueArray = searchvalue.split("+");
@@ -330,6 +330,13 @@ function appendDatas(datas,flag){
 	if(datas.length<pageSize){
 		$(".nbnext").addClass("disabled");
 	}
+	if(!isNew && typeof(totalPage) != "undefined"){
+		if(currentPage == totalPage){
+			$(".nbnext").addClass("disabled");
+		}else{
+			$(".nbnext").removeClass("disabled");
+		}
+	}
 	for(var i=0;i<datas.length;i++){
 		var index = (currentPage - 1) * pageSize + i + 1;
 		var title = datas[i].title;
@@ -579,6 +586,9 @@ function getVIPData(){
 	   data:param,
        dataType:'json', 
        success:function(r){
+			if(typeof(totalPage) != "undefined" && currentPage == 1){
+				totalPage = r.totalPage;
+			}
 			if(r&&r.list!=null&&r.list.length>0){
 				$(".tabContainer").show();
 				$(".pagination").show();
@@ -589,7 +599,7 @@ function getVIPData(){
 				}else{
 					$(".nbnext").removeClass("disabled");
 				}
-				appendDatas(r.list,tlflag);
+				appendDatas(r.list,tlflag,false);
 			}else{
 				if(currentPage>1){
 					$(".nbnext").addClass("disabled");
@@ -757,6 +767,9 @@ function searchOnsubmit(){
 				industry : $("#zbSeatchT [name='industry']").val(),
 			};
 	$.post("/front/pcAjaxReq",param,function(r){
+		if(typeof(totalPage) != "undefined" && currentPage == 1){
+			totalPage = r.totalPage;
+		}
 		if(r.list == null || r.list.length == 0){
 			if(currentPage>1){
 				$(".nbnext").addClass("disabled");
@@ -774,7 +787,7 @@ function searchOnsubmit(){
 			$(".tabContainer").show();
 			$(".pagination").show();
 			$(".hasNoData").hide();
-			appendDatas(r.list,true)
+			appendDatas(r.list,true,false)
 		}
 	});
 }

+ 9 - 8
src/web/staticres/js/wxEntsesearch.js

@@ -531,13 +531,6 @@ var EntSearch = {
 		projectname = projectname.replace(/#/g,"%23").replace(/\?/g,"%3F");
 		window.location.href="/follow/photo/"+id+"__"+projectname+"__"+projectcode;
     },
-    //筛选隐藏
-	shaixuanHide: function () {
-        $("#entsearchPage .nullcontent").addClass("hidden");
-        $("#entsearchPage #set_search").addClass("hidden");
-        $("#entsearchPage #wrapper").removeClass("hidden");
-        $("#entsearchPage .tip_m").removeClass("hidden");
-    },
     //null or undefined to empty then trim
     operStr: function (str) {
         if(!str){
@@ -656,8 +649,13 @@ var EntSearch = {
 		if(!EntSearch.beforeSubmit()){
 			return;
 		}
+		$("#entsearchPage .nullcontent").addClass("hidden");
+		$("#entsearchPage #set_search").addClass("hidden");
         $("#entsearchPage #ent_searchinput").blur();
         $("#entsearchPage #recList").hide();
+		$("#entsearchPage #wrapper").addClass("hidden");
+		$("#entsearchPage .dropload-down").remove();
+		$("#entsearchPage").append('<div class="dropload-down"><div class="dropload-load"><span class="loading"></span>加载中...</div></div>');
         EntSearch.noMoreCache = false;
         EntSearch.reqParam["pageNum"]=1;
 		EntSearch.requesting = true;
@@ -668,6 +666,7 @@ var EntSearch = {
 			dataType: "json",
 			success: function(r){
 				EntSearch.requesting = false;
+				$("#entsearchPage .dropload-down").remove();
 				if(r){
 	                var proList = r.proList;
 	                if(typeof(proList)!="undefined" && proList.length>0){
@@ -675,7 +674,8 @@ var EntSearch = {
 	                    var html = EntSearch.getHtml(proList,1);
 				        EntSearch.noDataCache = false;
 	                    EntSearch.appendListHtml(html);
-	                    EntSearch.shaixuanHide();
+				        $("#entsearchPage #wrapper").removeClass("hidden");
+				        $("#entsearchPage .tip_m").removeClass("hidden");
 						EntSearch.initDropload(r.hasNextPage,2);
 	                }else{
 	                    EntSearch.hasNoData();
@@ -683,6 +683,7 @@ var EntSearch = {
 	            }
 			},
 			error: function(xhr,type){
+				$("#entsearchPage .dropload-down").remove();
 				EntSearch.requesting = false;
 			}
 		});

+ 54 - 37
src/web/staticres/js/wxSupersearch.js

@@ -49,6 +49,7 @@ var SuperSearch = {
 			if(sessionStorage && history && isPushHistory){
 				history.pushState({},"","");
 			}
+			this.searchKeyword();
 		}
 		if(this.initFlag){
 			return;
@@ -481,6 +482,14 @@ var SuperSearch = {
 		$("#supersearchPage .selLable").removeClass("hidden");
 		SuperSearch.setUpLastPage();
 	},
+	searchKeyword: function(){
+		if(searchWord != null && searchWord != ""){
+			$("#supersearchPage input[name=super_searchinput]").val(searchWord);
+			this.getIndustry();
+			this.canSearch();
+			SuperSearch.formSubmit("N");
+		}
+	},
 	resetPage: function(flag){
 		this.showNull = null;
 		this.requesting = false;
@@ -751,10 +760,6 @@ var SuperSearch = {
 		}
 	},
 	show: function () {   //筛选页面和内容展示替换显示
-		if(!$("#supersearchPage #super_search").hasClass("hidden")){
-			$("#supersearchPage .selLable").removeClass("hidden");
-			$("#supersearchPage #super_search").addClass("hidden");
-		}
 		if (SuperSearch.showNull) {
 			$("#supersearchPage #wrapper").addClass("hidden");
 			$("#supersearchPage .nullcontent").removeClass("hidden");
@@ -774,6 +779,16 @@ var SuperSearch = {
 		if(!SuperSearch.beforeSubmit()){
 			return;
 		}
+		$("#supersearchPage #table").addClass("hidden");
+		$("#supersearchPage #list").addClass("hidden");
+		if(SuperSearch.showNull){
+			$("#supersearchPage .resbm").addClass("hidden");
+		}
+		$("#supersearchPage .nullcontent").addClass("hidden");
+		$("#supersearchPage .selLable").removeClass("hidden");
+		$("#supersearchPage #super_search").addClass("hidden");
+		$("#supersearchPage #wrapper .dropload-down").remove();
+		$("#supersearchPage #wrapper").removeClass("hidden").append('<div class="dropload-down"><div class="dropload-load"><span class="loading"></span>加载中...</div></div>');
 		SuperSearch.behaviorCollect(1);
 		$("#supersearchPage input[name=super_searchinput]").blur();
 		$("#supersearchPage .clearInpt").addClass("hidden");
@@ -798,6 +813,7 @@ var SuperSearch = {
 				//查询后显示 展示方式
 				$("#supersearchPage .selLable").removeClass("hidden");
 				//铺查询信息
+				$("#supersearchPage #wrapper .dropload-down").remove();
 				if(data["list"] == null || data["list"].length == 0){
 					$("#supersearchPage #list").text("");
 					SuperSearch.hasNoData();
@@ -814,6 +830,7 @@ var SuperSearch = {
 				}
 			},
 			error: function(xhr,type){
+				$("#supersearchPage #wrapper .dropload-down").remove();
 				SuperSearch.requesting = false;
 			}
 		});
@@ -1443,43 +1460,43 @@ var SuperSearch = {
 	    //行业点击事件
 	    var dialogObjthree = $("#supersearchPage .contentthree");
 	    dialogObjthree.find(".btn").click(function(){
-		if($(this).parent().index() == 0){
-		    dialogObjthree.find('div[id="dqbtn"]').removeClass("active");
-		    dialogObjthree.find(".btn").removeClass("active");
-		    $(this).addClass("active");
-		}else{
-		    if(open_supersearch){				//判断是否开通超级搜索
-			if($(this).hasClass("active")){
-			    dialogObjthree.find(".btn").removeClass("active");
-			    dialogObjthree.find("div[id='dqbtn']").removeClass("active");
-			    dialogObjthree.find("ul:first li:first .btn").addClass("active");
-			}else{
-			    dialogObjthree.find("ul:first li:first .btn").removeClass("active");
+			if($(this).parent().index() == 0){
+			    dialogObjthree.find('div[id="dqbtn"]').removeClass("active");
 			    dialogObjthree.find(".btn").removeClass("active");
-			    dialogObjthree.find("div[id='dqbtn']").removeClass("active");
 			    $(this).addClass("active");
-			}
-		    }else{
-			SuperSearch.toOpenSupersearch();
-			return
-		    }
-		};
+			}else{
+			    if(open_supersearch){				//判断是否开通超级搜索
+					if($(this).hasClass("active")){
+					    dialogObjthree.find(".btn").removeClass("active");
+					    dialogObjthree.find("div[id='dqbtn']").removeClass("active");
+					    dialogObjthree.find("ul:first li:first .btn").addClass("active");
+					}else{
+					    dialogObjthree.find("ul:first li:first .btn").removeClass("active");
+					    dialogObjthree.find(".btn").removeClass("active");
+					    dialogObjthree.find("div[id='dqbtn']").removeClass("active");
+					    $(this).addClass("active");
+					}
+			    }else{
+					SuperSearch.toOpenSupersearch();
+					return
+			    }
+			};
 	    });
 	    dialogObjthree.find('div[id="dqbtn"]').click(function(){
-		if(open_supersearch){
-	
-		    if($(this).hasClass("active")){
-			dialogObjthree.find(".btn").removeClass("active");
-			dialogObjthree.find("div[id='dqbtn']").removeClass("active");
-			dialogObjthree.find("ul:first li:first .btn").addClass("active");
-		    }else{
-			dialogObjthree.find("div[id='dqbtn']").removeClass("active");
-			dialogObjthree.find(".btn").removeClass("active");
-			$(this).addClass("active");
-		    }
-		}else{
-		    SuperSearch.toOpenSupersearch();
-		}
+			if(open_supersearch){
+		
+			    if($(this).hasClass("active")){
+					dialogObjthree.find(".btn").removeClass("active");
+					dialogObjthree.find("div[id='dqbtn']").removeClass("active");
+					dialogObjthree.find("ul:first li:first .btn").addClass("active");
+			    }else{
+					dialogObjthree.find("div[id='dqbtn']").removeClass("active");
+					dialogObjthree.find(".btn").removeClass("active");
+					$(this).addClass("active");
+			    }
+			}else{
+			    SuperSearch.toOpenSupersearch();
+			}
 	    });
 	},
 	initMobiscroll: function (){

+ 12 - 1
src/web/templates/active/ext-tengxun.html

@@ -41,7 +41,18 @@
 	</div>
 </section>
 <script type="text/javascript" src="/js/baidu-tengxun-ground.js"></script>
-
+<script type="text/javascript">
+    window._pt_lt = new Date().getTime();
+    window._pt_sp_2 = [];
+    _pt_sp_2.push('setAccount,3670d91c');
+    var _protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
+    (function() {
+        var atag = document.createElement('script'); atag.type = 'text/javascript'; atag.async = true;
+        atag.src = _protocol + 'js.ptengine.cn/3670d91c.js';
+        var s = document.getElementsByTagName('script')[0];
+        s.parentNode.insertBefore(atag, s);
+    })();
+</script>
 {{include "/common/baiducc.html"}}
 </body>
 </html>

+ 22 - 9
src/web/templates/pc/biddingsearch_enterprise.html

@@ -668,6 +668,7 @@
 
 	<script>
 		var mainList = {{.T.list}};
+		var totalPage = {{.T.totalPage}};
 		var submitflag = true;
 		var pricetype = "";
 		var areas = {{.T.area}};
@@ -1097,7 +1098,7 @@
 		
 		//取redis里的数据
 		function getNewBids(pnum){
-			$.post("/jylab/supsearch/getNewBids",{pageNumber:pnum,pageType:"bident"},function(r){
+			$.post("/jylab/supsearch/getNewBids",{pageNumber:pnum},function(r){
 				if(r.list == null || r.list.length == 0){
 					$(".seaTender-inner").css({'border':''});
 	                $(".tabContainer").hide();
@@ -1136,6 +1137,9 @@
 			   data:param,
 		       dataType:'json', 
 		       success:function(r){
+					if(currentPage == 1){
+						totalPage = r.totalPage;
+					}
 					if(r.list == null || r.list.length == 0){
 						$(".seaTender-inner").css({'border':''});
 		                $(".tabContainer").hide();
@@ -1314,6 +1318,9 @@
             currentPage: currentPage
         };
         $.post("/jylab/pcSearchZbqyAjax",param,function(r){
+			if(currentPage == 1){
+				totalPage = r.totalPage;
+			}
             if(r.list == null || r.list.length == 0){
 				$(".seaTender-inner").css({'border':''});
                 $(".tabContainer").hide();
@@ -1329,8 +1336,18 @@
     }
     
     function getSearchTable(datas) {
-        if(datas.length < 50){
-            $(".nbnext").addClass("disabled");
+		if(searchvalue==""){
+			if(currentPage == 10 || datas.length < pageSize){
+				$(".nbnext").addClass("disabled");
+			}else{
+				$(".nbnext").removeClass("disabled");
+			}
+		}else{
+			if(currentPage == totalPage){
+				$(".nbnext").addClass("disabled");
+			}else{
+				$(".nbnext").removeClass("disabled");
+			}
 		}
         var listItem = "";
         var formItem = "";
@@ -1473,12 +1490,8 @@
 				formItem +='<td class="tt-l">'+datas[i].projectname+'</td>'
 				//
 				if(typeof(datas[i].bidamount) != "undefined" && datas[i].bidamount != null && datas[i].bidamount != ""){
-					var bidamount = datas[i].bidamount/10000;
-					if(diff != null){
-						formItem += '<td class="tt-r">'+bidamount+'</td>';
-					}else{
-						formItem += '<td></td>';
-					}
+					var bidamount = parseInt(datas[i].bidamount)/10000;
+					formItem += '<td class="tt-r">'+bidamount+'</td>';
 				}else{
 					formItem += '<td></td>';
 				}

+ 1 - 0
src/web/templates/pc/proproject.html

@@ -262,6 +262,7 @@ var selectTimeslot = {{.T.timeslot}};
 //var subtype = {{.T.subtype}};
 var keys = {{.T.keywords}};
 var list = {{.T.list}}
+var totalPage = {{.T.totalPage}};
 var searchvalue = {{.T.searchvalue}};
 var searchvalueArray = searchvalue.split("+");
 var dataId = "";

+ 1 - 0
src/web/templates/pc/supsearch.html

@@ -249,6 +249,7 @@ var industry = {{.T.industry}}
 var industrylist = {{.T.industrylist}}
 var sortArray = {{.T.sortArray}}
 var list = {{.T.list}}
+var totalPage = {{.T.totalPage}};
 var searchvalue = {{.T.searchvalue}};
 var searchvalueArray = searchvalue.split("+");
 var dataId = "";

+ 4 - 1
src/web/templates/weixin/search/mainSearch.html

@@ -28,6 +28,7 @@
 	var s_openid = {{.T.openid}};
 	var pageSize = {{.T.pageSize}};
 	var encode = {{ConEncode "/jylab/mainSearch/"}};
+	var searchWord = {{.T.searchWord}};
 	initShare({{.T.signature}},{{.T.openid}},2,"jy_extend",{{.T.nickname}},{{.T.avatar}});
 	SuperSearch.ZBADDRESS = {{Msg "seo" "ZBADDRESS"}};
 	SuperSearch.industry = {{.T.industry}};
@@ -549,7 +550,9 @@
 				}
 			}
 	    });
-		if(initFlag == 0){
+		if(searchWord != null && searchWord != ""){
+			SuperSearch.init(true,false,false);
+		}else if(initFlag == 0){
 			$("#searchIndex").removeClass("hidden");
 		}
 		checkIsOpen();