143 lines
5.7 KiB
Go
143 lines
5.7 KiB
Go
|
|
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"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// GetRoleCreateLogParam 角色创建日志查询参数
|
|||
|
|
// 说明:数值区间用 *int64,未设置(nil)时不参与筛选;切片为空表示不限定该条件
|
|||
|
|
type GetRoleCreateLogParam struct {
|
|||
|
|
Uid string `json:"uid"`
|
|||
|
|
EventTime []string `json:"event_time"` // 区间 [开始, 结束]
|
|||
|
|
GameSign []string `json:"game_sign"`
|
|||
|
|
GameId []string `json:"game_id"`
|
|||
|
|
RoleName []string `json:"role_name"`
|
|||
|
|
RoleId []string `json:"role_id"`
|
|||
|
|
ServerName []string `json:"server_name"`
|
|||
|
|
ServerId []string `json:"server_id"`
|
|||
|
|
RoleLevelMin *int64 `json:"role_level_min"`
|
|||
|
|
RoleLevelMax *int64 `json:"role_level_max"`
|
|||
|
|
PayAmtAccMin *int64 `json:"pay_amt_acc_min"`
|
|||
|
|
PayAmtAccMax *int64 `json:"pay_amt_acc_max"`
|
|||
|
|
Page int `json:"page"`
|
|||
|
|
PageSize int `json:"page_size"`
|
|||
|
|
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetRoleCreateLogRequest 角色创建日志查询请求
|
|||
|
|
type GetRoleCreateLogRequest struct {
|
|||
|
|
*requests.JsonRequest
|
|||
|
|
Uid string `position:"Json" field:"uid"`
|
|||
|
|
EventTime []string `position:"Json" field:"event_time"`
|
|||
|
|
GameSign []string `position:"Json" field:"game_sign"`
|
|||
|
|
GameId []string `position:"Json" field:"game_id"`
|
|||
|
|
RoleName []string `position:"Json" field:"role_name"`
|
|||
|
|
RoleId []string `position:"Json" field:"role_id"`
|
|||
|
|
ServerName []string `position:"Json" field:"server_name"`
|
|||
|
|
ServerId []string `position:"Json" field:"server_id"`
|
|||
|
|
RoleLevelMin *int64 `position:"Json" field:"role_level_min"`
|
|||
|
|
RoleLevelMax *int64 `position:"Json" field:"role_level_max"`
|
|||
|
|
PayAmtAccMin *int64 `position:"Json" field:"pay_amt_acc_min"`
|
|||
|
|
PayAmtAccMax *int64 `position:"Json" field:"pay_amt_acc_max"`
|
|||
|
|
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"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// getRoleCreateLogBody 自定义请求体序列化结构,绕开 core 的反射序列化(JsonParams):
|
|||
|
|
// - 数值字段 *int64 + omitempty:未设置(nil)时该字段不出现在 JSON 中,避免 0 被 DMS 当成真实筛选条件;
|
|||
|
|
// - 切片字段统一为非 nil 空数组 []:避免 nil 被序列化成 null 触发 DMS 类型校验失败;
|
|||
|
|
// - 标量字符串用 omitempty:空串时不出现在 JSON 中。
|
|||
|
|
type getRoleCreateLogBody struct {
|
|||
|
|
Uid string `json:"uid,omitempty"`
|
|||
|
|
EventTime []string `json:"event_time"`
|
|||
|
|
GameSign []string `json:"game_sign"`
|
|||
|
|
GameId []string `json:"game_id"`
|
|||
|
|
RoleName []string `json:"role_name"`
|
|||
|
|
RoleId []string `json:"role_id"`
|
|||
|
|
ServerName []string `json:"server_name"`
|
|||
|
|
ServerId []string `json:"server_id"`
|
|||
|
|
RoleLevelMin *int64 `json:"role_level_min,omitempty"`
|
|||
|
|
RoleLevelMax *int64 `json:"role_level_max,omitempty"`
|
|||
|
|
PayAmtAccMin *int64 `json:"pay_amt_acc_min,omitempty"`
|
|||
|
|
PayAmtAccMax *int64 `json:"pay_amt_acc_max,omitempty"`
|
|||
|
|
Page int `json:"page"`
|
|||
|
|
PageSize int `json:"page_size"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetBodyReader 覆盖 JsonRequest 默认实现,使用自定义结构序列化 body。
|
|||
|
|
// 鉴权头(Authorization / x-debug)仍由 core 的 InitParam 按 Header 字段设置,不受影响。
|
|||
|
|
func (request *GetRoleCreateLogRequest) GetBodyReader() io.Reader {
|
|||
|
|
body := getRoleCreateLogBody{
|
|||
|
|
Uid: request.Uid,
|
|||
|
|
EventTime: emptyStrSlice(request.EventTime),
|
|||
|
|
GameSign: emptyStrSlice(request.GameSign),
|
|||
|
|
GameId: emptyStrSlice(request.GameId),
|
|||
|
|
RoleName: emptyStrSlice(request.RoleName),
|
|||
|
|
RoleId: emptyStrSlice(request.RoleId),
|
|||
|
|
ServerName: emptyStrSlice(request.ServerName),
|
|||
|
|
ServerId: emptyStrSlice(request.ServerId),
|
|||
|
|
RoleLevelMin: request.RoleLevelMin,
|
|||
|
|
RoleLevelMax: request.RoleLevelMax,
|
|||
|
|
PayAmtAccMin: request.PayAmtAccMin,
|
|||
|
|
PayAmtAccMax: request.PayAmtAccMax,
|
|||
|
|
Page: request.Page,
|
|||
|
|
PageSize: request.PageSize,
|
|||
|
|
}
|
|||
|
|
b, err := json.Marshal(body)
|
|||
|
|
if err != nil {
|
|||
|
|
return strings.NewReader("")
|
|||
|
|
}
|
|||
|
|
return bytes.NewReader(b)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GetRoleCreateLogResponse 角色创建日志查询响应(返回不做处理,data 原样透出)
|
|||
|
|
type GetRoleCreateLogResponse struct {
|
|||
|
|
*responses.BaseResponse
|
|||
|
|
Code int `json:"code"`
|
|||
|
|
Message string `json:"message"`
|
|||
|
|
Data json.RawMessage `json:"data"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateGetRoleCreateLogRequest 创建角色创建日志查询请求
|
|||
|
|
// token 为 GetToken 返回的 data.token,直接放入 Authorization 头
|
|||
|
|
func CreateGetRoleCreateLogRequest(token string, param GetRoleCreateLogParam) *GetRoleCreateLogRequest {
|
|||
|
|
req := &GetRoleCreateLogRequest{
|
|||
|
|
JsonRequest: &requests.JsonRequest{},
|
|||
|
|
Uid: param.Uid,
|
|||
|
|
EventTime: param.EventTime,
|
|||
|
|
GameSign: param.GameSign,
|
|||
|
|
GameId: param.GameId,
|
|||
|
|
RoleName: param.RoleName,
|
|||
|
|
RoleId: param.RoleId,
|
|||
|
|
ServerName: param.ServerName,
|
|||
|
|
ServerId: param.ServerId,
|
|||
|
|
RoleLevelMin: param.RoleLevelMin,
|
|||
|
|
RoleLevelMax: param.RoleLevelMax,
|
|||
|
|
PayAmtAccMin: param.PayAmtAccMin,
|
|||
|
|
PayAmtAccMax: param.PayAmtAccMax,
|
|||
|
|
Page: param.Page,
|
|||
|
|
PageSize: param.PageSize,
|
|||
|
|
Authorization: token,
|
|||
|
|
XDebug: param.XDebug,
|
|||
|
|
}
|
|||
|
|
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/get_role_create_log")
|
|||
|
|
req.Method = requests.POST
|
|||
|
|
req.Scheme = requests.HTTPS
|
|||
|
|
return req
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// CreateGetRoleCreateLogResponse 创建角色创建日志查询响应
|
|||
|
|
func CreateGetRoleCreateLogResponse() *GetRoleCreateLogResponse {
|
|||
|
|
return &GetRoleCreateLogResponse{
|
|||
|
|
BaseResponse: &responses.BaseResponse{},
|
|||
|
|
}
|
|||
|
|
}
|