From 605b2f00d71ecd25660553b0be45b9b122fe8d65 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期五, 15 三月 2024 10:15:29 +0800 Subject: [PATCH] 修改 --- model/grpc_init/crm_aps_init.go | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletions(-) diff --git a/model/grpc_init/crm_aps_init.go b/model/grpc_init/crm_aps_init.go index 6e82ec6..68958d2 100644 --- a/model/grpc_init/crm_aps_init.go +++ b/model/grpc_init/crm_aps_init.go @@ -7,7 +7,11 @@ "google.golang.org/grpc/credentials/insecure" ) -var CrmApsGrpcServiceConn *grpc.ClientConn +var ( + ProductInventoryServiceConn *grpc.ClientConn + CrmApsGrpcServiceConn *grpc.ClientConn + CrmSrmGrpcServiceConn *grpc.ClientConn +) func InitCrmApsGrpcServiceConn() { var err error @@ -23,3 +27,33 @@ CrmApsGrpcServiceConn.Close() } } + +func InitProductInventoryServiceConn() { + var err error + ProductInventoryServiceConn, err = grpc.Dial(conf.Conf.GrpcServiceAddr.WMS, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + logx.Errorf("grpc dial product service error: %v", err.Error()) + return + } +} + +func CloseProductInventoryServiceConn() { + if ProductInventoryServiceConn != nil { + ProductInventoryServiceConn.Close() + } +} + +func InitCrmSrmGrpcServiceConn() { + var err error + CrmSrmGrpcServiceConn, err = grpc.Dial(conf.Conf.GrpcServiceAddr.SRM, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + logx.Errorf("grpc dial product service error: %v", err.Error()) + return + } +} + +func CloseCrmSrmGrpcServiceConn() { + if CrmSrmGrpcServiceConn != nil { + CrmSrmGrpcServiceConn.Close() + } +} -- Gitblit v1.8.0