2024-09-19 10:21:07 +08:00
|
|
|
|
package script
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
|
|
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type OpenGameReq struct {
|
|
|
|
|
*requests.RpcRequest
|
2025-03-28 14:13:59 +08:00
|
|
|
|
GameID int `position:"Query" field:"game_id"`
|
2024-09-19 10:21:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type OpenGameResp struct {
|
|
|
|
|
*responses.BaseResponse
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// GetHttpContentBytes 因为http://script.gaore.com/open_game.php?game_id=这个接口返回的不是json,反序列化会报错,所以返回一个固定的json
|
|
|
|
|
func (baseResponse *OpenGameResp) GetHttpContentBytes() []byte {
|
|
|
|
|
b, _ := json.Marshal(map[string]interface{}{"code": 200, "msg": "success"})
|
|
|
|
|
return b
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CreateOpenGameReq 创建同步到游戏中心请求
|
|
|
|
|
func CreateOpenGameReq(gameId int) *OpenGameReq {
|
|
|
|
|
req := &OpenGameReq{
|
|
|
|
|
&requests.RpcRequest{},
|
2025-03-28 14:13:59 +08:00
|
|
|
|
gameId,
|
2024-09-19 10:21:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-03-28 14:13:59 +08:00
|
|
|
|
req.InitWithApiInfo(HOST, VERSION, "open_game.php")
|
|
|
|
|
req.Method = requests.GET
|
2024-09-19 10:21:07 +08:00
|
|
|
|
|
|
|
|
|
return req
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CreateOpenGameResp 创建同步到游戏中心响应
|
|
|
|
|
func CreateOpenGameResp() *OpenGameResp {
|
|
|
|
|
return &OpenGameResp{
|
|
|
|
|
BaseResponse: &responses.BaseResponse{},
|
|
|
|
|
}
|
|
|
|
|
}
|