6
0
This commit is contained in:
huangqz 2026-07-17 15:22:55 +08:00
commit 039e707c4e
3 changed files with 113 additions and 0 deletions

View File

@ -51,6 +51,13 @@ func (c *Client) GetRoleCreateLog(req *GetRoleCreateLogRequest) (response *GetRo
return
}
// GetUserDevice 用户设备号查询
func (c *Client) GetUserDevice(req *GetUserDeviceRequest) (response *GetUserDeviceResponse, err error) {
response = CreateGetUserDeviceResponse()
err = c.DoAction(req, response)
return
}
// GetUserLoginLogOsOptions 登录日志 OS 选项查询
func (c *Client) GetUserLoginLogOsOptions(req *GetUserLoginLogOsOptionsRequest) (response *GetUserLoginLogOsOptionsResponse, err error) {
response = CreateGetUserLoginLogOsOptionsResponse()

View File

@ -0,0 +1,96 @@
package big_data
import (
"bytes"
"encoding/json"
"io"
"strings"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
// GetUserDeviceParam 用户设备号查询参数(全部为数组,空数组表示不限定该条件)
type GetUserDeviceParam struct {
Uid []string `json:"uid"`
DeviceId []string `json:"device_id"`
Ip []string `json:"ip"`
LoginDate []string `json:"login_date"` // 登录日期区间 [开始, 结束]
Page int `json:"page"`
PageSize int `json:"page_size"`
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
}
// GetUserDeviceRequest 用户设备号查询请求
type GetUserDeviceRequest struct {
*requests.JsonRequest
Uid []string `position:"Json" field:"uid"`
DeviceId []string `position:"Json" field:"device_id"`
Ip []string `position:"Json" field:"ip"`
LoginDate []string `position:"Json" field:"login_date"`
Page int `position:"Json" field:"page"`
PageSize int `position:"Json" field:"page_size"`
Authorization string `position:"Header" field:"Authorization"`
XDebug string `position:"Header" field:"x-debug"`
}
// getUserDeviceBody 自定义请求体序列化:切片统一为非 nil 空数组 [],避免 nil→null 触发 DMS 类型校验失败
type getUserDeviceBody struct {
Uid []string `json:"uid"`
DeviceId []string `json:"device_id"`
Ip []string `json:"ip"`
LoginDate []string `json:"login_date"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}
// GetBodyReader 覆盖 JsonRequest 默认实现,使用自定义结构序列化 body
func (request *GetUserDeviceRequest) GetBodyReader() io.Reader {
body := getUserDeviceBody{
Uid: emptyStrSlice(request.Uid),
DeviceId: emptyStrSlice(request.DeviceId),
Ip: emptyStrSlice(request.Ip),
LoginDate: emptyStrSlice(request.LoginDate),
Page: request.Page,
PageSize: request.PageSize,
}
b, err := json.Marshal(body)
if err != nil {
return strings.NewReader("")
}
return bytes.NewReader(b)
}
// GetUserDeviceResponse 用户设备号查询响应data 原样透出)
type GetUserDeviceResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data"`
}
// CreateGetUserDeviceRequest 创建用户设备号查询请求
func CreateGetUserDeviceRequest(token string, param GetUserDeviceParam) *GetUserDeviceRequest {
req := &GetUserDeviceRequest{
JsonRequest: &requests.JsonRequest{},
Uid: param.Uid,
DeviceId: param.DeviceId,
Ip: param.Ip,
LoginDate: param.LoginDate,
Page: param.Page,
PageSize: param.PageSize,
Authorization: token,
XDebug: param.XDebug,
}
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/get_user_device")
req.Method = requests.POST
req.Scheme = requests.HTTPS
return req
}
// CreateGetUserDeviceResponse 创建用户设备号查询响应
func CreateGetUserDeviceResponse() *GetUserDeviceResponse {
return &GetUserDeviceResponse{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -25,6 +25,8 @@ type GetUserProfileParam struct {
TradeOrderId []string `json:"trade_order_id"`
GameSign []string `json:"game_sign"`
GameId []string `json:"game_id"`
DeviceId []string `json:"device_id"` // 设备号集合,空表示不限定
IP []string `json:"ip"` // IP 集合,空表示不限定
RegisterDate []string `json:"register_date"` // 区间 [开始, 结束]
LastLoginDate []string `json:"last_login_date"` // 区间 [开始, 结束]
LastPayDate []string `json:"last_pay_date"` // 区间 [开始, 结束]
@ -52,6 +54,8 @@ type GetUserProfileRequest struct {
TradeOrderId []string `position:"Json" field:"trade_order_id"`
GameSign []string `position:"Json" field:"game_sign"`
GameId []string `position:"Json" field:"game_id"`
DeviceId []string `position:"Json" field:"device_id"`
IP []string `position:"Json" field:"ip"`
RegisterDate []string `position:"Json" field:"register_date"`
LastLoginDate []string `position:"Json" field:"last_login_date"`
LastPayDate []string `position:"Json" field:"last_pay_date"`
@ -81,6 +85,8 @@ type getUserProfileBody struct {
TradeOrderId []string `json:"trade_order_id"`
GameSign []string `json:"game_sign"`
GameId []string `json:"game_id"`
DeviceId []string `json:"device_id"`
IP []string `json:"ip"`
RegisterDate []string `json:"register_date"`
LastLoginDate []string `json:"last_login_date"`
LastPayDate []string `json:"last_pay_date"`
@ -108,6 +114,8 @@ func (request *GetUserProfileRequest) GetBodyReader() io.Reader {
TradeOrderId: emptyStrSlice(request.TradeOrderId),
GameSign: emptyStrSlice(request.GameSign),
GameId: emptyStrSlice(request.GameId),
DeviceId: emptyStrSlice(request.DeviceId),
IP: emptyStrSlice(request.IP),
RegisterDate: emptyStrSlice(request.RegisterDate),
LastLoginDate: emptyStrSlice(request.LastLoginDate),
LastPayDate: emptyStrSlice(request.LastPayDate),
@ -166,6 +174,8 @@ func CreateGetUserProfileRequest(token string, param GetUserProfileParam) *GetUs
TradeOrderId: param.TradeOrderId,
GameSign: param.GameSign,
GameId: param.GameId,
DeviceId: param.DeviceId,
IP: param.IP,
RegisterDate: param.RegisterDate,
LastLoginDate: param.LastLoginDate,
LastPayDate: param.LastPayDate,