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 { if err != nil {
return return
} }
fmt.Println(string(body))
baseResponse.httpStatus = httpResponse.StatusCode baseResponse.httpStatus = httpResponse.StatusCode
baseResponse.httpHeaders = httpResponse.Header baseResponse.httpHeaders = httpResponse.Header
baseResponse.httpContentBytes = body baseResponse.httpContentBytes = body

View File

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

View File

@ -2,7 +2,6 @@ package stat
import ( import (
"encoding/json" "encoding/json"
"fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
) )
@ -19,7 +18,10 @@ type SyncGameServerListResp struct {
} }
type GetGameServerCountDataReq 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 { type GetGameServerCountDataResp struct {
@ -30,20 +32,12 @@ type GetGameServerCountDataResp struct {
} }
type GetGameServerCountData struct { type GetGameServerCountData struct {
GameSign string `json:"game_sign"` ServerID int64 `json:"server_id"`
ServerId int64 `json:"server_id"`
RoleNum int64 `json:"role_num"` RoleNum int64 `json:"role_num"`
TotalPayAmount float64 `json:"total_pay_amount"` TotalPayAmount float64 `json:"total_pay_amount"`
TotalPayRoleNum int64 `json:"total_pay_role_num"` 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 创建同步开服数据请求 // CreateSyncGameServerListReq 创建同步开服数据请求
// opt: 更新 insertOrUpdate, 删除 del // opt: 更新 insertOrUpdate, 删除 del
// //
@ -88,19 +82,12 @@ func CreateSyncGameServerListResp() *SyncGameServerListResp {
} }
} }
func CreateGetGameServerCountData(param GetGameServerCountDataParam) *GetGameServerCountDataReq { func CreateGetGameServerCountDataReq(req *GetGameServerCountDataReq) *GetGameServerCountDataReq {
req := &GetGameServerCountDataReq{ if req.JsonRequest == nil {
&requests.RpcRequest{}, req.JsonRequest = &requests.JsonRequest{}
} }
req.InitWithApiInfo(HOST, VERSION, "/game/getGameServerCountData") req.InitWithApiInfo(HOST, VERSION, "/game/getGameServerCountData")
req.Method = requests.POST 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 return req
} }