瀏覽代碼

feat:采购范围

wangshan 2 年之前
父節點
當前提交
b2755132e2
共有 2 個文件被更改,包括 15 次插入10 次删除
  1. 7 6
      jyBXCore/rpc/entity/search.go
  2. 8 4
      jyBXCore/rpc/util/userInfo.go

+ 7 - 6
jyBXCore/rpc/entity/search.go

@@ -10,6 +10,7 @@ import (
 	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/service"
 	"jyBXCore/rpc/util"
+	"log"
 	"strings"
 	"time"
 )
@@ -124,7 +125,10 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) {
 	userInfo := util.GetVipState(IC.MainMysql, IC.Mgo, in.UserId, in.EntId)
 	//是否是付费用户
 	in.IsPay = userInfo.IsPayedUser()
-	//搜索范围
+	//默认搜索范围
+	if in.SelectType == "" {
+		in.SelectType = "title,content"
+	}
 	queryItems := userInfo.GetQueryItems(in.SelectType, IC.C.BidSearchOldUserLimit)
 	in.SelectType = strings.Join(queryItems, ",")
 	// in.SearchGroup 搜索分组 搜索分组:默认0:全部;1:招标采购公告;2:超前项目
@@ -147,8 +151,9 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) {
 		}
 	}
 	//信息类型参数为空  根据搜索分组 初始化信息类型
+	log.Println(in.SearchGroup, "---:", IC.C.DefaultTopTypes[in.SearchGroup-1])
 	if in.TopType == "" && in.Subtype == "" {
-		in.Subtype = MC.If(in.SearchGroup > 0, IC.C.DefaultTopTypes[in.SearchGroup-1], "").(string)
+		in.Subtype = MC.If(in.SearchGroup > 0 && len(IC.C.DefaultTopTypes) > int(in.SearchGroup), IC.C.DefaultTopTypes[in.SearchGroup-1], "").(string)
 	}
 	// in.SearchMode 搜索模式 搜索模式:0:精准搜索;1:模糊搜索
 	// 精准搜索:不分词,完全匹配;(中间带空格的关键词组自动分词)
@@ -180,10 +185,6 @@ func (kws *KeyWordsSearch) SearchParamsHandle(in *bxcore.SearchReq) {
 	if in.Industry != "" {
 		in.Industry = strings.TrimSpace(in.Industry)
 	}
-	//默认搜索范围
-	if in.SelectType == "" {
-		in.SelectType = "title,content"
-	}
 	//免费用户:高级筛选 采购单位类型、采购单位联系方式、中标企业联系方式、排除词、城市
 	if !userInfo.IsPayedUser() {
 		in.BuyerClass = ""

+ 8 - 4
jyBXCore/rpc/util/userInfo.go

@@ -46,10 +46,14 @@ func GetVipState(mysql *mysql.Mysql, mg mongodb.MongodbSim, userId string, entId
 			phone = sMPhone
 		}
 		if phone != "" && entId > 0 {
-			if entInfos := mysql.SelectBySql(`select * from entniche_info where phone = ? and power =1 and status = 1 and id = ?`, phone, entId); entInfos != nil && *entInfos != nil && len(*entInfos) > 0 {
-				entInfo := (*entInfos)[0]
-				vs.EntMember = 1
-				vs.IsNewEnt = MC.Int64All(entInfo["isNew"]) > 0
+			entNicheInfos := mysql.SelectBySql(`SELECT i.status,i.isNew,r.role_id,u.power FROM (entniche_user u LEFT JOIN entniche_user_role r ON r.user_id = u.id)  LEFT JOIN entniche_info i ON u.ent_id=i.id WHERE u.phone = ? and i.id = ? `, phone, entId)
+			//商机管理用户信息判断
+			if entNicheInfos != nil && len(*entNicheInfos) > 0 {
+				entNicheInfo := (*entNicheInfos)[0]
+				if MC.IntAll(entNicheInfo["status"]) > 0 && (MC.IntAll(entNicheInfo["power"]) == 1 || MC.IntAll(entNicheInfo["role_id"]) > 0) {
+					vs.EntMember = 1
+				}
+				vs.IsNewEnt = MC.Int64All(entNicheInfo["isNew"]) > 0
 			}
 		}
 		vs.RegisterData, _ = ((*data)["l_registedate"]).(int64)