소스 검색

Merge branch 'hotfix/v1.1.26.3_ws' of BaseService/jyMicroservices into hotfix/v1.1.26.3

wangshan 2 년 전
부모
커밋
05bbef6795
3개의 변경된 파일11개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 0
      jyBXBase/api/internal/logic/newestBiddingLogic.go
  2. 1 1
      jyBXBase/rpc/etc/bxbase.yaml
  3. 6 4
      jyBXBase/rpc/internal/logic/newestbiddinglogic.go

+ 4 - 0
jyBXBase/api/internal/logic/newestBiddingLogic.go

@@ -6,7 +6,9 @@ import (
 	"jyBXBase/api/internal/svc"
 	"jyBXBase/api/internal/types"
 	"jyBXBase/rpc/bxbase"
+	"log"
 	"net/http"
+	"time"
 
 	"github.com/zeromicro/go-zero/core/logx"
 )
@@ -28,6 +30,7 @@ func NewNewestBiddingLogic(ctx context.Context, svcCtx *svc.ServiceContext, r *h
 }
 
 func (l *NewestBiddingLogic) NewestBidding(req *types.NewestReq) (resp *types.CommonRes, err error) {
+	t := time.Now()
 	res, err0 := l.svcCtx.Bxbase.NewestBidding(l.ctx, &bxbase.NewestBiddingReq{
 		City:         req.City,
 		IsSearch:     req.IsSearch,
@@ -43,6 +46,7 @@ func (l *NewestBiddingLogic) NewestBidding(req *types.NewestReq) (resp *types.Co
 		EntAccountId: req.EntAccountId,
 		Phone:        req.Phone,
 	})
+	log.Println(req.PositionId, "----", req.Phone, "-查询耗时:-", time.Since(t).Seconds())
 	if err0 != nil {
 		return &types.CommonRes{
 			Err_code: -1,

+ 1 - 1
jyBXBase/rpc/etc/bxbase.yaml

@@ -2,7 +2,7 @@ Name: bxbase.rpc
 ListenOn: 127.0.0.1:8005
 Etcd:
   Hosts:
-  - 192.168.3.206:2379
+  - 127.0.0.1:2379
   Key: bxbase.rpc
 UserCenterKey: "usercenter.rpc" #用户中台rpc
 PowerCheckCenterKey: "powercheck.rpc" #权益校验中台

+ 6 - 4
jyBXBase/rpc/internal/logic/newestbiddinglogic.go

@@ -90,7 +90,7 @@ func (l *NewestBiddingLogic) NewestBidding(in *bxbase.NewestBiddingReq) (*bxbase
 			//  查推送
 			subscribeTime := time.Now()
 			list = roleNewestInfo.GetPushHistory()
-			log.Println("获取订阅数据耗时:", time.Since(subscribeTime).Seconds())
+			log.Println(in.PositionId, "---获取订阅数据耗时:", time.Since(subscribeTime).Seconds())
 			if list != nil && len(list) > 0 {
 				res.Data.List = list
 				res.Data.Count = int64(len(list))
@@ -111,7 +111,7 @@ func (l *NewestBiddingLogic) NewestBidding(in *bxbase.NewestBiddingReq) (*bxbase
 		}
 		esTime := time.Now()
 		list = model.NewestES(query)
-		log.Println("获取es数据耗时:", time.Since(esTime).Seconds())
+		log.Println(in.PositionId, "---获取es数据耗时:", time.Since(esTime).Seconds())
 		res.Data.List = list
 		res.Data.Count = int64(len(list))
 		return res, &newSet{model.StatusLogin, redisKey, model.StatusLogin, query}
@@ -135,7 +135,9 @@ func (l *NewestBiddingLogic) NewestBidding(in *bxbase.NewestBiddingReq) (*bxbase
 		go func(n *newSet, in *bxbase.NewestBiddingReq) {
 			if n.redisKey != "" {
 				//剩余时间 在 IC.C.NewsTimeOut 之内
-				if ttl := redis.GetTTL("new", n.redisKey); ttl-IC.C.NewsTimeOut < 0 {
+				ttl := redis.GetTTL("new", n.redisKey)
+				log.Println(in.PositionId, "---缓存剩余时间:", ttl)
+				if ttl-IC.C.NewsTimeOut < 0 {
 					var res = &bxbase.NewsetBiddingResp{
 						Data: &bxbase.NewsetBidding{
 							List: []*bxbase.NewestList{},
@@ -157,6 +159,6 @@ func (l *NewestBiddingLogic) NewestBidding(in *bxbase.NewestBiddingReq) (*bxbase
 	}
 
 	model.MakeCollection(in.UserId, r.Data.List)
-	log.Println("接口耗时:", time.Since(t).Seconds())
+	log.Println(in.PositionId, "--接口耗时:", time.Since(t).Seconds())
 	return r, nil
 }