|
@ -12,14 +12,11 @@ import ( |
|
|
|
|
|
|
|
|
func GetUserByToken(dbname, token string, url ...string) (map[string]string, error) { |
|
|
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 { |
|
|
if err != nil { |
|
|
return map[string]string{}, err |
|
|
return map[string]string{}, err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
defer conn.Close() |
|
|
defer conn.Close() |
|
|
|
|
|
|
|
|
req := &UserRequest{proto.String(dbname), proto.String(token), nil} |
|
|
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(), |
|
|
"Usercode": res.GetUsercode(), |
|
|
"GroupId": res.GetGroupId(), |
|
|
"GroupId": res.GetGroupId(), |
|
|
"Type": res.GetType(), |
|
|
"Type": res.GetType(), |
|
|
"ThirdId": res.GetThirdId(), |
|
|
|
|
|
"Platform": res.GetPlatform(), |
|
|
|
|
|
|
|
|
"ThirdId": res.GetThirdId(), |
|
|
|
|
|
"Platform": res.GetPlatform(), |
|
|
|
|
|
"LockFans": res.LockFans(), |
|
|
}, nil |
|
|
}, 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) { |
|
|
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 { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
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) { |
|
|
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 { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
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) { |
|
|
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 { |
|
|
if err != nil { |
|
|
return map[string]string{}, err |
|
|
return map[string]string{}, err |
|
|
} |
|
|
} |
|
|