7
0

获取区服统计数据v2

This commit is contained in:
许 洋 2025-10-27 17:37:17 +08:00
parent 56ab109c90
commit cc6622af98
3 changed files with 13 additions and 26 deletions

View File

@ -65,6 +65,7 @@ func (baseResponse *BaseResponse) parseFromHttpResponse(httpResponse *http.Respo
if err != nil {
return
}
fmt.Println(string(body))
baseResponse.httpStatus = httpResponse.StatusCode
baseResponse.httpHeaders = httpResponse.Header
baseResponse.httpContentBytes = body

View File

@ -123,11 +123,10 @@ func TestGetGameServerCountData(t *testing.T) {
if err != nil {
panic(err)
}
req := CreateGetGameServerCountData(GetGameServerCountDataParam{
GameSign: "cs140",
ServerSign: 8678,
ServerId: 1944,
RoleDates: "2025-10-15",
req := CreateGetGameServerCountDataReq(&GetGameServerCountDataReq{
GameIds: []int64{3706},
ServerId: 203902,
RoleDates: []string{"2023-10-09", "2024-02-06"},
})
resp, err := client.GetGameServerCountData(req)
if err != nil {

View File

@ -2,7 +2,6 @@ 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"
)
@ -19,7 +18,10 @@ type SyncGameServerListResp struct {
}
type GetGameServerCountDataReq struct {
*requests.RpcRequest
*requests.JsonRequest
GameIds []int64 `position:"Json" field:"game_ids" json:"game_ids"`
ServerId int64 `position:"Json" field:"server_id" json:"server_id"`
RoleDates []string `position:"Json" field:"role_dates" json:"role_dates"`
}
type GetGameServerCountDataResp struct {
@ -30,20 +32,12 @@ type GetGameServerCountDataResp struct {
}
type GetGameServerCountData struct {
GameSign string `json:"game_sign"`
ServerId int64 `json:"server_id"`
ServerID int64 `json:"server_id"`
RoleNum int64 `json:"role_num"`
TotalPayAmount float64 `json:"total_pay_amount"`
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
//
@ -88,19 +82,12 @@ func CreateSyncGameServerListResp() *SyncGameServerListResp {
}
}
func CreateGetGameServerCountData(param GetGameServerCountDataParam) *GetGameServerCountDataReq {
req := &GetGameServerCountDataReq{
&requests.RpcRequest{},
func CreateGetGameServerCountDataReq(req *GetGameServerCountDataReq) *GetGameServerCountDataReq {
if req.JsonRequest == nil {
req.JsonRequest = &requests.JsonRequest{}
}
req.InitWithApiInfo(HOST, VERSION, "/game/getGameServerCountData")
req.Method = requests.POST
req.FormParams = make(map[string]string)
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
}