|
@@ -120,10 +120,19 @@ func (m *Front) PcAjaxReq() {
|
|
var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
|
|
var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
|
|
var buyerclass string = "" //采购单位类别
|
|
var buyerclass string = "" //采购单位类别
|
|
|
|
|
|
- if jy.GetVipState(public.Mysql, public.MQFW, userId).IsPayedUser() {
|
|
|
|
|
|
+ vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
|
|
|
|
+ isPayedUser := vipStatus.IsPayedUser()
|
|
|
|
+ queryItems := vipStatus.GetQueryItems(selectType, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]))
|
|
|
|
+ if isPayedUser {
|
|
buyerclass = m.GetString("buyerclass")
|
|
buyerclass = m.GetString("buyerclass")
|
|
hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
|
|
hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
|
|
|
|
+ } else {
|
|
|
|
+ //时间自定义选择默认是vip 大会员 等权限
|
|
|
|
+ if len(strings.Split(publishtime, "_")) == 2 {
|
|
|
|
+ publishtime = ""
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
m.SetSession("selectType", selectType)
|
|
m.SetSession("selectType", selectType)
|
|
//只有前20条 有全字段,
|
|
//只有前20条 有全字段,
|
|
if subtype != "拟建" && currentPage != 1 {
|
|
if subtype != "拟建" && currentPage != 1 {
|
|
@@ -134,10 +143,9 @@ func (m *Front) PcAjaxReq() {
|
|
field = bidSearch_field
|
|
field = bidSearch_field
|
|
}
|
|
}
|
|
|
|
|
|
- if selectType == "" {
|
|
|
|
- selectType = "all"
|
|
|
|
- }
|
|
|
|
- b_word, a_word, s_word := jy.InterceptSearchKW(m.GetString("searchvalue"), selectType == "all", len(industry) == 0)
|
|
|
|
|
|
+ searchLimit := public.IsSearchLimit(queryItems)
|
|
|
|
+
|
|
|
|
+ b_word, a_word, s_word := jy.InterceptSearchKW(m.GetString("searchvalue"), searchLimit, len(industry) == 0)
|
|
var list *[]map[string]interface{}
|
|
var list *[]map[string]interface{}
|
|
var secondList []map[string]interface{}
|
|
var secondList []map[string]interface{}
|
|
var count, totalPage int64
|
|
var count, totalPage int64
|
|
@@ -150,13 +158,13 @@ func (m *Front) PcAjaxReq() {
|
|
if len(s_word) > 0 || len(industry) > 0 {
|
|
if len(s_word) > 0 || len(industry) > 0 {
|
|
if reqType == "filter" {
|
|
if reqType == "filter" {
|
|
if status == 1 {
|
|
if status == 1 {
|
|
- count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, bidsearch.SearchPageSize_PC, true, selectType, field)
|
|
|
|
|
|
+ count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, bidsearch.SearchPageSize_PC, true, queryItems, field)
|
|
}
|
|
}
|
|
} else if reqType == "bidSearch" {
|
|
} else if reqType == "bidSearch" {
|
|
//全文检索限制
|
|
//全文检索限制
|
|
- if selectType == "all" {
|
|
|
|
|
|
+ if searchLimit {
|
|
limitFlag = public.Lst.Flag
|
|
limitFlag = public.Lst.Flag
|
|
- isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session())
|
|
|
|
|
|
+ isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session(), isPayedUser)
|
|
if isLimit == 1 { //没有被限制
|
|
if isLimit == 1 { //没有被限制
|
|
defer public.Lst.Limit()
|
|
defer public.Lst.Limit()
|
|
}
|
|
}
|
|
@@ -165,7 +173,7 @@ func (m *Front) PcAjaxReq() {
|
|
if limitFlag {
|
|
if limitFlag {
|
|
if start == 0 {
|
|
if start == 0 {
|
|
limit_count := public.Lst.TotalPage * bidsearch.SearchPageSize_PC
|
|
limit_count := public.Lst.TotalPage * bidsearch.SearchPageSize_PC
|
|
- count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, limit_count, true, selectType, field)
|
|
|
|
|
|
+ count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, 0, limit_count, true, queryItems, field)
|
|
if totalPage > int64(public.Lst.TotalPage) {
|
|
if totalPage > int64(public.Lst.TotalPage) {
|
|
totalPage = int64(public.Lst.TotalPage)
|
|
totalPage = int64(public.Lst.TotalPage)
|
|
}
|
|
}
|
|
@@ -174,31 +182,40 @@ func (m *Front) PcAjaxReq() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, start, bidsearch.SearchPageSize_PC, true, selectType, field)
|
|
|
|
|
|
+ count, totalPage, list = bidsearch.GetPcBidSearchData(s_word, area, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, start, bidsearch.SearchPageSize_PC, true, queryItems, field)
|
|
}
|
|
}
|
|
listSize := 0
|
|
listSize := 0
|
|
if list != nil {
|
|
if list != nil {
|
|
listSize = len(*list)
|
|
listSize = len(*list)
|
|
}
|
|
}
|
|
if len([]rune(s_word)) > 3 && int(count) < bidsearch.SearchPageSize_PC && start == 0 {
|
|
if len([]rune(s_word)) > 3 && int(count) < bidsearch.SearchPageSize_PC && start == 0 {
|
|
- secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
|
|
|
|
- findfields := `"title"`
|
|
|
|
- qstr := bidsearch.GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, bidsearch.GetBidSearchQuery(area, publishtime, subtype, "", buyerclass))
|
|
|
|
- secRel := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, 0, 2*bidsearch.SearchPageSize_PC, 0, false)
|
|
|
|
- if secRel != nil {
|
|
|
|
- public.BidListConvert(industry, secRel)
|
|
|
|
- }
|
|
|
|
- if list != nil {
|
|
|
|
- list = public.MapArrSortMerge(*list, *secRel, "_id", "publishtime")
|
|
|
|
- } else {
|
|
|
|
- list = secRel
|
|
|
|
|
|
+ secondSearch := false
|
|
|
|
+ for _, item := range queryItems {
|
|
|
|
+ if item == "title" {
|
|
|
|
+ secondSearch = true
|
|
|
|
+ break
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if len(*secRel) > 0 {
|
|
|
|
- if secondKWS != "" {
|
|
|
|
- s_word += "+" + secondKWS
|
|
|
|
|
|
+ if secondSearch {
|
|
|
|
+ secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
|
|
|
|
+ findfields := `"title"`
|
|
|
|
+ qstr := bidsearch.GetSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, bidsearch.GetBidSearchQuery(area, publishtime, subtype, "", buyerclass))
|
|
|
|
+ secRel := elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, bidSearch_field, 0, 2*bidsearch.SearchPageSize_PC, 0, false)
|
|
|
|
+ if secRel != nil {
|
|
|
|
+ public.BidListConvert(industry, secRel)
|
|
|
|
+ }
|
|
|
|
+ if list != nil {
|
|
|
|
+ list = public.MapArrSortMerge(*list, *secRel, "_id", "publishtime")
|
|
|
|
+ } else {
|
|
|
|
+ list = secRel
|
|
|
|
+ }
|
|
|
|
+ if len(*secRel) > 0 {
|
|
|
|
+ if secondKWS != "" {
|
|
|
|
+ s_word += "+" + secondKWS
|
|
|
|
+ }
|
|
|
|
+ secondFlag = "T"
|
|
|
|
+ pcAjaxFlag = "T"
|
|
}
|
|
}
|
|
- secondFlag = "T"
|
|
|
|
- pcAjaxFlag = "T"
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public.SaveUserSearchLog(m.Request, util.ObjToString(m.GetSession("userId")), -1, "pc", "超级搜索", map[string]interface{}{
|
|
public.SaveUserSearchLog(m.Request, util.ObjToString(m.GetSession("userId")), -1, "pc", "超级搜索", map[string]interface{}{
|
|
@@ -438,15 +455,24 @@ func (m *Front) WxsearchlistPaging() {
|
|
var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
|
|
var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
|
|
var buyerclass string = "" //采购单位类别
|
|
var buyerclass string = "" //采购单位类别
|
|
|
|
|
|
- if jy.GetVipState(public.Mysql, public.MQFW, userId).IsPayedUser() { //超级订阅、大会员、商机管理
|
|
|
|
|
|
+ vipStatus := jy.GetVipState(public.Mysql, public.MQFW, userId)
|
|
|
|
+ isPayedUser := vipStatus.IsPayedUser()
|
|
|
|
+ queryItems := vipStatus.GetQueryItems(selectType, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]))
|
|
|
|
+ if isPayedUser {
|
|
buyerclass = m.GetString("buyerclass")
|
|
buyerclass = m.GetString("buyerclass")
|
|
hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
|
|
hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
|
|
|
|
+ } else {
|
|
|
|
+ //时间自定义选择默认是vip 大会员 等权限
|
|
|
|
+ if len(strings.Split(publishtime, "_")) == 2 {
|
|
|
|
+ publishtime = ""
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//全文检索限制
|
|
//全文检索限制
|
|
- if selectType == "all" {
|
|
|
|
|
|
+ searchLimit := public.IsSearchLimit(queryItems)
|
|
|
|
+ if searchLimit {
|
|
limitFlag = public.Lst.Flag
|
|
limitFlag = public.Lst.Flag
|
|
- isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session())
|
|
|
|
|
|
+ isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session(), isPayedUser)
|
|
if isLimit == 1 { //没有被限制
|
|
if isLimit == 1 { //没有被限制
|
|
defer public.Lst.Limit()
|
|
defer public.Lst.Limit()
|
|
}
|
|
}
|
|
@@ -455,40 +481,49 @@ func (m *Front) WxsearchlistPaging() {
|
|
s_word := ""
|
|
s_word := ""
|
|
if limitFlag {
|
|
if limitFlag {
|
|
if pageNum == 1 {
|
|
if pageNum == 1 {
|
|
- list, b_word, a_word, s_word = bidsearch.GetWxsearchlistData(searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, pageNum, public.Lst.TotalPage*bidsearch.SearchPageSize_WX, selectType, filed)
|
|
|
|
|
|
+ list, b_word, a_word, s_word = bidsearch.GetWxsearchlistData(searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, pageNum, public.Lst.TotalPage*bidsearch.SearchPageSize_WX, queryItems, filed)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- list, b_word, a_word, s_word = bidsearch.GetWxsearchlistData(searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, pageNum, bidsearch.SearchPageSize_WX, selectType, filed)
|
|
|
|
|
|
+ list, b_word, a_word, s_word = bidsearch.GetWxsearchlistData(searchvalue, scope, publishtime, subtype, industry, minprice, maxprice, "", buyerclass, hasBuyerTel, hasWinnerTel, pageNum, bidsearch.SearchPageSize_WX, queryItems, filed)
|
|
}
|
|
}
|
|
listSize := 0
|
|
listSize := 0
|
|
if list != nil {
|
|
if list != nil {
|
|
listSize = len(*list)
|
|
listSize = len(*list)
|
|
}
|
|
}
|
|
if len([]rune(s_word)) > 3 && listSize < bidsearch.SearchPageSize_WX && pageNum == 1 {
|
|
if len([]rune(s_word)) > 3 && listSize < bidsearch.SearchPageSize_WX && pageNum == 1 {
|
|
- secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
|
|
|
|
- findfields := `"title"`
|
|
|
|
- qstr := getSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, bidsearch.GetBidSearchQuery(scope, publishtime, subtype, "", buyerclass))
|
|
|
|
- secRel = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, filed, 0, 2*bidsearch.SearchPageSize_WX, 0, false)
|
|
|
|
- if secRel != nil && len(*secRel) > 0 {
|
|
|
|
- public.BidListConvert(industry, secRel)
|
|
|
|
- for _, v := range *secRel {
|
|
|
|
- v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
|
|
|
|
+ secondSearch := false
|
|
|
|
+ for _, item := range queryItems {
|
|
|
|
+ if item == "title" {
|
|
|
|
+ secondSearch = true
|
|
|
|
+ break
|
|
}
|
|
}
|
|
- if list != nil {
|
|
|
|
- list = public.MapArrSortMerge(*list, *secRel, "_id", "publishtime")
|
|
|
|
- } else {
|
|
|
|
- list = secRel
|
|
|
|
- }
|
|
|
|
- secondFlag = "T"
|
|
|
|
- if len(*list) > bidsearch.SearchPageSize_WX && selectType == "title" {
|
|
|
|
- secondList = (*list)[bidsearch.SearchPageSize_WX:]
|
|
|
|
- if len(secondList) > bidsearch.SearchPageSize_WX {
|
|
|
|
- secondList = secondList[:bidsearch.SearchPageSize_WX]
|
|
|
|
|
|
+ }
|
|
|
|
+ if secondSearch {
|
|
|
|
+ secondKWS = jy.HttpEs(s_word, "ik_smart", public.DbConf.Elasticsearch.Main.Address)
|
|
|
|
+ findfields := `"title"`
|
|
|
|
+ qstr := getSearchQuery(secondKWS, industry, minprice, maxprice, hasBuyerTel, hasWinnerTel, findfields, bidsearch.GetBidSearchQuery(scope, publishtime, subtype, "", buyerclass))
|
|
|
|
+ secRel = elastic.GetAllByNgram(INDEX, TYPE, qstr, findfields, bidSearch_sort, filed, 0, 2*bidsearch.SearchPageSize_WX, 0, false)
|
|
|
|
+ if secRel != nil && len(*secRel) > 0 {
|
|
|
|
+ public.BidListConvert(industry, secRel)
|
|
|
|
+ for _, v := range *secRel {
|
|
|
|
+ v["_id"] = util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"]))
|
|
|
|
+ }
|
|
|
|
+ if list != nil {
|
|
|
|
+ list = public.MapArrSortMerge(*list, *secRel, "_id", "publishtime")
|
|
|
|
+ } else {
|
|
|
|
+ list = secRel
|
|
}
|
|
}
|
|
- *list = (*list)[:bidsearch.SearchPageSize_WX]
|
|
|
|
|
|
+ secondFlag = "T"
|
|
|
|
+ if len(*list) > bidsearch.SearchPageSize_WX && selectType == "title" {
|
|
|
|
+ secondList = (*list)[bidsearch.SearchPageSize_WX:]
|
|
|
|
+ if len(secondList) > bidsearch.SearchPageSize_WX {
|
|
|
|
+ secondList = secondList[:bidsearch.SearchPageSize_WX]
|
|
|
|
+ }
|
|
|
|
+ *list = (*list)[:bidsearch.SearchPageSize_WX]
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ secondKWS = ""
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- secondKWS = ""
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public.SaveUserSearchLog(m.Request, util.ObjToString(m.GetSession("userId")), -1, "wx", "超级搜索", map[string]interface{}{
|
|
public.SaveUserSearchLog(m.Request, util.ObjToString(m.GetSession("userId")), -1, "wx", "超级搜索", map[string]interface{}{
|
|
@@ -1969,6 +2004,7 @@ func (f *Front) HasPushHistory() {
|
|
Subtype: f.GetString("subtype"),
|
|
Subtype: f.GetString("subtype"),
|
|
Subscopeclass: f.GetString("subscopeclass"),
|
|
Subscopeclass: f.GetString("subscopeclass"),
|
|
Key: f.GetString("key"),
|
|
Key: f.GetString("key"),
|
|
|
|
+ City: f.GetString("city"),
|
|
}
|
|
}
|
|
hasNextPage, list := jy.SubscribePush.Datas(spqp)
|
|
hasNextPage, list := jy.SubscribePush.Datas(spqp)
|
|
if hasKeyFlag && len(list) == 0 && spqp.IsEmpty() && !isVipFlag {
|
|
if hasKeyFlag && len(list) == 0 && spqp.IsEmpty() && !isVipFlag {
|
|
@@ -2095,6 +2131,7 @@ func (f *Front) HistorypushPaging() error {
|
|
Subtype: f.GetString("subtype"),
|
|
Subtype: f.GetString("subtype"),
|
|
Subscopeclass: f.GetString("subscopeclass"),
|
|
Subscopeclass: f.GetString("subscopeclass"),
|
|
Key: f.GetString("key"),
|
|
Key: f.GetString("key"),
|
|
|
|
+ City: f.GetString("city"),
|
|
})
|
|
})
|
|
jy.SubscribePush.MakeCollection(userId, public.Mysql, list)
|
|
jy.SubscribePush.MakeCollection(userId, public.Mysql, list)
|
|
// hasNextPage, list, _ := public.HistoryPush.Datas(userId, pageNum, firstPushTime, formatTime)
|
|
// hasNextPage, list, _ := public.HistoryPush.Datas(userId, pageNum, firstPushTime, formatTime)
|