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

74 lines
1.0 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 Res struct {
  33. Errcode int
  34. Errmsg string
  35. }
  36. type Business struct {
  37. Type string
  38. BusinessId string
  39. CustomerId string
  40. Name string
  41. CompanyId string
  42. Contact string
  43. Mobile string
  44. HandingFee string
  45. IsOpen string
  46. }
  47. func rpc_server_conn(url ...string) (*UserServiceClient, error) {
  48. var rpc_url string
  49. if len(url) > 0 && url[0] != "" {
  50. rpc_url = url[0]
  51. } else if conf.USER_RPC_URL != "" {
  52. rpc_url = conf.USER_RPC_URL
  53. } else {
  54. rpc_url = "127.0.0.1:" + conf.USER_RPC_PORT
  55. }
  56. conn, _, err := DialUserService("tcp", rpc_url)
  57. if err != nil {
  58. return nil, err
  59. }
  60. return conn, nil
  61. }