Преглед изворни кода

Merge remote-tracking branch 'origin/feature/v1.1.10' into feature/v1.1.10

WH01243 пре 2 година
родитељ
комит
446bfff879
1 измењених фајлова са 22 додато и 5 уклоњено
  1. 22 5
      jyBXCore/rpc/entity/search.go

+ 22 - 5
jyBXCore/rpc/entity/search.go

@@ -6,10 +6,12 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/zeromicro/go-zero/core/logx"
+	"jyBXCore/entity"
 	"jyBXCore/rpc/bxcore"
 	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/service"
 	"jyBXCore/rpc/util"
+	"strconv"
 	"strings"
 	"time"
 )
@@ -156,15 +158,30 @@ func (kws *KeyWordsSearch) GetSearchKeyWordsQueryStr(in *bxcore.SearchReq) (sear
 
 // SearchParamsHandle 搜索条件 处理
 func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
+	baseUserId, _ := strconv.ParseInt(in.NewUserId, 10, 64)
+	accountId, _ := strconv.ParseInt(in.AccountId, 10, 64)
+	positionType, _ := strconv.ParseInt(in.PositionType, 10, 64)
+	positionId, _ := strconv.ParseInt(in.PositionId, 10, 64)
+	userInfoRpc := entity.UserInfoRpc{
+		AppId:        in.AppId,
+		UserId:       in.UserId,
+		BaseUserId:   baseUserId,
+		EntId:        in.EntId,
+		EntUserId:    in.EntUserId,
+		AccountId:    accountId,
+		PositionType: positionType,
+		PositionId:   positionId,
+		MgoUserId:    in.MgoUserId,
+	}
 	//判断用户身份
-	userInfo := util.GetVipState(IC.MainMysql, IC.Mgo, in.UserId, in.EntId)
+	userInfo := userInfoRpc.GetUserPowers()
 	//是否是付费用户
-	in.IsPay = userInfo.IsPayedUser()
+	in.IsPay = !userInfo.Free.IsFree
 	//默认搜索范围
 	if in.SelectType == "" {
 		in.SelectType = "title,content"
 	}
-	queryItems := userInfo.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit)
+	queryItems := userInfoRpc.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit, userInfo.Free.Registedate, in.IsPay)
 	in.SelectType = strings.Join(queryItems, ",")
 	// in.SearchGroup 搜索分组 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
 	//	详情页判断是否能使用超前项目  老版超级订阅、大会员、商机管理有权限
@@ -192,7 +209,7 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
 	if in.PublishTime == "" {
 		//付费用户最新5年;免费用户||未登录用户最新1年
 		in.PublishTime = fmt.Sprintf("%d-%d", time.Now().AddDate(-1, 0, 0).Unix(), time.Now().Unix())
-		if userInfo.IsPayedUser() {
+		if in.IsPay {
 			in.PublishTime = fmt.Sprintf("%d-%d", time.Now().AddDate(-5, 0, 0).Unix(), time.Now().Unix())
 		}
 	}
@@ -209,7 +226,7 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) []string {
 		in.Industry = strings.TrimSpace(in.Industry)
 	}
 	//免费用户:高级筛选 采购单位类型、采购单位联系方式、中标企业联系方式、排除词、城市
-	if !userInfo.IsPayedUser() {
+	if userInfo.Free.IsFree {
 		in.BuyerClass = ""
 		in.BuyerTel = ""
 		in.WinnerTel = ""