7
0

封装根据游戏id获取游戏信息方法

This commit is contained in:
huangqz 2025-04-27 10:59:33 +08:00
parent d8528ecbe8
commit 14551a66b4
3 changed files with 140 additions and 0 deletions

View File

@ -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
}

View File

@ -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)
}

121
services/game/game_info.go Normal file
View File

@ -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{},
}
}