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

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
}