passport:添加获取用户登陆信息接口
This commit is contained in:
parent
d67eb28722
commit
3ee33ce74d
@ -102,3 +102,11 @@ func (c *Client) GetUserId(req *GetUserIdRequest) (response *GetUserIdResponse,
|
|||||||
err = c.DoAction(req, response)
|
err = c.DoAction(req, response)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUserLogin
|
||||||
|
// 获取用户登陆信息
|
||||||
|
func (c *Client) GetUserLogin(req *GetUserLoginRequest) (response *GetUserLoginResponse, err error) {
|
||||||
|
response = CreateGetUserLoginResponse()
|
||||||
|
err = c.DoAction(req, response)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@ -212,3 +212,21 @@ func TestGetUserId(t *testing.T) {
|
|||||||
fmt.Printf("raw: %s\n", resp.GetHttpContentString())
|
fmt.Printf("raw: %s\n", resp.GetHttpContentString())
|
||||||
fmt.Printf("data: %+v\n", data)
|
fmt.Printf("data: %+v\n", data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 测试获取用户登陆信息
|
||||||
|
func TestGetUserLogin(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req := CreateGetUserLoginRequest("gr28063399")
|
||||||
|
resp, err := client.GetUserLogin(req)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("raw: %s\n", resp.GetHttpContentString())
|
||||||
|
fmt.Printf("data: %+v\n, %d", resp.Data, len(resp.Data))
|
||||||
|
}
|
||||||
|
|||||||
@ -280,3 +280,54 @@ func CreateGetUserLabelsResponse() (response *GetUserLabelsResponse) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetUserLoginRequest struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetUserLoginResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data map[string]UserLogin `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserLogin struct {
|
||||||
|
Uid int64 `json:"uid"`
|
||||||
|
UserName string `json:"user_name"`
|
||||||
|
GameId int64 `json:"game_id"`
|
||||||
|
Imei string `json:"imei"`
|
||||||
|
Imei2 string `json:"imei2"`
|
||||||
|
LastLoginTime int64 `json:"last_login_time"`
|
||||||
|
LastLoginIp string `json:"last_login_ip"`
|
||||||
|
AgentId int64 `json:"agent_id"`
|
||||||
|
SiteId int64 `json:"site_id"`
|
||||||
|
FirstLoginTime int64 `json:"first_login_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateGetUserLoginRequest 获取用户登陆信息
|
||||||
|
func CreateGetUserLoginRequest(userNames string) (req *GetUserLoginRequest) {
|
||||||
|
ts, sign := GetSign()
|
||||||
|
|
||||||
|
req = &GetUserLoginRequest{
|
||||||
|
RpcRequest: &requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||||
|
req.FormParams = map[string]string{
|
||||||
|
"act": "info",
|
||||||
|
"do": "get_user_login",
|
||||||
|
"user_names": userNames,
|
||||||
|
"time": fmt.Sprintf("%v", ts),
|
||||||
|
"sign": sign,
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Method = requests.POST
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateGetUserLoginResponse() (response *GetUserLoginResponse) {
|
||||||
|
response = &GetUserLoginResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user