59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package passport
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
"fmt"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
|
"time"
|
|
)
|
|
|
|
type GetUserListRequest struct {
|
|
*requests.RpcRequest
|
|
}
|
|
|
|
type GetUserListResponse struct {
|
|
*responses.BaseResponse
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data []UserInfo `json:"data"`
|
|
}
|
|
|
|
type UserInfo struct {
|
|
UserName string `json:"user_name"` // 用户名
|
|
Uid string `json:"uid"` // uid
|
|
Telephone string `json:"telephone"` // 手机号
|
|
}
|
|
|
|
// CreateGetUserListRequest 获取玩家用户列表
|
|
func CreateGetUserListRequest(userName string) (req *GetUserListRequest) {
|
|
ts := time.Now().Unix()
|
|
hash := md5.New()
|
|
hash.Write([]byte(fmt.Sprintf("%v%v", ts, appKey)))
|
|
hashBytes := hash.Sum(nil)
|
|
sign := hex.EncodeToString(hashBytes)
|
|
|
|
req = &GetUserListRequest{
|
|
RpcRequest: &requests.RpcRequest{},
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
|
req.FormParams = map[string]string{
|
|
"act": "info",
|
|
"do": "get_user_list",
|
|
"user_names": userName,
|
|
"time": fmt.Sprintf("%v", ts),
|
|
"sign": sign,
|
|
}
|
|
|
|
req.Method = requests.POST
|
|
return
|
|
}
|
|
|
|
func CreateGetUserListResponse() (response *GetUserListResponse) {
|
|
response = &GetUserListResponse{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
return
|
|
}
|