用户接口远程调用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.3 KiB

  1. package userrpc
  2. import (
  3. "git.tetele.net/tgo/conf"
  4. )
  5. const DES_KEY = "usersrpc"
  6. type Req struct {
  7. SiteId string
  8. Dbname string
  9. }
  10. type Third struct {
  11. Userid string
  12. Platform string
  13. Openid string
  14. Openname string
  15. Unionid string
  16. Avatar string
  17. Mobile string
  18. }
  19. type BindThirdReq struct {
  20. Req
  21. Third
  22. }
  23. type GetThirdReq struct {
  24. Req
  25. Userid string
  26. Platform string
  27. }
  28. type GetBusinessReq struct {
  29. Req
  30. BusinessId string
  31. }
  32. type GetUserReq struct {
  33. Req
  34. UserId string
  35. }
  36. type GetAddressReq struct {
  37. Req
  38. AddressId string
  39. }
  40. type Res struct {
  41. Errcode int
  42. Errmsg string
  43. }
  44. type Business struct {
  45. Type string
  46. BusinessId string
  47. CustomerId string
  48. Name string
  49. CompanyId string
  50. Contact string
  51. Mobile string
  52. HandingFee string
  53. IsOpen string
  54. }
  55. func rpc_server_conn(url ...string) (*UserServiceClient, error) {
  56. var rpc_url string
  57. if len(url) > 0 && url[0] != "" {
  58. rpc_url = url[0]
  59. } else if conf.USER_RPC_URL != "" {
  60. rpc_url = conf.USER_RPC_URL
  61. } else {
  62. rpc_url = "127.0.0.1:" + conf.USER_RPC_PORT
  63. }
  64. conn, _, err := DialUserService("tcp", rpc_url)
  65. if err != nil {
  66. return nil, err
  67. }
  68. return conn, nil
  69. }