|
@@ -11,6 +11,7 @@ import (
|
|
|
"jyBXCore/rpc/service"
|
|
|
"jyBXCore/rpc/util"
|
|
|
"strings"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
var (
|
|
@@ -89,7 +90,7 @@ func (kws *KeyWordsSearch) DefaultSearchParamsAuto(in *bxcore.SearchReq) {
|
|
|
//缓存数据 默认查询分组 searchGroup = 1 ,
|
|
|
//不查超前信息--招标信息类型为拟建和采购意向的信息
|
|
|
in.SearchGroup = 1
|
|
|
- in.Subtype = IC.C.DefaultTopTypes[in.SearchGroup]
|
|
|
+ in.Subtype = IC.C.DefaultTopTypes[in.SearchGroup-1]
|
|
|
in.TopType = ""
|
|
|
in.City = ""
|
|
|
in.Industry = ""
|
|
@@ -99,8 +100,8 @@ func (kws *KeyWordsSearch) DefaultSearchParamsAuto(in *bxcore.SearchReq) {
|
|
|
in.BuyerClass = ""
|
|
|
in.Price = ""
|
|
|
in.SelectType = "title"
|
|
|
- in.PublishTime = ""
|
|
|
in.Province = ""
|
|
|
+ //in.PublishTime = ""
|
|
|
}
|
|
|
|
|
|
// SaveKeyWordsToHistory 保存历史记录
|
|
@@ -119,24 +120,54 @@ func (kws *KeyWordsSearch) SaveKeyWordsToHistory(in *bxcore.SearchReq) {
|
|
|
|
|
|
// SearchParamsHandle 搜索条件 处理
|
|
|
func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) {
|
|
|
+ //判断用户身份
|
|
|
+ userInfo := util.GetVipState(IC.MainMysql, IC.Mgo, in.UserId, in.EntId)
|
|
|
+ //是否是付费用户
|
|
|
+ in.IsPay = userInfo.IsPayedUser()
|
|
|
+ //搜索范围
|
|
|
+ queryItems := userInfo.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit)
|
|
|
+ in.SelectType = strings.Join(queryItems, ",")
|
|
|
// in.SearchGroup 搜索分组 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
|
|
|
- if in.SearchGroup < 0 {
|
|
|
- in.SearchGroup = 0
|
|
|
+ if in.SearchGroup < 0 || in.SearchGroup > 2 {
|
|
|
+ in.SearchGroup = 1
|
|
|
+ }
|
|
|
+ //判断是否能使用超前项目 老版超级订阅、大会员、商机管理有权限
|
|
|
+ if !(userInfo.IsOldVip || userInfo.BigMember > 0 || userInfo.EntMember > 0) {
|
|
|
+ in.SearchGroup = 1
|
|
|
+ //Subtype 包含:拟建,采购意向,则需要排除
|
|
|
+ if in.Subtype != "" {
|
|
|
+ var subtype []string
|
|
|
+ for _, sv := range strings.Split(in.Subtype, ",") {
|
|
|
+ if sv == "拟建" || sv == "采购意向" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ subtype = append(subtype, sv)
|
|
|
+ }
|
|
|
+ in.Subtype = MC.If(len(subtype) > 0, strings.Join(subtype, ","), "").(string)
|
|
|
+ }
|
|
|
}
|
|
|
//信息类型参数为空 根据搜索分组 初始化信息类型
|
|
|
if in.TopType == "" && in.Subtype == "" {
|
|
|
- in.Subtype = MC.If(in.SearchGroup > 0, IC.C.DefaultTopTypes[in.SearchGroup], "").(string)
|
|
|
+ in.Subtype = MC.If(in.SearchGroup > 0, IC.C.DefaultTopTypes[in.SearchGroup-1], "").(string)
|
|
|
}
|
|
|
// in.SearchMode 搜索模式 搜索模式:0:精准搜索;1:模糊搜索
|
|
|
// 精准搜索:不分词,完全匹配;(中间带空格的关键词组自动分词)
|
|
|
// 模糊搜索:对用户输入的单个关键词进行分词处理,但必须都存在;
|
|
|
- if in.SearchMode < 0 {
|
|
|
+ if in.SearchMode < 0 || in.SearchMode > 1 {
|
|
|
in.SearchMode = 0
|
|
|
}
|
|
|
// in.WordsMode 搜索关键词模式;默认0:包含所有,1:包含任意
|
|
|
- if in.WordsMode < 0 {
|
|
|
+ if in.WordsMode < 0 || in.WordsMode > 1 {
|
|
|
in.WordsMode = 0
|
|
|
}
|
|
|
+ //查询时间publishTime
|
|
|
+ if in.PublishTime == "" {
|
|
|
+ //付费用户最新5年;免费用户最新3年
|
|
|
+ in.PublishTime = fmt.Sprintf("%d-%d", time.Now().AddDate(-3, 0, 0).Unix(), time.Now().Unix())
|
|
|
+ if userInfo.IsPayedUser() {
|
|
|
+ in.PublishTime = fmt.Sprintf("%d-%d", time.Now().AddDate(-5, 0, 0).Unix(), time.Now().Unix())
|
|
|
+ }
|
|
|
+ }
|
|
|
//默认每页数据量
|
|
|
if in.PageSize <= 0 {
|
|
|
in.PageSize = 50
|
|
@@ -154,12 +185,14 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) {
|
|
|
in.SelectType = "title,content"
|
|
|
}
|
|
|
//免费用户:高级筛选 采购单位类型、采购单位联系方式、中标企业联系方式、排除词、城市
|
|
|
- if in.UserType == "fType" {
|
|
|
+ if !userInfo.IsPayedUser() {
|
|
|
in.BuyerClass = ""
|
|
|
in.BuyerTel = ""
|
|
|
in.WinnerTel = ""
|
|
|
in.ExclusionWords = ""
|
|
|
in.City = ""
|
|
|
+ in.SearchGroup = MC.If(in.SearchGroup > 1, 0, in.SearchGroup).(int64) //搜索分组:默认0:全部;1:招标采购公告;2:超前项目
|
|
|
+ in.ExclusionWords = ""
|
|
|
}
|
|
|
//判断是否有关键词
|
|
|
if in.KeyWords != "" {
|
|
@@ -199,13 +232,6 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) {
|
|
|
}
|
|
|
in.ExclusionWords = strings.Join(exclusionWords, IC.C.JYKeyMark) //util.MatchSpace.ReplaceAllString(in.ExclusionWords, IC.C.JYKeyMark)
|
|
|
}
|
|
|
- //判断用户身份
|
|
|
- userInfo := util.GetVipState(IC.MainMysql, IC.Mgo, in.UserId)
|
|
|
- //是否是付费用户
|
|
|
- in.IsPay = userInfo.IsPayedUser()
|
|
|
- //搜索范围
|
|
|
- queryItems := userInfo.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit)
|
|
|
- in.SelectType = strings.Join(queryItems, ",")
|
|
|
}
|
|
|
|
|
|
// GetBidSearchList 非空搜索 查询
|