matches.pb.go 826 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package proto
  2. import (
  3. "context"
  4. "bet24.com/log"
  5. "bet24.com/servers/micros/common"
  6. "github.com/smallnest/rpcx/client"
  7. )
  8. const ServiceName = "matches"
  9. var consulAddr = common.Default_Consul_Addr
  10. func getClient() client.XClient {
  11. return common.GetClientPool().GetClient(ServiceName, consulAddr)
  12. }
  13. type Request struct {
  14. Name string
  15. UserId int
  16. }
  17. type Response struct {
  18. RetCode int
  19. Data string
  20. BoolValue bool
  21. }
  22. func SetConsulAddr(addr string) {
  23. consulAddr = addr
  24. }
  25. func SayHello(name string) string {
  26. xclient := getClient()
  27. args := &Request{
  28. Name: name,
  29. }
  30. reply := &Response{}
  31. err := xclient.Call(context.Background(), "SayHello", args, reply)
  32. if err != nil {
  33. log.Debug("matches failed to call: %v", err)
  34. common.GetClientPool().RemoveClient(ServiceName)
  35. return ""
  36. }
  37. return reply.Data
  38. }