|
@@ -4,8 +4,12 @@ import (
|
|
"encoding/base64"
|
|
"encoding/base64"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "github.com/go-xweb/xweb"
|
|
|
|
+ . "github.com/thinxer/go-word2vec"
|
|
|
|
+ "gopkg.in/mgo.v2/bson"
|
|
"html/template"
|
|
"html/template"
|
|
"jfw/config"
|
|
"jfw/config"
|
|
|
|
+ "jfw/jyutil"
|
|
"jfw/tools"
|
|
"jfw/tools"
|
|
"jfw/wx"
|
|
"jfw/wx"
|
|
"log"
|
|
"log"
|
|
@@ -18,10 +22,6 @@ import (
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
"time"
|
|
"time"
|
|
-
|
|
|
|
- "github.com/go-xweb/xweb"
|
|
|
|
- . "github.com/thinxer/go-word2vec"
|
|
|
|
- "gopkg.in/mgo.v2/bson"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
const (
|
|
const (
|
|
@@ -29,7 +29,7 @@ const (
|
|
bidSearch_maxPageSize = 10 //招标搜索分页--最大页数
|
|
bidSearch_maxPageSize = 10 //招标搜索分页--最大页数
|
|
wx_maxPageNum = 20
|
|
wx_maxPageNum = 20
|
|
wx_pageSize = 50
|
|
wx_pageSize = 50
|
|
- bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","biddingcontent"`
|
|
|
|
|
|
+ bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","href","bidopentime","winner","agency","bidamount","budget","biddingcontent","projectname"`
|
|
bidSearch_field = bidSearch_field_1 + `,"detail"`
|
|
bidSearch_field = bidSearch_field_1 + `,"detail"`
|
|
bidSearch_sort = `{"publishtime":-1}`
|
|
bidSearch_sort = `{"publishtime":-1}`
|
|
)
|
|
)
|
|
@@ -140,7 +140,7 @@ func (m *Front) NewSordfish() error {
|
|
m.DisableHttpCache()
|
|
m.DisableHttpCache()
|
|
lastBids := elastic.GetPage("bidding", "bidding", "{}", bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","biddingcontent"`, 0, 18)
|
|
lastBids := elastic.GetPage("bidding", "bidding", "{}", bidSearch_sort, `"_id","title","publishtime","toptype","subtype","type","area","href","biddingcontent"`, 0, 18)
|
|
if lastBids != nil && len(*lastBids) > 0 {
|
|
if lastBids != nil && len(*lastBids) > 0 {
|
|
- bidListConvert("", lastBids)
|
|
|
|
|
|
+ jyutil.BidListConvert("", lastBids)
|
|
lbnHtml, olHtml := structureLastBidsHtml(lastBids)
|
|
lbnHtml, olHtml := structureLastBidsHtml(lastBids)
|
|
m.T["lbnHtml"] = lbnHtml
|
|
m.T["lbnHtml"] = lbnHtml
|
|
m.T["olHtml"] = olHtml
|
|
m.T["olHtml"] = olHtml
|
|
@@ -422,7 +422,7 @@ func (m *Front) PcAjaxReq() {
|
|
//获取最新招标信息
|
|
//获取最新招标信息
|
|
if reqType == "lastBids" {
|
|
if reqType == "lastBids" {
|
|
ls := elastic.GetPage(INDEX, TYPE, "{}", bidSearch_sort, bidSearch_field_1, 0, 18)
|
|
ls := elastic.GetPage(INDEX, TYPE, "{}", bidSearch_sort, bidSearch_field_1, 0, 18)
|
|
- bidListConvert("", ls)
|
|
|
|
|
|
+ jyutil.BidListConvert("", ls)
|
|
m.ServeJson(map[string]interface{}{
|
|
m.ServeJson(map[string]interface{}{
|
|
"list": ls,
|
|
"list": ls,
|
|
})
|
|
})
|
|
@@ -508,7 +508,7 @@ func getBidSearchData(searchvalue, area, publishtime, subtype, industry string,
|
|
repl = elastic.GetByNgram(INDEX, TYPE, searchvalue, query, `"title"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize)
|
|
repl = elastic.GetByNgram(INDEX, TYPE, searchvalue, query, `"title"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize)
|
|
}
|
|
}
|
|
if repl != nil && *repl != nil && len(*repl) > 0 {
|
|
if repl != nil && *repl != nil && len(*repl) > 0 {
|
|
- bidListConvert(industry, repl)
|
|
|
|
|
|
+ jyutil.BidListConvert(industry, repl)
|
|
list = repl
|
|
list = repl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -533,7 +533,7 @@ func getLastNewsData(searchvalue, area, publishtime, subtype, industry string, s
|
|
}
|
|
}
|
|
repl := elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, true, false, 115)
|
|
repl := elastic.GetByNgramOther(INDEX, TYPE, searchvalue, query, `"title","detail"` /*FINDF*/, bidSearch_sort, bidSearch_field, start, bidSearch_pageSize, true, false, 115)
|
|
if repl != nil && *repl != nil && len(*repl) > 0 {
|
|
if repl != nil && *repl != nil && len(*repl) > 0 {
|
|
- bidListConvert(industry, repl)
|
|
|
|
|
|
+ jyutil.BidListConvert(industry, repl)
|
|
list = repl
|
|
list = repl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -846,9 +846,41 @@ func (m *Front) WxsearchlistPaging() {
|
|
industry := m.GetString("industry")
|
|
industry := m.GetString("industry")
|
|
list = getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, pageNum, selectType)
|
|
list = getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, industry, pageNum, selectType)
|
|
}
|
|
}
|
|
|
|
+ //历史记录和订阅查询
|
|
|
|
+ if userId := m.GetSession("userId"); userId != nil {
|
|
|
|
+ one, _ := mongodb.FindOneByField("user", bson.M{"_id": bson.ObjectIdHex(userId.(string))}, `{"o_jy":1}`)
|
|
|
|
+ history := redis.GetStr("other", "s_"+userId.(string))
|
|
|
|
+ arrs := strings.Split(history, ",")
|
|
|
|
+ if history == "" {
|
|
|
|
+ arrs = make([]string, 0)
|
|
|
|
+ }
|
|
|
|
+ l := len(arrs) - 1
|
|
|
|
+ for i := 0; i < len(arrs)/2; i++ {
|
|
|
|
+ tmp := arrs[l-i]
|
|
|
|
+ arrs[l-i] = arrs[i]
|
|
|
|
+ arrs[i] = tmp
|
|
|
|
+ }
|
|
|
|
+ m.T["history"] = arrs
|
|
|
|
+ if one != nil && len(*one) > 0 {
|
|
|
|
+ o_jy, _ := (*one)["o_jy"].(map[string]interface{})
|
|
|
|
+ a_key, _ := o_jy["a_key"].([]interface{})
|
|
|
|
+ var keys []interface{}
|
|
|
|
+ for _, v := range a_key {
|
|
|
|
+ keyMap, _ := v.(map[string]interface{})
|
|
|
|
+ key, _ := keyMap["key"].([]interface{})
|
|
|
|
+ keys = append(keys, key)
|
|
|
|
+ }
|
|
|
|
+ m.T["msgset"] = keys
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
m.ServeJson(map[string]interface{}{
|
|
m.ServeJson(map[string]interface{}{
|
|
"list": list,
|
|
"list": list,
|
|
"hasNextPage": list != nil && len(*list) == wx_pageSize && pageNum < wx_maxPageNum,
|
|
"hasNextPage": list != nil && len(*list) == wx_pageSize && pageNum < wx_maxPageNum,
|
|
|
|
+ "history": m.T["history"],
|
|
|
|
+ "msgset": m.T["msgset"],
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -878,7 +910,7 @@ func getWxsearchlistData(keywords, searchvalue, scope, publishtime, subtype, ind
|
|
}
|
|
}
|
|
|
|
|
|
if list != nil {
|
|
if list != nil {
|
|
- bidListConvert("", list)
|
|
|
|
|
|
+ jyutil.BidListConvert("", list)
|
|
for _, v := range *list {
|
|
for _, v := range *list {
|
|
v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
}
|
|
}
|
|
@@ -2126,53 +2158,3 @@ func (m *Front) Subscribe() error {
|
|
m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
|
|
m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
|
|
return m.Render("/pc/subscribe.html", &m.T)
|
|
return m.Render("/pc/subscribe.html", &m.T)
|
|
}
|
|
}
|
|
-
|
|
|
|
-/*
|
|
|
|
- * 结果列表转换,目前只换行行业字段
|
|
|
|
- * 所有的招标搜索都要调用此方法,列表中有展示行业的也可以用
|
|
|
|
- * industry 搜索条件中的行业,默认为空
|
|
|
|
- */
|
|
|
|
-func bidListConvert(industry string, list *[]map[string]interface{}) {
|
|
|
|
- if list == nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- commonSubstring := func(v string) (value string) {
|
|
|
|
- bcs := strings.Split(v, "_")
|
|
|
|
- if len(bcs) == 1 {
|
|
|
|
- value = bcs[0]
|
|
|
|
- } else if len(bcs) == 2 {
|
|
|
|
- value = bcs[1]
|
|
|
|
- if strings.TrimSpace(value) == "" {
|
|
|
|
- value = bcs[0]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- for _, v := range *list {
|
|
|
|
- value := ""
|
|
|
|
- biddingcontent, _ := v["biddingcontent"].([]interface{})
|
|
|
|
- bct := util.ObjArrToStringArr(biddingcontent)
|
|
|
|
- if bct == nil || len(bct) == 0 {
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
- //搜索条件中没有行业的话,取查询结果中第一个行业
|
|
|
|
- if industry == "" {
|
|
|
|
- value = commonSubstring(bct[0])
|
|
|
|
- } else { //搜索条件中有行业的话,取行业中和搜索条件相对应的第一个
|
|
|
|
- industrys := strings.Split(industry, ",")
|
|
|
|
- L:
|
|
|
|
- for _, bc := range bct {
|
|
|
|
- for _, is := range industrys {
|
|
|
|
- if bc == is {
|
|
|
|
- value = commonSubstring(bc)
|
|
|
|
- break L
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if strings.TrimSpace(value) == "" {
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
- v["industry"] = value
|
|
|
|
- }
|
|
|
|
-}
|
|
|