WH01243 2 жил өмнө
parent
commit
c891de19a2

+ 1 - 1
jyBXCore/api/bxcore.api

@@ -166,7 +166,7 @@ type (
 		EndTime      int64    `json:"endTime,optional"`
 	}
 	polymerizeSearchReq {
-		SearchCode   string `json:"searchCode,optional"`
+		SearchCode   string `json:"searchCode"`
 		EntId        int64  `header:"entId,optional"`        // 企业id
 		PositionType int64  `header:"positionType,optional"` // 职位类型 0个人 1企业
 		PositionId   int64  `header:"positionId,optional"`   //职位id

+ 28 - 0
jyBXCore/api/internal/handler/polymerizeSearchHandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+	"jyBXCore/api/internal/logic"
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+)
+
+func polymerizeSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.PolymerizeSearchReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := logic.NewPolymerizeSearchLogic(r.Context(), svcCtx)
+		resp, err := l.PolymerizeSearch(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 47 - 0
jyBXCore/api/internal/logic/polymerizeSearchLogic.go

@@ -0,0 +1,47 @@
+package logic
+
+import (
+	"context"
+	"jyBXCore/rpc/type/bxcore"
+
+	"jyBXCore/api/internal/svc"
+	"jyBXCore/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type PolymerizeSearchLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewPolymerizeSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PolymerizeSearchLogic {
+	return &PolymerizeSearchLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *PolymerizeSearchLogic) PolymerizeSearch(req *types.PolymerizeSearchReq) (resp *types.CommonResp, err error) {
+	// todo: add your logic here and delete this line
+	res, err := l.svcCtx.BxCore.PolymerizeSearch(l.ctx, &bxcore.PolymerizeSearchReq{
+		EntId:        req.EntId,
+		PositionId:   req.PositionId,
+		AccountId:    req.AccountId,
+		AppId:        req.AppId,
+		SearchCode:   req.SearchCode,
+		PositionType: req.PositionType,
+		UserId:       req.UserId,
+		NewUserId:    req.NewUserId,
+		EntAccountId: req.EntAccountId,
+		EntUserId:    req.EntUserId,
+	})
+	if err != nil {
+		return nil, err
+	}
+	return &types.CommonResp{
+		Data: res.Data,
+	}, nil
+}

+ 1 - 1
jyBXCore/api/internal/types/types.go

@@ -160,7 +160,7 @@ type PtatisticsListReq struct {
 }
 
 type PolymerizeSearchReq struct {
-	SearchCode   string `json:"searchCode,optional"`
+	SearchCode   string `json:"searchCode"`
 	EntId        int64  `header:"entId,optional"`        // 企业id
 	PositionType int64  `header:"positionType,optional"` // 职位类型 0个人 1企业
 	PositionId   int64  `header:"positionId,optional"`   //职位id

+ 10 - 0
jyBXCore/rpc/entity/search.go

@@ -274,16 +274,26 @@ func (kws *KeyWordsSearch) GetBidSearchList(in *bxcore.SearchReq) (count, total
 // 聚合搜索
 func (kws *KeyWordsSearch) PolymerizeSearch(in *bxcore.PolymerizeSearchReq) *bxcore.SearchReturn {
 	data := &bxcore.SearchReturn{}
+
 	powerCheck := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
 	//企业搜索
+	now1 := time.Now().Unix()
 	data.EntList = service.EntSearch(in.SearchCode)
+	now2 := time.Now().Unix()
 	//采购单位搜搜索
 	data.ProcureList = service.ProcureSearch(in.SearchCode)
+	now3 := time.Now().Unix()
+	log.Println("企业查询耗时", now2-now1)
+	log.Println("采购单位搜搜索", now3-now2)
 	if in.AccountId > 0 {
 		//菜单搜索
 		data.MenuList = service.MenuSearch(in)
 		//标讯搜索
+		now4 := time.Now().Unix()
 		data.SubscribeList = service.SubscribeSearch(in.SearchCode, powerCheck)
+		now5 := time.Now().Unix()
+		log.Println("菜单搜索", now4-now3)
+		log.Println("标讯搜索", now5-now4)
 	}
 	return data
 }

+ 1 - 1
jyBXCore/rpc/etc/bxcore.yaml

@@ -45,7 +45,7 @@ ContextOldVipLimit: 1664553600
 Middleground:
   Etcd:
     Hosts:
-      - 192.168.3.149:2379
+      - 192.168.3.206:2379
   PowerCheckCenterKey: powercheck.rpc #权益校验中台
   UserCenterKey: usercenter.rpc #用户中台rpc
   ResourceCenterKey: resource.rpc #资源中台rpc

+ 1 - 1
jyBXCore/rpc/etc/db.yaml

@@ -18,7 +18,7 @@ redis:
         - other=192.168.3.149:1712
         - newother=192.168.3.149:1712
 es:
-    addr: http://192.168.3.242:9100
+    addr: http://192.168.3.241:9205,http://192.168.3.149:9200
     size: 50
     version: v7
     userName: ""

+ 39 - 0
jyBXCore/rpc/internal/logic/polymerizesearchlogic.go

@@ -0,0 +1,39 @@
+package logic
+
+import (
+	"context"
+	"jyBXCore/rpc/entity"
+	"jyBXCore/rpc/internal/svc"
+	"jyBXCore/rpc/type/bxcore"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type PolymerizeSearchLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewPolymerizeSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PolymerizeSearchLogic {
+	return &PolymerizeSearchLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 聚合搜索
+func (l *PolymerizeSearchLogic) PolymerizeSearch(in *bxcore.PolymerizeSearchReq) (*bxcore.PolymerizeSearchResp, error) {
+	// todo: add your logic here and delete this line
+	if in.SearchCode == "" {
+		return &bxcore.PolymerizeSearchResp{}, nil
+	}
+	ks := entity.NewKeyWordsSearch()
+	data := ks.PolymerizeSearch(in)
+	return &bxcore.PolymerizeSearchResp{
+		ErrCode: 0,
+		ErrMsg:  "",
+		Data:    data,
+	}, nil
+}

+ 14 - 20
jyBXCore/rpc/service/search.go

@@ -7,7 +7,6 @@ import (
 	"bp.jydev.jianyu360.cn/BaseService/powerCheckCenter/rpc/pb"
 	userPb "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 	"fmt"
-	"jyBXCore/rpc/entity"
 	IC "jyBXCore/rpc/init"
 	"jyBXCore/rpc/model/es"
 	"jyBXCore/rpc/type/bxcore"
@@ -20,7 +19,7 @@ import (
 const (
 	entQuery     = `{"query":{"bool":{"must":[%s],"must_not":[%s]}},"_source":["_id","company_name","company_status","legal_person","capital","company_address","company_shortname","company_phone","establish_date"],"sort":[{"capital":{"order":"desc"}}]}`
 	index, itype = "qyxy", "qyxy"
-	query        = `{%s "query":{"bool":{"must":[%s],"must_not": [{"term": {"buyer_name": ""}}]}} %s}`
+	query        = `{%s "query":{"bool":{"must":[%s],"must_not": [{"term": {"buyer_name": ""}}]}}}`
 	BuyerIndex   = "buyer" // 采购单位index
 	BuyerType    = "buyer"
 )
@@ -92,7 +91,7 @@ func EntSearch(searchCode string) []*bxcore.Search {
 func ProcureSearch(searchCode string) []*bxcore.Search {
 	data := []*bxcore.Search{}
 	entNameQuery := fmt.Sprintf(`{"multi_match": {"query": "%s","type": "phrase", "fields": ["name"]}}`, searchCode)
-	qstr := fmt.Sprintf(query, fmt.Sprintf(`"from":%d,"size": %d,`, 0, 10), entNameQuery, 0)
+	qstr := fmt.Sprintf(query, fmt.Sprintf(`"from":%d,"size": %d,`, 0, 10), entNameQuery)
 	log.Println("采购单位搜索sql:", qstr)
 	rs := elastic.Get(BuyerIndex, BuyerType, qstr) // 采购单位列表
 	if rs == nil || len(*rs) == 0 {
@@ -160,29 +159,24 @@ func MenuSearch(in *bxcore.PolymerizeSearchReq) []*bxcore.MenuList {
 func SubscribeSearch(searchCode string, powerCheck *pb.CheckResp) []*bxcore.Search {
 	data := []*bxcore.Search{}
 	in := &bxcore.SearchReq{
-		PageNum:    int64(1),
-		PageSize:   int64(10),
-		IsPay:      false,
-		SelectType: "title",
-		KeyWords:   searchCode,
+		PageNum:     int64(1),
+		PageSize:    int64(10),
+		IsPay:       false,
+		SelectType:  "title",
+		KeyWords:    searchCode,
+		PublishTime: fmt.Sprintf("%v_%v", time.Now().AddDate(-1, 0, 0).Unix(), time.Now().Unix()),
 	}
-	searchLimit := util.IsSearchLimit([]string{"title"})
 	isLimit := int64(0)
-	if searchLimit {
-		isLimit = util.IsLimited(in.LimitFlag, in.UserId, powerCheck.Vip.Status > 0 || powerCheck.Member.Status > 0, in.IsNew)
-		if isLimit == 1 { //没有被限制
-			defer util.Limit()
-		}
+	isLimit = util.IsLimited(in.LimitFlag, in.UserId, powerCheck.Vip.Status > 0 || powerCheck.Member.Status > 0, in.IsNew)
+	if isLimit == 1 { //没有被限制
+		defer util.Limit()
 	}
 	list := []*bxcore.SearchList{}
 	if isLimit == 1 {
 		//付费用户搜索优化--默认搜索5年数据,数据量太多,接口反应太慢,前两页数据 时间范围根据配置缩小查询以达到快速查询的目的。
-		ks := entity.NewKeyWordsSearch()
-		if b := util.IsOptimize(IC.C, in); b {
-			t1 := time.Now()
-			_, _, list = ks.GetBidSearchList(in)
-			log.Println("1查询耗时:", time.Since(t1))
-		}
+		t1 := time.Now()
+		_, list = GetBidSearchData(in, false)
+		log.Println("1查询耗时:", time.Since(t1))
 	}
 	if list != nil && len(list) > 0 {
 		for _, value := range list {

+ 0 - 11
jyBXSubscribe/api/etc/db.yaml

@@ -1,11 +0,0 @@
-mongo:
-    main:
-        dbName: qfw
-        size: 5
-        address: 192.168.3.206:27080
-    mgoLog:
-        address: 192.168.3.206:27090
-        size: 5
-        dbName: qfw
-        userName: admin
-        password: "123456"

+ 16 - 19
jyBXSubscribe/rpc/internal/logic/getsubsomeinfologic.go

@@ -5,7 +5,6 @@ import (
 	"app.yhyue.com/moapp/jybase/redis"
 	"context"
 	IC "jyBXSubscribe/rpc/init"
-	"jyBXSubscribe/rpc/model"
 	"strconv"
 	"time"
 
@@ -45,29 +44,29 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 		},
 	}
 	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)
-	//entId, _ := strconv.ParseInt(in.EntId, 10, 64)
-	//userInfo := IC.Compatible.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, baseUserId, accountId, entId, positionType, positionId)
+	accountId, _ := strconv.ParseInt(in.AccountId, 10, 64)
+	positionType, _ := strconv.ParseInt(in.PositionType, 10, 64)
+	positionId, _ := strconv.ParseInt(in.PositionId, 10, 64)
+	entId, _ := strconv.ParseInt(in.EntId, 10, 64)
+	user := IC.Compatible.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, baseUserId, accountId, entId, positionType, positionId)
 	//logx.Info("userInfo:", userInfo)
 	//P278 身份切换,切换企业 userId从代理header 获取的值是 职位id,所以改成用base_user_id 进行查user表信息
-	user, _ := model.NewSubscribePush(in.UserType).UserInfo(baseUserId)
+	//user, _ := model.NewSubscribePush(in.UserType).UserInfo(in.UserId)
 	//
-	resp.Data.HasKey, resp.Data.Industry = model.GetKeySet(in.UserType, user, []string{})
+	//resp.Data.HasKey, resp.Data.Industry = model.GetKeySet(in.UserType, user, []string{})
 	todayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
 	if user != nil {
 		//超级订阅
-		if common.IntAll((*user)["i_vip_status"]) == 1 || common.IntAll((*user)["i_vip_status"]) == 2 {
+		if user.Vip.Status == 1 || common.IntAll((*user)["i_vip_status"]) == 2 {
 			var threeRemind = int64(3 * 24 * 60 * 60)
 			var twoRemind = int64(2 * 24 * 60 * 60)
 			var oneRemind = int64(1 * 24 * 60 * 60)
-			if (*user)["isread"] != nil {
+			/*if (*user)["isread"] != nil {
 				resp.Data.IsRead = (*user)["isread"].(bool)
-			}
+			}*/
 			resp.Data.IsPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+in.UserId) >= 2000
-			resp.Data.IsOnTail = common.Int64All((*user)["i_vip_status"])
-			_endtime := (*user)["l_vip_endtime"]
+			resp.Data.IsOnTail = user.Vip.Status
+			_endtime := user.Vip.EndTime
 			//是否到期
 			if common.Int64All(_endtime)-time.Now().Unix() < threeRemind && common.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
 				resp.Data.IsExpire = 3 //即将到期
@@ -85,22 +84,20 @@ func (l *GetSubSomeInfoLogic) GetSubSomeInfo(in *bxsubscribe.SomeInfoReq) (*bxsu
 				resp.Data.OtherFlag = true
 			}
 		} else {
-			if (*user)["i_vip_status"] == nil {
+			if user.Vip.Status <= 0 {
 				resp.Data.IsExpire = 0
 			} else {
-				resp.Data.IsOnTail = common.Int64All((*user)["i_vip_status"])
+				resp.Data.IsOnTail = user.Vip.Status
 			}
 			resp.Data.IsPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+todayNum+"_"+in.UserId) >= 150
 		}
 		//是否进入向导查询
 		resp.Data.IsInTSguide = func() bool {
 			//付费用户无免费订阅,不进入订阅向导页面
-			if common.IntAll((*user)["i_member_status"]) > 0 || common.IntAll((*user)["i_vip_status"]) > 0 {
+			if user.Member.Status > 0 || user.Vip.Status > 0 {
 				return false
 			}
-			o_jy, _ := (*user)["o_jy"].(map[string]interface{})
-			iTsGuide := common.IntAll((*user)["i_ts_guide"])
-			if iTsGuide == 2 || (iTsGuide == 0 && len(o_jy) == 0) {
+			if !user.Vip.HasKey {
 				return true
 			}
 			return false

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 407 - 537
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe.pb.go


+ 1 - 1
jyBXSubscribe/rpc/type/bxsubscribe/bxsubscribe_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.19.4
+// - protoc             v3.15.1
 // source: bxsubscribe.proto
 
 package bxsubscribe

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно