| @ -1,83 +1,89 @@ | |||||
| package userrpc | package userrpc | ||||
| import ( | import ( | ||||
| "git.tetele.net/tgo/conf" | |||||
| "git.tetele.net/tgo/conf" | |||||
| ) | ) | ||||
| const DES_KEY = "usersrpc" | const DES_KEY = "usersrpc" | ||||
| type Req struct { | type Req struct { | ||||
| SiteId string | |||||
| Dbname string | |||||
| SiteId string | |||||
| Dbname string | |||||
| } | } | ||||
| type Third struct { | type Third struct { | ||||
| Userid string | |||||
| Platform string | |||||
| Openid string | |||||
| Openname string | |||||
| Unionid string | |||||
| Avatar string | |||||
| Mobile string | |||||
| Userid string | |||||
| Platform string | |||||
| Openid string | |||||
| Openname string | |||||
| Unionid string | |||||
| Avatar string | |||||
| Mobile string | |||||
| } | } | ||||
| type BindThirdReq struct { | type BindThirdReq struct { | ||||
| Req | |||||
| Third | |||||
| Req | |||||
| Third | |||||
| } | } | ||||
| type GetThirdReq struct { | type GetThirdReq struct { | ||||
| Req | |||||
| Userid string | |||||
| Platform string | |||||
| Req | |||||
| Userid string | |||||
| Platform string | |||||
| } | } | ||||
| type GetBusinessReq struct { | type GetBusinessReq struct { | ||||
| Req | |||||
| BusinessId string | |||||
| Req | |||||
| BusinessId string | |||||
| } | } | ||||
| type GetUserReq struct { | type GetUserReq struct { | ||||
| Req | |||||
| UserId string | |||||
| Req | |||||
| UserId string | |||||
| } | } | ||||
| type GetAddressReq struct { | type GetAddressReq struct { | ||||
| Req | |||||
| AddressId string | |||||
| Req | |||||
| AddressId string | |||||
| } | } | ||||
| type Res struct { | type Res struct { | ||||
| Errcode int | |||||
| Errmsg string | |||||
| Errcode int | |||||
| Errmsg string | |||||
| } | } | ||||
| type Business struct { | type Business struct { | ||||
| Type string | |||||
| BusinessId string | |||||
| CustomerId string | |||||
| Name string | |||||
| CompanyId string | |||||
| Contact string | |||||
| Mobile string | |||||
| HandingFee string | |||||
| IsOpen string | |||||
| Type string | |||||
| BusinessId string | |||||
| CustomerId string | |||||
| Name string | |||||
| CompanyId string | |||||
| Contact string | |||||
| Mobile string | |||||
| HandingFee string | |||||
| IsOpen string | |||||
| } | |||||
| type FansReq struct { | |||||
| Req | |||||
| UserId string | |||||
| BusinessId string | |||||
| } | } | ||||
| func rpc_server_conn(url ...string) (*UserServiceClient, error) { | func rpc_server_conn(url ...string) (*UserServiceClient, error) { | ||||
| var rpc_url string | |||||
| if len(url) > 0 && url[0] != "" { | |||||
| rpc_url = url[0] | |||||
| } else if conf.USER_RPC_URL != "" { | |||||
| rpc_url = conf.USER_RPC_URL | |||||
| } else { | |||||
| rpc_url = "127.0.0.1:" + conf.USER_RPC_PORT | |||||
| } | |||||
| var rpc_url string | |||||
| if len(url) > 0 && url[0] != "" { | |||||
| rpc_url = url[0] | |||||
| } else if conf.USER_RPC_URL != "" { | |||||
| rpc_url = conf.USER_RPC_URL | |||||
| } else { | |||||
| rpc_url = "127.0.0.1:" + conf.USER_RPC_PORT | |||||
| } | |||||
| conn, _, err := DialUserService("tcp", rpc_url) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| conn, _, err := DialUserService("tcp", rpc_url) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return conn, nil | |||||
| return conn, nil | |||||
| } | } | ||||