Browse Source

修改连接服务参数

master v0.7.4
guzeng 3 years ago
parent
commit
ebb211b42e
1 changed files with 14 additions and 22 deletions
  1. +14
    -22
      user.client.go

+ 14
- 22
user.client.go View File

@ -12,14 +12,11 @@ import (
func GetUserByToken(dbname, token string, url ...string) (map[string]string, error) {
var user_rpc_url string = "127.0.0.1:7976"
if len(url) > 0 && url[0] != "" {
user_rpc_url = url[0]
}
conn, _, err := DialUserService("tcp", user_rpc_url)
conn, err := rpc_server_conn(url...)
if err != nil {
return map[string]string{}, err
}
defer conn.Close()
req := &UserRequest{proto.String(dbname), proto.String(token), nil}
@ -47,8 +44,9 @@ func GetUserByToken(dbname, token string, url ...string) (map[string]string, err
"Usercode": res.GetUsercode(),
"GroupId": res.GetGroupId(),
"Type": res.GetType(),
"ThirdId": res.GetThirdId(),
"Platform": res.GetPlatform(),
"ThirdId": res.GetThirdId(),
"Platform": res.GetPlatform(),
"LockFans": res.LockFans(),
}, nil
}
@ -60,12 +58,10 @@ func GetUserByToken(dbname, token string, url ...string) (map[string]string, err
*/
func GetUserByUsername(dbname, username string, url ...string) (*UserResponse, error) {
var user_rpc_url string = "127.0.0.1:7976"
if len(url) > 0 && url[0] != "" {
user_rpc_url = url[0]
conn, err := rpc_server_conn(url...)
if err != nil {
return map[string]string{}, err
}
conn, _, err := DialUserService("tcp", user_rpc_url)
if err != nil {
return nil, err
}
@ -89,12 +85,10 @@ func GetUserByUsername(dbname, username string, url ...string) (*UserResponse, e
*/
func GetUserByUsercode(dbname, usercode string, url ...string) (*UserResponse, error) {
var user_rpc_url string = "127.0.0.1:7976"
if len(url) > 0 && url[0] != "" {
user_rpc_url = url[0]
conn, err := rpc_server_conn(url...)
if err != nil {
return map[string]string{}, err
}
conn, _, err := DialUserService("tcp", user_rpc_url)
if err != nil {
return nil, err
}
@ -115,12 +109,10 @@ func GetUserByUsercode(dbname, usercode string, url ...string) (*UserResponse, e
func Login(dbname, account, password string, url ...string) (map[string]string, error) {
var user_rpc_url string = "127.0.0.1:7976"
if len(url) > 0 && url[0] != "" {
user_rpc_url = url[0]
conn, err := rpc_server_conn(url...)
if err != nil {
return map[string]string{}, err
}
conn, _, err := DialUserService("tcp", user_rpc_url)
if err != nil {
return map[string]string{}, err
}


Loading…
Cancel
Save