package client import ( "github.com/asim/go-micro/plugins/client/grpc/v4" "github.com/asim/go-micro/plugins/registry/consul/v4" "go-micro.dev/v4" "go-micro.dev/v4/registry" "gomicro-base/api/member" "gomicro-base/service/wallet/internal/conf" ) var ( cf *conf.Config memberSvc member.MemberService ) func NewMicroClient(c *conf.Config) { cf = c microRegistry := consul.NewRegistry(registry.Addrs(c.Server.ConsulAddr...)) // 轮询访问 microService := micro.NewService( micro.Client(grpc.NewClient()), micro.Registry(microRegistry), micro.WrapClient(NewTimeoutWrapper), ) memberSvc = member.NewMemberService(conf.Conf.Client.Member, microService.Client()) } func GetMemberSvc() member.MemberService { return memberSvc }