From 7dc4a177f9790a1eb7b4f9a8281a804fe52c3fb9 Mon Sep 17 00:00:00 2001 From: liguanjie Date: Wed, 28 May 2025 17:57:52 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90www=E6=9C=8D=E5=8A=A1=E3=80=91?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=AD=90=E6=B8=B8=E6=88=8F=E7=AE=80=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/game/client.go | 7 +++++- services/game/client_test.go | 14 ++++++++++++ services/game/game.go | 44 ++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/services/game/client.go b/services/game/client.go index f0d1a2c..23327eb 100644 --- a/services/game/client.go +++ b/services/game/client.go @@ -6,7 +6,7 @@ import ( ) const ( - VERSION = "2025-04-27" + VERSION = "2025-05-28" ) var HOST = requests.Host{ @@ -54,3 +54,8 @@ func (c *Client) GetProtocolByGameId(req *GetProtocolByGameIdRep) (resp *GetProt err = c.DoAction(req, resp) return } +func (c *Client) GetGameSimpleList(req *GetGameSimpleListReq) (resp *GetGameSimpleListResp, err error) { + resp = CreateGetGameSimpleListResp() + err = c.DoAction(req, resp) + return +} diff --git a/services/game/client_test.go b/services/game/client_test.go index e872aa1..b470a01 100644 --- a/services/game/client_test.go +++ b/services/game/client_test.go @@ -77,3 +77,17 @@ func TestGetProtocolByGameId(t *testing.T) { } fmt.Println(info) } + +func TestGetGameSimpleList(t *testing.T) { + client, err := NewClient() + if err != nil { + panic(err) + } + req := CreateGetGameSimpleListReq("8071,8062", "") + info, err := client.GetGameSimpleList(req) + if err != nil { + t.Error(err) + return + } + fmt.Println(info) +} diff --git a/services/game/game.go b/services/game/game.go index 48ac841..99683fe 100644 --- a/services/game/game.go +++ b/services/game/game.go @@ -162,3 +162,47 @@ func CreateGetGameInfoByIdResp() *GetGameInfoResp { BaseResponse: &responses.BaseResponse{}, } } + +type GetGameSimpleListReq struct { + *requests.RpcRequest +} + +type GetGameSimpleListResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data map[string]GameSimple `json:"data"` +} + +type GameSimple struct { + ID int `json:"id"` + Name string `json:"name"` + GameSign string `json:"game_sign"` +} + +// CreateGetGameSimpleListReq +// gids 子游戏字符串,多个子游戏id用英文逗号分割 +// game_signs 根游戏标识字符串,多个标识用英文逗号分割 +func CreateGetGameSimpleListReq(gameIds string, gameSigns string) *GetGameSimpleListReq { + req := &GetGameSimpleListReq{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, "/api/game/getSimpleList") + tmpParams := make(map[string]string) + if gameIds != "" { + tmpParams["gids"] = gameIds + } + if gameSigns != "" { + tmpParams["game_signs"] = gameSigns + } + req.FormParams = tmpParams + + req.Method = requests.POST + return req +} + +func CreateGetGameSimpleListResp() *GetGameSimpleListResp { + return &GetGameSimpleListResp{ + BaseResponse: &responses.BaseResponse{}, + } +}