6
0
gaore-common-sdk-go/services/game/game.go
yuxh 25552dd187 feat(game): 添加获取游戏客户端版本配置接口
- 在 game/client.go 中添加了 GetGameByVersion 方法- 在 game/game.go 中定义了 GetGameByVersionReq 和 GetGameByVersionResp 结构体
- 实现了创建请求和响应对象的函数 CreateGetGameByVersionReq 和 CreateGetGameByVersionResp
2025-06-20 12:09:20 +08:00

292 lines
9.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 GetGameOsInfoReq struct {
*requests.RpcRequest
}
type GetGameOsInfoResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data Data `json:"data"`
}
type Data struct {
OsRelList2 []OsRelList2 `json:"os_rel_list2"`
OsList map[string]OsList `json:"os_list"`
}
type OsRelList2 struct {
TwPlatID int `json:"tw_plat_id"`
TwOs int `json:"tw_os"`
Os int `json:"os"`
OsTwo int `json:"os_two"`
}
type OsList struct {
Name string `json:"name"`
OsTwo map[string]interface{}
}
func CreateGetGameOsInfoReq() *GetGameOsInfoReq {
req := &GetGameOsInfoReq{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameOsInfo")
req.Method = requests.POST
return req
}
func CreateGetGameOsInfoResp() *GetGameOsInfoResp {
return &GetGameOsInfoResp{
BaseResponse: &responses.BaseResponse{},
}
}
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"`
FlashPassId string `json:"flash_pass_id"`
FlashPassKey string `json:"flash_pass_key"`
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{},
}
}
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{},
}
}
// GameCompany
// 获取根游戏记录
type GameCompany struct {
Id int `json:"id"`
GameSign string `json:"game_sign"`
Name string `json:"name"`
GameName string `json:"game_name"`
ContractName string `json:"contract_name"`
PayKey string `json:"pay_key"`
LoginKey string `json:"login_key"`
LoginUrlH5 string `json:"login_url_h5"`
LoginUrlIos string `json:"login_url_ios"`
LoginUrlAndroid string `json:"login_url_android"`
PayUrl string `json:"pay_url"`
Ext string `json:"ext"`
Status int `json:"status"`
Company string `json:"company"`
System string `json:"system"`
Sync int `json:"sync"`
Type int `json:"type"`
GameProductId int `json:"game_product_id"`
}
type GetGameCompanyReq struct {
*requests.RpcRequest
}
type GetGameCompanyResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data GameCompany `json:"data"`
}
func CreateGetGameCompanyReq(gameSign string) *GetGameCompanyReq {
req := &GetGameCompanyReq{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameCompanyBySign")
req.FormParams = map[string]string{
"gameSign": gameSign,
}
req.Method = requests.POST
return req
}
func CreateGetGameCompanyResp() *GetGameCompanyResp {
return &GetGameCompanyResp{
BaseResponse: &responses.BaseResponse{},
}
}
// ==== 获取游戏客户端版本配置
type GetGameByVersionReq struct {
*requests.RpcRequest
GameId int `position:"Body" field:"game_id"`
GameVersion string `position:"Body" field:"game_version"`
}
type GetGameByVersionResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data GameVersionInfo `json:"data"`
}
func CreateGetGameByVersionReq(gameId int, gameVersion string) *GetGameByVersionReq {
req := &GetGameByVersionReq{
RpcRequest: &requests.RpcRequest{},
}
req.GameId = gameId
req.GameVersion = gameVersion
req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameByVersion")
req.Method = requests.POST
return req
}
func CreateGetGameByVersionResp() *GetGameByVersionResp {
return &GetGameByVersionResp{
BaseResponse: &responses.BaseResponse{},
}
}