7
0

Merge branch 'develop/xuyang/game_server_count'

This commit is contained in:
许 洋 2025-10-16 17:07:10 +08:00
commit c53870b08a
2 changed files with 23 additions and 11 deletions

View File

@ -123,14 +123,16 @@ 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",
})
resp, err := client.GetGameServerCountData(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
fmt.Printf("%+v", resp.Data)
}

View File

@ -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 {
@ -36,6 +37,13 @@ type GetGameServerCountData struct {
TotalPayRoleNum int64 `json:"total_pay_role_num"`
}
type GetGameServerCountDataParam struct {
GameSign string `json:"game_sign"`
ServerSign int64 `json:"server_sign"`
ServerId int64 `json:"server_id"`
RoleDates string `json:"role_dates"`
}
// CreateSyncGameServerListReq 创建同步开服数据请求
// opt: 更新 insertOrUpdate, 删除 del
//
@ -80,7 +88,7 @@ func CreateSyncGameServerListResp() *SyncGameServerListResp {
}
}
func CreateGetGameServerCountData(roleDates string, serverIds string) *GetGameServerCountDataReq {
func CreateGetGameServerCountData(param GetGameServerCountDataParam) *GetGameServerCountDataReq {
req := &GetGameServerCountDataReq{
&requests.RpcRequest{},
}
@ -88,8 +96,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"] = fmt.Sprintf("%v", param.ServerId)
req.FormParams["server_sign"] = fmt.Sprintf("%v", param.ServerSign)
req.FormParams["game_sign"] = param.GameSign
return req
}