用户接口远程调用
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.

90 lines
1.2 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. type FansReq struct {
  56. Req
  57. UserId string
  58. BusinessId string
  59. Lock bool
  60. }
  61. func rpc_server_conn(url ...string) (*UserServiceClient, error) {
  62. var rpc_url string
  63. if len(url) > 0 && url[0] != "" {
  64. rpc_url = url[0]
  65. } else if conf.USER_RPC_URL != "" {
  66. rpc_url = conf.USER_RPC_URL
  67. } else {
  68. rpc_url = "127.0.0.1:" + conf.USER_RPC_PORT
  69. }
  70. conn, _, err := DialUserService("tcp", rpc_url)
  71. if err != nil {
  72. return nil, err
  73. }
  74. return conn, nil
  75. }