From b3f94062fb4c99406ca47266f44b1612a3bcd222 Mon Sep 17 00:00:00 2001 From: liangzy Date: Tue, 7 Dec 2021 15:30:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0callback=20=E4=B8=8A=E6=8A=A5?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=A1=8C=E4=B8=BA=E4=BB=98=E8=B4=B9=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/callback/client.go | 48 +++++++++++++++++++++++++++++++ services/callback/send_action.go | 49 ++++++++++++++++++++++++++++++++ services/jedi/client.go | 6 ---- services/jedi/test_demo.go | 37 ------------------------ 4 files changed, 97 insertions(+), 43 deletions(-) create mode 100644 services/callback/client.go create mode 100644 services/callback/send_action.go delete mode 100644 services/jedi/test_demo.go diff --git a/services/callback/client.go b/services/callback/client.go new file mode 100644 index 0000000..859aa38 --- /dev/null +++ b/services/callback/client.go @@ -0,0 +1,48 @@ +package callback + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" +) + +const ( + VERSION = "2021-11-30" +) + +var HOST requests.Host = requests.Host{ + Default: "callback.api.gaore.com", + Func: func(s string) string { + var a = map[string]string{ + requests.RELEASE: "callback.api.gaore.com", + requests.PRE: "callback.api.gaore.com", + requests.TEST: "callback.api.gaore.com", + } + return a[s] + }, +} + +type Client struct { + sdk.Client +} + +func NewClient() (client *Client) { + client = &Client{} + client.InitWithAccessKey("", "", "") + return +} + +//上报关键行为 +func (c *Client) SendAction(req *SendActionRequest) (response *SendActionResponse, err error) { + response = CreateSendActionResponse() + err = c.DoAction(req, response) + return +} + +// 上报激活 +func (c *Client) SendActive() { + +} + +// 上报付费 + +// 上报注册 diff --git a/services/callback/send_action.go b/services/callback/send_action.go new file mode 100644 index 0000000..555e181 --- /dev/null +++ b/services/callback/send_action.go @@ -0,0 +1,49 @@ +package callback + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +const OS_ANDROID = 2 + +const OS_IOS = 1 + +type SendActionRequest struct { + *requests.RpcRequest + GameId int64 `position:"Query" field:"game_id" default:"" ` + AgentId int64 `position:"Query" field:"agent_id" default:"" ` + SiteId int64 `position:"Query" field:"site_id" default:"" ` + Imei string `position:"Query" field:"imei" default:"" ` + Oaid string `position:"Query" field:"oaid" default:"" ` + Ip string `position:"Query" field:"ip" default:"" ` + Ua string `position:"Query" field:"ua" default:"" ` + Os int `position:"Query" field:"Os" default:"" ` + ParamsArray []string +} + +type SendActionResponseData struct { + Account string `json:"account"` + Total int `json:"total"` +} + +type SendActionResponse struct { + *responses.BaseResponse + Data SendActionResponseData `json:"data"` +} + +func CreateSendActionRequest() (req *SendActionRequest) { + req = &SendActionRequest{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, "/callback/ads_callback/sendAction") + req.Method = requests.GET + return +} + +func CreateSendActionResponse() (response *SendActionResponse) { + response = &SendActionResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/services/jedi/client.go b/services/jedi/client.go index ca91eb7..9906351 100644 --- a/services/jedi/client.go +++ b/services/jedi/client.go @@ -35,12 +35,6 @@ func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err er return } -func (c *Client) Test(req *DemoTestRequest) (response *DemoTestResponse, err error) { - response = CreateDemoTestResponse() - err = c.DoAction(req, response) - return -} - func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) { client = &Client{} err = client.InitWithAccessKey(accesskey, secrect, source) diff --git a/services/jedi/test_demo.go b/services/jedi/test_demo.go deleted file mode 100644 index e2ede2c..0000000 --- a/services/jedi/test_demo.go +++ /dev/null @@ -1,37 +0,0 @@ -package jedi - -import ( - "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" - "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" -) - -type DemoTestRequest struct { - *requests.RpcRequest - Param1 string `position:"Query" field:"param_1" default:"" ` - Param2 int `position:"Query" field:"param_2" default:"10086" ` - Param3 bool `position:"Query" field:"param_3" default:"false" ` - ParamBody string `position:"Body" field:"param_body" default:"foobar" ` -} - -func CreateDemoTestRequest() (req *DemoTestRequest) { - req = &DemoTestRequest{RpcRequest: &requests.RpcRequest{}} - req.InitWithApiInfo(HOST, VERSION, "/api/sms/Index") - req.Method = requests.POST - return -} - -type DemoTestResponse struct { - *responses.BaseResponse - Data DemoTestResponseData `json:"data"` -} - -type DemoTestResponseData struct { - Account string `json:"account"` - Total int `json:"total"` -} - -func CreateDemoTestResponse() *DemoTestResponse { - return &DemoTestResponse{ - BaseResponse: &responses.BaseResponse{}, - } -}