package userrpc
|
|
|
|
import (
|
|
"git.tetele.net/tgo/conf"
|
|
)
|
|
|
|
const DES_KEY = "usersrpc"
|
|
|
|
type Req struct {
|
|
SiteId string
|
|
Dbname string
|
|
}
|
|
|
|
type Third struct {
|
|
Userid string
|
|
Platform string
|
|
Openid string
|
|
Openname string
|
|
Unionid string
|
|
Avatar string
|
|
Mobile string
|
|
}
|
|
|
|
type BindThirdReq struct {
|
|
Req
|
|
Third
|
|
}
|
|
|
|
type GetThirdReq struct {
|
|
Req
|
|
Userid string
|
|
Platform string
|
|
}
|
|
|
|
type GetBusinessReq struct {
|
|
Req
|
|
BusinessId string
|
|
}
|
|
|
|
type GetUserReq struct {
|
|
Req
|
|
UserId string
|
|
}
|
|
|
|
type GetAddressReq struct {
|
|
Req
|
|
AddressId string
|
|
}
|
|
type Res struct {
|
|
Errcode int
|
|
Errmsg string
|
|
}
|
|
|
|
type Business struct {
|
|
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
|
|
Lock bool
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
conn, _, err := DialUserService("tcp", rpc_url)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return conn, nil
|
|
}
|