From a63ab8a8dc859d1996bc9ad0aa92f8dea635fc3b Mon Sep 17 00:00:00 2001 From: xuyang Date: Thu, 16 Oct 2025 11:13:41 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8C=BA=E6=9C=8D?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/stat/client_test.go | 10 ++++++---- services/stat/game.go | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/services/stat/client_test.go b/services/stat/client_test.go index 27822d5..e8242a4 100644 --- a/services/stat/client_test.go +++ b/services/stat/client_test.go @@ -123,10 +123,12 @@ func TestGetGameServerCountData(t *testing.T) { if err != nil { panic(err) } - req := CreateGetGameServerCountData( - "2024-07-30,2024-07-23", - "1111,1234", - ) + req := CreateGetGameServerCountData(GetGameServerCountDataParam{ + GameSign: "cs140", + ServerSign: "8678", + ServerId: "1944", + RoleDates: "2025-10-15,2025-10-16", + }) resp, err := client.GetGameServerCountData(req) if err != nil { panic(err) diff --git a/services/stat/game.go b/services/stat/game.go index ed4b86c..e26af38 100644 --- a/services/stat/game.go +++ b/services/stat/game.go @@ -36,6 +36,13 @@ type GetGameServerCountData struct { TotalPayRoleNum int64 `json:"total_pay_role_num"` } +type GetGameServerCountDataParam struct { + GameSign string `json:"game_sign"` + ServerSign string `json:"server_sign"` + ServerId string `json:"server_id"` + RoleDates string `json:"role_dates"` +} + // CreateSyncGameServerListReq 创建同步开服数据请求 // opt: 更新 insertOrUpdate, 删除 del // @@ -80,7 +87,7 @@ func CreateSyncGameServerListResp() *SyncGameServerListResp { } } -func CreateGetGameServerCountData(roleDates string, serverIds string) *GetGameServerCountDataReq { +func CreateGetGameServerCountData(param GetGameServerCountDataParam) *GetGameServerCountDataReq { req := &GetGameServerCountDataReq{ &requests.RpcRequest{}, } @@ -88,8 +95,10 @@ func CreateGetGameServerCountData(roleDates string, serverIds string) *GetGameSe req.InitWithApiInfo(HOST, VERSION, "/game/getGameServerCountData") req.Method = requests.POST req.FormParams = make(map[string]string) - req.FormParams["role_dates"] = roleDates - req.FormParams["server_ids"] = serverIds + req.FormParams["role_dates"] = param.RoleDates + req.FormParams["server_id"] = param.ServerId + req.FormParams["server_sign"] = param.ServerSign + req.FormParams["game_sign"] = param.GameSign return req } From d06b43fea8797d1124d04387f31bfcc071fea014 Mon Sep 17 00:00:00 2001 From: xuyang Date: Thu, 16 Oct 2025 11:18:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8C=BA=E6=9C=8D?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/stat/game.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/stat/game.go b/services/stat/game.go index e26af38..599e5db 100644 --- a/services/stat/game.go +++ b/services/stat/game.go @@ -38,8 +38,8 @@ type GetGameServerCountData struct { type GetGameServerCountDataParam struct { GameSign string `json:"game_sign"` - ServerSign string `json:"server_sign"` - ServerId string `json:"server_id"` + ServerSign int64 `json:"server_sign"` + ServerId int64 `json:"server_id"` RoleDates string `json:"role_dates"` } From 56ab109c90111eae2f7ccb0ce216ccf4233f59af Mon Sep 17 00:00:00 2001 From: xuyang Date: Thu, 16 Oct 2025 12:22:40 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8C=BA=E6=9C=8D?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/stat/client_test.go | 8 ++++---- services/stat/game.go | 11 ++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/services/stat/client_test.go b/services/stat/client_test.go index e8242a4..5545733 100644 --- a/services/stat/client_test.go +++ b/services/stat/client_test.go @@ -125,14 +125,14 @@ func TestGetGameServerCountData(t *testing.T) { } req := CreateGetGameServerCountData(GetGameServerCountDataParam{ GameSign: "cs140", - ServerSign: "8678", - ServerId: "1944", - RoleDates: "2025-10-15,2025-10-16", + ServerSign: 8678, + ServerId: 1944, + RoleDates: "2025-10-15", }) resp, err := client.GetGameServerCountData(req) if err != nil { panic(err) } - fmt.Println(resp.Code, resp.Msg, resp.Data) + fmt.Printf("%+v", resp.Data) } diff --git a/services/stat/game.go b/services/stat/game.go index 599e5db..9a6d9d1 100644 --- a/services/stat/game.go +++ b/services/stat/game.go @@ -2,6 +2,7 @@ package stat import ( "encoding/json" + "fmt" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" ) @@ -23,9 +24,9 @@ type GetGameServerCountDataReq struct { type GetGameServerCountDataResp struct { *responses.BaseResponse - Code int `json:"code"` - Msg string `json:"msg"` - Data []GetGameServerCountData `json:"data"` + Code int `json:"code"` + Msg string `json:"msg"` + Data GetGameServerCountData `json:"data"` } type GetGameServerCountData struct { @@ -96,8 +97,8 @@ func CreateGetGameServerCountData(param GetGameServerCountDataParam) *GetGameSer req.Method = requests.POST req.FormParams = make(map[string]string) req.FormParams["role_dates"] = param.RoleDates - req.FormParams["server_id"] = param.ServerId - req.FormParams["server_sign"] = param.ServerSign + req.FormParams["server_id"] = fmt.Sprintf("%v", param.ServerId) + req.FormParams["server_sign"] = fmt.Sprintf("%v", param.ServerSign) req.FormParams["game_sign"] = param.GameSign return req