liujiandao
2024-03-15 605b2f00d71ecd25660553b0be45b9b122fe8d65
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()
   }
}