8
0

Compare commits

...

5 Commits

Author SHA1 Message Date
5da993b652 feat(stat): 新增通用推入kafka数据接口 2026-06-10 17:21:18 +08:00
luoxun
c652a59856 Merge branch 'develop/luoxun/20260608' 2026-06-10 14:42:14 +08:00
luoxun
c4ab3c2ca3 dms运营中心调整字段 2026-06-10 14:42:05 +08:00
luoxun
973679f614 Revert "dms运营中心调整修改"
This reverts commit 47651781d5.
2026-06-10 14:38:54 +08:00
luoxun
47651781d5 dms运营中心调整修改 2026-06-10 14:38:42 +08:00
5 changed files with 83 additions and 24 deletions

View File

@ -23,8 +23,8 @@ type GetRoleCreateLogParam struct {
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"`
PayAmtAccMin *float64 `json:"pay_amt_acc_min"`
PayAmtAccMax *float64 `json:"pay_amt_acc_max"`
Page int `json:"page"`
PageSize int `json:"page_size"`
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
@ -43,8 +43,8 @@ type GetRoleCreateLogRequest struct {
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"`
PayAmtAccMin *float64 `position:"Json" field:"pay_amt_acc_min"`
PayAmtAccMax *float64 `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"`
@ -52,7 +52,7 @@ type GetRoleCreateLogRequest struct {
}
// getRoleCreateLogBody 自定义请求体序列化结构,绕开 core 的反射序列化(JsonParams)
// - 数值字段 *int64 + omitempty未设置(nil)时该字段不出现在 JSON 中,避免 0 被 DMS 当成真实筛选条件;
// - 数值字段 *float64 + omitempty未设置(nil)时该字段不出现在 JSON 中,避免 0 被 DMS 当成真实筛选条件;
// - event_time 切片统一为非 nil 空数组 []:避免 nil 被序列化成 null 触发 DMS 类型校验失败;
// - 标量字符串用 omitempty空串时不出现在 JSON 中。
type getRoleCreateLogBody struct {
@ -66,8 +66,8 @@ type getRoleCreateLogBody struct {
ServerId string `json:"server_id,omitempty"`
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"`
PayAmtAccMin *float64 `json:"pay_amt_acc_min,omitempty"`
PayAmtAccMax *float64 `json:"pay_amt_acc_max,omitempty"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}

View File

@ -28,10 +28,10 @@ type GetUserProfileParam struct {
RegisterDate []string `json:"register_date"` // 区间 [开始, 结束]
LastLoginDate []string `json:"last_login_date"` // 区间 [开始, 结束]
LastPayDate []string `json:"last_pay_date"` // 区间 [开始, 结束]
PayAmtAccMin *int64 `json:"pay_amt_acc_min"`
PayAmtAccMax *int64 `json:"pay_amt_acc_max"`
LastPayAmountMin *int64 `json:"last_pay_amount_min"`
LastPayAmountMax *int64 `json:"last_pay_amount_max"`
PayAmtAccMin *float64 `json:"pay_amt_acc_min"`
PayAmtAccMax *float64 `json:"pay_amt_acc_max"`
LastPayAmountMin *float64 `json:"last_pay_amount_min"`
LastPayAmountMax *float64 `json:"last_pay_amount_max"`
Page int `json:"page"`
PageSize int `json:"page_size"`
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
@ -55,10 +55,10 @@ type GetUserProfileRequest struct {
RegisterDate []string `position:"Json" field:"register_date"`
LastLoginDate []string `position:"Json" field:"last_login_date"`
LastPayDate []string `position:"Json" field:"last_pay_date"`
PayAmtAccMin *int64 `position:"Json" field:"pay_amt_acc_min"`
PayAmtAccMax *int64 `position:"Json" field:"pay_amt_acc_max"`
LastPayAmountMin *int64 `position:"Json" field:"last_pay_amount_min"`
LastPayAmountMax *int64 `position:"Json" field:"last_pay_amount_max"`
PayAmtAccMin *float64 `position:"Json" field:"pay_amt_acc_min"`
PayAmtAccMax *float64 `position:"Json" field:"pay_amt_acc_max"`
LastPayAmountMin *float64 `position:"Json" field:"last_pay_amount_min"`
LastPayAmountMax *float64 `position:"Json" field:"last_pay_amount_max"`
Page int `position:"Json" field:"page"`
PageSize int `position:"Json" field:"page_size"`
Authorization string `position:"Header" field:"Authorization"`
@ -66,7 +66,7 @@ type GetUserProfileRequest struct {
}
// getUserProfileBody 自定义请求体序列化结构,绕开 core 的反射序列化(JsonParams)
// - 金额字段 *int64 + omitempty未设置(nil)时该字段不出现在 JSON 中,避免 0 被 DMS 当成真实筛选条件;
// - 金额字段 *float64 + omitempty未设置(nil)时该字段不出现在 JSON 中,避免 0 被 DMS 当成真实筛选条件;
// - 切片字段统一为非 nil 空数组 []:避免 nil 被序列化成 null 触发 DMS 类型校验失败。
type getUserProfileBody struct {
UserName []string `json:"user_name"`
@ -84,10 +84,10 @@ type getUserProfileBody struct {
RegisterDate []string `json:"register_date"`
LastLoginDate []string `json:"last_login_date"`
LastPayDate []string `json:"last_pay_date"`
PayAmtAccMin *int64 `json:"pay_amt_acc_min,omitempty"`
PayAmtAccMax *int64 `json:"pay_amt_acc_max,omitempty"`
LastPayAmountMin *int64 `json:"last_pay_amount_min,omitempty"`
LastPayAmountMax *int64 `json:"last_pay_amount_max,omitempty"`
PayAmtAccMin *float64 `json:"pay_amt_acc_min,omitempty"`
PayAmtAccMax *float64 `json:"pay_amt_acc_max,omitempty"`
LastPayAmountMin *float64 `json:"last_pay_amount_min,omitempty"`
LastPayAmountMax *float64 `json:"last_pay_amount_max,omitempty"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}

View File

@ -164,3 +164,10 @@ func (c *Client) GetGamePayAmount(req *GetGamePayAmountReq) (resp *GetGamePayAmo
err = c.DoAction(req, resp)
return
}
// KafkaEvent 通用推入kafka数据
func (c *Client) KafkaEvent(req *KafkaEventReq) (resp *KafkaEventResp, err error) {
resp = CreateKafkaEventResp()
err = c.DoAction(req, resp)
return
}

View File

@ -358,10 +358,10 @@ func TestGetGamePayAmount(t *testing.T) {
t.Fatal(err)
}
req := CreateGetGamePayAmountReq(GetGamePayAmountParam{
Tdate: "2026-05-01", // 开始日期
Tdate2: "2026-05-31", // 结束日期(含当天)
GameIds: []int64{3706}, // 游戏id(=switch_game_id),传 nil 则全部
GroupByDate: false, // 仅按游戏汇总true 则按日期+游戏拆分
Tdate: "2026-05-01", // 开始日期
Tdate2: "2026-05-31", // 结束日期(含当天)
GameIds: []int64{3706}, // 游戏id(=switch_game_id),传 nil 则全部
GroupByDate: false, // 仅按游戏汇总true 则按日期+游戏拆分
})
resp, err := client.GetGamePayAmount(req)
@ -378,3 +378,27 @@ func TestGetGamePayAmount(t *testing.T) {
t.Errorf("GetGamePayAmount failed: code=%d msg=%s", resp.Code, resp.Msg)
}
}
func TestKafkaEvent(t *testing.T) {
client, err := NewClient()
if err != nil {
t.Fatal(err)
}
req := CreateKafkaEventReq(map[string]any{
"topic": "test_lebian_sop_event",
"event_name": "测试数据",
"event_data": map[string]any{},
})
resp, err := client.KafkaEvent(req)
if err != nil {
t.Fatal(err)
}
fmt.Println(resp.Code, resp.Msg)
// 成功码为 1
if resp.Code != 1 {
t.Errorf("TestKafkaEvent failed: code=%d msg=%s", resp.Code, resp.Msg)
}
}

View File

@ -0,0 +1,28 @@
package stat
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type KafkaEventReq = requests.JsonRequest
type KafkaEventResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
}
func CreateKafkaEventReq(param map[string]any) *KafkaEventReq {
req := &requests.JsonRequest{}
req.InitWithApiInfo(HOST, VERSION, "/event_track/kafka")
req.Method = requests.POST
req.JsonParams = param
return req
}
func CreateKafkaEventResp() *KafkaEventResp {
return &KafkaEventResp{
BaseResponse: &responses.BaseResponse{},
}
}