Browse Source

增加参数定义

master v0.8.1
guzeng 2 years ago
parent
commit
2bf5d2b055
1 changed files with 51 additions and 45 deletions
  1. +51
    -45
      common.go

+ 51
- 45
common.go View File

@ -1,83 +1,89 @@
package userrpc
import (
"git.tetele.net/tgo/conf"
"git.tetele.net/tgo/conf"
)
const DES_KEY = "usersrpc"
type Req struct {
SiteId string
Dbname string
SiteId string
Dbname string
}
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 {
Req
Third
Req
Third
}
type GetThirdReq struct {
Req
Userid string
Platform string
Req
Userid string
Platform string
}
type GetBusinessReq struct {
Req
BusinessId string
Req
BusinessId string
}
type GetUserReq struct {
Req
UserId string
Req
UserId string
}
type GetAddressReq struct {
Req
AddressId string
Req
AddressId string
}
type Res struct {
Errcode int
Errmsg string
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 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) {
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
}

Loading…
Cancel
Save