|
@@ -15,8 +15,8 @@ import (
|
|
|
)
|
|
|
|
|
|
var (
|
|
|
- SearchCacheKey = "searchDataCache_%s_%s"
|
|
|
- SearchCacheCount = "searchCountCache_%s_%s"
|
|
|
+ SearchCacheKey = "searchDataCache_%d_%s"
|
|
|
+ SearchCacheCount = "searchCountCache_%d_%s"
|
|
|
)
|
|
|
|
|
|
type KeyWordsSearch struct{}
|
|
@@ -28,9 +28,10 @@ func NewKeyWordsSearch() *KeyWordsSearch {
|
|
|
// IsEmptySearch 是否是空搜索,如果是空搜索查缓存数据
|
|
|
func (kws *KeyWordsSearch) IsEmptySearch(in *bxcore.SearchReq) bool {
|
|
|
//有主关键词 或 选择了行业,都不是空搜索
|
|
|
- if in.KeyWords != "" || in.Industry != "" || in.AdditionalWords != "" {
|
|
|
+ if strings.TrimSpace(in.KeyWords) != "" || strings.TrimSpace(in.Industry) != "" || strings.TrimSpace(in.AdditionalWords) != "" {
|
|
|
return false
|
|
|
}
|
|
|
+ //所有的未登录空搜索 缓存都最多查500条数据
|
|
|
return true
|
|
|
}
|
|
|
|
|
@@ -39,10 +40,10 @@ func (kws *KeyWordsSearch) IsEmptySearch(in *bxcore.SearchReq) bool {
|
|
|
func (kws *KeyWordsSearch) GetBidSearchListByCache(in *bxcore.SearchReq) (list []*bxcore.SearchList, count int64) {
|
|
|
//缓存数据 最大量是5000条 100页数据
|
|
|
l, c := func(in *bxcore.SearchReq) (list []*bxcore.SearchList, count int64) {
|
|
|
- //缓存数据: kws.Platform-平台;kws.PageNum-当前页 免费用户 or 付费用户
|
|
|
- redisDataKey := fmt.Sprintf(SearchCacheKey, in.Platform, MC.If(in.IsPay, "V", "F").(string))
|
|
|
+ //缓存数据: SearchGroup-全部;招标信息;超前项目信息;kws.PageNum-当前页 免费用户 or 付费用户
|
|
|
+ redisDataKey := fmt.Sprintf(SearchCacheKey, in.SearchGroup, MC.If(in.IsPay, "V", "F").(string))
|
|
|
//缓存数据总量 - 当前平台
|
|
|
- redisCountKey := fmt.Sprintf(SearchCacheCount, in.Platform, MC.If(in.IsPay, "V", "F").(string))
|
|
|
+ redisCountKey := fmt.Sprintf(SearchCacheCount, in.SearchGroup, MC.If(in.IsPay, "V", "F").(string))
|
|
|
sCache, err := redis.GetNewBytes(util.RedisNameNew, redisDataKey)
|
|
|
count = int64(redis.GetInt(util.RedisNameNew, redisCountKey))
|
|
|
if err == nil {
|
|
@@ -87,10 +88,6 @@ func (kws *KeyWordsSearch) GetBidSearchListByCache(in *bxcore.SearchReq) (list [
|
|
|
|
|
|
// DefaultSearchParamsAuto 缓存查询条件初始化
|
|
|
func (kws *KeyWordsSearch) DefaultSearchParamsAuto(in *bxcore.SearchReq) {
|
|
|
- //缓存数据 默认查询分组 searchGroup = 1 ,
|
|
|
- //不查超前信息--招标信息类型为拟建和采购意向的信息
|
|
|
- in.SearchGroup = 1
|
|
|
- in.Subtype = IC.C.DefaultTopTypes[in.SearchGroup-1]
|
|
|
in.TopType = ""
|
|
|
in.City = ""
|
|
|
in.Industry = ""
|
|
@@ -101,7 +98,6 @@ func (kws *KeyWordsSearch) DefaultSearchParamsAuto(in *bxcore.SearchReq) {
|
|
|
in.Price = ""
|
|
|
in.SelectType = "title"
|
|
|
in.Province = ""
|
|
|
- //in.PublishTime = ""
|
|
|
}
|
|
|
|
|
|
// SaveKeyWordsToHistory 保存历史记录
|
|
@@ -168,27 +164,13 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
|
|
|
queryItems := userInfo.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit)
|
|
|
in.SelectType = strings.Join(queryItems, ",")
|
|
|
// in.SearchGroup 搜索分组 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
|
|
|
+ // 详情页判断是否能使用超前项目 老版超级订阅、大会员、商机管理有权限
|
|
|
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)
|
|
|
- }
|
|
|
- }
|
|
|
- //信息类型参数为空 根据搜索分组 初始化信息类型
|
|
|
- //in.SearchGroup = 0
|
|
|
- if in.TopType == "" && in.Subtype == "" {
|
|
|
+ //信息类型
|
|
|
+ if in.Subtype == "" && in.TopType == "" {
|
|
|
+ //(免费用户和新版超级订阅用户 有搜索权限,但是没有查看权限)
|
|
|
if in.SearchGroup > 0 && len(IC.C.DefaultTopTypes) >= int(in.SearchGroup) {
|
|
|
in.Subtype = IC.C.DefaultTopTypes[in.SearchGroup-1]
|
|
|
}
|