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" "time" ) type OpenGameReq struct { *requests.RpcRequest GameID int `position:"Query" field:"game_id"` } type OpenGameResp struct { *responses.BaseResponse } type NewPayRedisDataReq struct { *requests.RpcRequest } type NewPayRedisDataResp struct { *responses.BaseResponse } type SyncWxComplaintData struct { MchId string `json:"mch_id"` } type SyncWxComplaintRequest struct { *requests.RpcRequest MchId string `position:"Body" field:"mch_id" default:"" ` Channel string `position:"Body" field:"channel" default:"" ` StartDate string `position:"Body" field:"start_date" default:"" ` EndDate string `position:"Body" field:"end_date" default:"" ` } type SyncWxComplaintResp 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 } func (baseResponse *SyncWxComplaintResp) GetHttpContentBytes() []byte { b, _ := json.Marshal(map[string]interface{}{"code": 200, "msg": "success"}) return b } // CreateOpenGameReq 创建同步到游戏中心请求 func CreateOpenGameReq(gameId int) *OpenGameReq { req := &OpenGameReq{ &requests.RpcRequest{}, gameId, } req.InitWithApiInfo(HOST, VERSION, "open_game.php") req.Method = requests.GET return req } // CreateOpenGameResp 创建同步到游戏中心响应 func CreateOpenGameResp() *OpenGameResp { return &OpenGameResp{ BaseResponse: &responses.BaseResponse{}, } } // CreateNewPayRedisDataReq 设置支付redis相关数据 func CreateNewPayRedisDataReq() *NewPayRedisDataReq { req := &NewPayRedisDataReq{ &requests.RpcRequest{}, } req.InitWithApiInfo(HOST, VERSION, "pay/new_pay_redis_data.php") req.Method = requests.GET return req } func CreateNewPayRedisDataResp() *NewPayRedisDataResp { return &NewPayRedisDataResp{ BaseResponse: &responses.BaseResponse{}, } } func CreateSyncSyncWxComplaintReq(channel string, mchID string, startDate string, endDate string) *SyncWxComplaintRequest { req := &SyncWxComplaintRequest{ RpcRequest: &requests.RpcRequest{}, } req.InitWithApiInfo(HOST, VERSION, "complaint/sync_wx_complaint.php") req.Method = requests.POST req.MchId = mchID req.Channel = channel req.StartDate = startDate req.EndDate = endDate // 设置超时时间 req.SetConnectTimeout(600 * time.Second) // 设置读取超时时间 req.SetReadTimeout(600 * time.Second) return req } func CreateSyncWxComplaintResp() *SyncWxComplaintResp { return &SyncWxComplaintResp{ BaseResponse: &responses.BaseResponse{}, } }