From 14551a66b4dc1ea54045caf5a24e0eb77b3dba02 Mon Sep 17 00:00:00 2001 From: huangqz Date: Sun, 27 Apr 2025 10:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85=E6=A0=B9=E6=8D=AE=E6=B8=B8?= =?UTF-8?q?=E6=88=8Fid=E8=8E=B7=E5=8F=96=E6=B8=B8=E6=88=8F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=96=B9=E6=B3=95?= 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 | 12 ++++ services/game/game_info.go | 121 +++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 services/game/game_info.go diff --git a/services/game/client.go b/services/game/client.go index 635d31f..4b1de72 100644 --- a/services/game/client.go +++ b/services/game/client.go @@ -29,3 +29,10 @@ func (c *Client) GetGameOsInfo(req *GetGameOsInfoReq) (resp *GetGameOsInfoResp, err = c.DoAction(req, resp) return } + +// GetGameInfo 获取游戏信息 +func (c *Client) GetGameInfo(req *GetGameInfoReq) (resp *GetGameInfoResp, err error) { + resp = CreateGetGameInfoByIdResp() + err = c.DoAction(req, resp) + return +} diff --git a/services/game/client_test.go b/services/game/client_test.go index 58a6d37..e0f2053 100644 --- a/services/game/client_test.go +++ b/services/game/client_test.go @@ -20,3 +20,15 @@ func TestGetGameOsInfo(t *testing.T) { fmt.Println(resp.Code, resp.Msg, resp.Data.OsList, resp.Data.OsRelList2) } + +func TestGetGameInfo(t *testing.T) { + client, err := NewClient() + if err != nil { + panic(err) + } + resp, err := client.GetGameInfo(CreateGetGameInfoByIdReq(8362, 1)) + if err != nil { + panic(err) + } + fmt.Println(resp.Code, resp.Msg, resp.Data) +} diff --git a/services/game/game_info.go b/services/game/game_info.go new file mode 100644 index 0000000..e2c1103 --- /dev/null +++ b/services/game/game_info.go @@ -0,0 +1,121 @@ +package game + +import ( + "fmt" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type GetGameInfoReq struct { + *requests.RpcRequest +} + +type GetGameInfoResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data GameInfoData `json:"data"` +} + +type GetGameInfoReqData struct { + GameId int + NoCache int +} + +type GameInfoData struct { + AcceptRelatedGame int `json:"accept_related_game"` + ActCodeState int `json:"act_code_state"` + AgentSign string `json:"agent_sign"` + AppId string `json:"app_id"` + AppName string `json:"app_name"` + Autologin int `json:"autologin"` + BName string `json:"b_name"` + BackResult int `json:"back_result"` + BusinessPurpose int `json:"business_purpose"` + ChannelShow int `json:"channel_show"` + ClientType int `json:"client_type"` + Company string `json:"company"` + CreatedAt string `json:"created_at"` + CreatedRealname string `json:"created_realname"` + CreatedUsername string `json:"created_username"` + DisableBack int `json:"disable_back"` + DisablePay int `json:"disable_pay"` + DisableRegister int `json:"disable_register"` + DisableRelatedBack int `json:"disable_related_back"` + DisableUnrelatedLogin int `json:"disable_unrelated_login"` + Discount int `json:"discount"` + Divide int `json:"divide"` + DownloadDomain string `json:"download_domain"` + DownloadId int `json:"download_id"` + ExchangeRate int `json:"exchange_rate"` + ExtData string `json:"ext_data"` + Fcmathod int `json:"fcmathod"` + FirstLetter string `json:"first_letter"` + FlashAuthId string `json:"flash_auth_id"` + FlashAuthKey string `json:"flash_auth_key"` + FlashAuthLogo string `json:"flash_auth_logo"` + FlashAuthName string `json:"flash_auth_name"` + FlashAuthStatus int `json:"flash_auth_status"` + GameByname string `json:"game_byname"` + GameIconImg string `json:"game_icon_img"` + GameSign string `json:"game_sign"` + GameTsUrl string `json:"game_ts_url"` + GameVersion string `json:"game_version"` + GameZsUrl string `json:"game_zs_url"` + GetRoleUrl string `json:"get_role_url"` + HideRedButton int `json:"hide_red_button"` + Icon string `json:"icon"` + Icp string `json:"icp"` + IcpUrl string `json:"icp_url"` + Id int `json:"id"` + IsAugment int `json:"is_augment"` + IsOpen int `json:"is_open"` + IsSync int `json:"is_sync"` + MarketName string `json:"market_name"` + MediaAbbr string `json:"media_abbr"` + MobileLoginState int `json:"mobile_login_state"` + MobileRegState int `json:"mobile_reg_state"` + Name string `json:"name"` + ObjectiveId int `json:"objective_id"` + OpenGame int `json:"open_game"` + Os int `json:"os"` + OsTwo int `json:"os_two"` + Owner int `json:"owner"` + PackageNameId int `json:"package_name_id"` + PayUrl string `json:"pay_url"` + PlatId int `json:"plat_id"` + Platform int `json:"platform"` + ProtocolPreState int `json:"protocol_pre_state"` + Rank int `json:"rank"` + RegisterProtocolState int `json:"register_protocol_state"` + RelateGame string `json:"relate_game"` + ReleaseState int `json:"release_state"` + Remark string `json:"remark"` + RequestDomain string `json:"request_domain"` + ResultCode string `json:"result_code"` + ScreenType int `json:"screen_type"` + ServerGroupId int `json:"server_group_id"` + ServerSign int `json:"server_sign"` + SimId int `json:"sim_id"` + SpareRequestDomain string `json:"spare_request_domain"` + TwOs int `json:"tw_os"` + TwPlatId int `json:"tw_plat_id"` + UpdatedAt string `json:"updated_at"` + UpdatedRealname string `json:"updated_realname"` + UpdatedUsername string `json:"updated_username"` +} + +func CreateGetGameInfoByIdReq(gameId, noCache int) *GetGameInfoReq { + req := &GetGameInfoReq{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, fmt.Sprintf("/api/game/getGameById/%d?no_cache=%d", gameId, noCache)) + req.Method = requests.GET + return req +} + +func CreateGetGameInfoByIdResp() *GetGameInfoResp { + return &GetGameInfoResp{ + BaseResponse: &responses.BaseResponse{}, + } +}