wangshan пре 3 година
родитељ
комит
03cb4c1ecc

+ 1 - 1
rpc/common/common.go

@@ -33,7 +33,7 @@ func main() {
 		common.RegisterCommonServer(grpcServer, srv)
 	})
 	//日志记录
-	// s.AddUnaryInterceptors(util.CustomInterceptors)
+	s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)

+ 1 - 1
rpc/consumer/consumer.go

@@ -36,7 +36,7 @@ func main() {
 		}
 	})
 	//日志记录
-	// s.AddUnaryInterceptors(util.CustomInterceptors)
+	s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)

+ 2 - 1
rpc/consumer/internal/logic/supplyinfosearchlogic.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"jyInfo/rpc/model/es"
 	"log"
+	"strconv"
 	"strings"
 
 	se "app.yhyue.com/moapp/jybase/encrypt"
@@ -60,7 +61,7 @@ func (l *SupplyInfoSearchLogic) SupplyInfoSearch(in *consumer.SupplyInfoSearchRe
 				Id:          se.SE.EncodeString(common.InterfaceToStr(v["_id"])),
 				Province:    common.InterfaceToStr(v["province"]),
 				City:        common.InterfaceToStr(v["city"]),
-				PublishTime: common.InterfaceToStr(v["publish_time"]),
+				PublishTime: strconv.FormatInt(common.Int64All(v["publish_time"]), 10),
 				Highlight:   detail,
 			}
 			infos = append(infos, &info)

+ 1 - 1
rpc/manager/manager.go

@@ -41,7 +41,7 @@ func main() {
 		}
 	})
 	//日志记录
-	// s.AddUnaryInterceptors(util.CustomInterceptors)
+	s.AddUnaryInterceptors(util.CustomInterceptors)
 	defer s.Stop()
 
 	fmt.Printf("Starting rpc server at %s...\n", IC.C.ListenOn)

+ 3 - 0
rpc/util/customInterceptors.go

@@ -30,6 +30,9 @@ func CustomInterceptors(ctx context.Context, req interface{}, info *grpc.UnarySe
 	resp, err = handler(ctx, req)
 	fmt.Println("返回值", resp, err, appId)
 	respByte, err := json.Marshal(resp)
+	if len(respByte) > 200 {
+		respByte = respByte[:200]
+	}
 	if err != nil {
 		log.Println("---resp----:", err)
 	}