| | |
| | | logx.Errorf("grpc dial product service error: %v", err.Error()) |
| | | return |
| | | } |
| | | AdminConn, err = grpc.Dial(conf.GrpcServerConf.AdminAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) |
| | | if err != nil { |
| | | logx.Errorf("grpc dial product service error: %v", err.Error()) |
| | | return |
| | | if len(conf.GrpcServerConf.AdminAddr) > 0 { |
| | | AdminConn, err = grpc.Dial(conf.GrpcServerConf.AdminAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) |
| | | if err != nil { |
| | | logx.Errorf("grpc dial product service error: %v", err.Error()) |
| | | return |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import ( |
| | | "context" |
| | | "errors" |
| | | "wms/pkg/logx" |
| | | "wms/proto/init_client" |
| | | ) |
| | | |
| | | func GetUserList() ([]*GetUserRequest, error) { |
| | | if init_client.AdminConn == nil { |
| | | return nil, errors.New("grpc.ClientConnInterface AdminConn is nil") |
| | | } |
| | | cli := NewUserServiceClient(init_client.AdminConn) |
| | | list, err := cli.GetUserList(context.Background(), &GetUserRequest{}) |
| | | if err != nil { |