Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
30afd2cbe1 | |||
517d422993 | |||
721b735a0e | |||
e89f227e54 | |||
1902a769f8 | |||
857f7b9f90 | |||
5d941b865b | |||
e26c54c474 | |||
|
a7a0099cb8 | ||
|
e3cfca5bfa | ||
|
6ef4ff5389 |
3
go.mod
Normal file
3
go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module golib.gaore.com/GaoreGo/gaore-common-sdk-go
|
||||||
|
|
||||||
|
go 1.19
|
@ -15,6 +15,7 @@ type JsonRequest struct {
|
|||||||
|
|
||||||
func (request *JsonRequest) init() {
|
func (request *JsonRequest) init() {
|
||||||
request.baseRequest = defaultBaseRequest()
|
request.baseRequest = defaultBaseRequest()
|
||||||
|
request.baseRequest.AddHeaderParam("Content-Type", Json)
|
||||||
request.Method = POST
|
request.Method = POST
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,12 +36,16 @@ func (request *JsonRequest) BuildUrl() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (request *JsonRequest) GetStyle() string {
|
func (request *JsonRequest) GetStyle() string {
|
||||||
return RPC
|
return STREAM
|
||||||
}
|
}
|
||||||
|
|
||||||
func (request *JsonRequest) BuildQueries() string {
|
func (request *JsonRequest) BuildQueries() string {
|
||||||
path := strings.TrimLeft(strings.TrimSpace(request.GetActionName()), "/")
|
path := strings.TrimLeft(strings.TrimSpace(request.GetActionName()), "/")
|
||||||
request.queries = "/" + path + "?" + utils.GetUrlFormedMap(request.QueryParams)
|
mod := "&"
|
||||||
|
if !strings.Contains(path, "?") {
|
||||||
|
mod = "?"
|
||||||
|
}
|
||||||
|
request.queries = "/" + path + mod + utils.GetUrlFormedMap(request.QueryParams)
|
||||||
return request.queries
|
return request.queries
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +61,8 @@ func (request *JsonRequest) InitWithApiInfo(domain Host, version, urlPath string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (request *JsonRequest) GetBodyReader() io.Reader {
|
func (request *JsonRequest) GetBodyReader() io.Reader {
|
||||||
if request.FormParams != nil && len(request.FormParams) > 0 {
|
if request.JsonParams != nil && len(request.JsonParams) > 0 {
|
||||||
body, err := json.Marshal(request.FormParams)
|
body, err := json.Marshal(request.JsonParams)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return bytes.NewReader(body)
|
return bytes.NewReader(body)
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,12 @@ const (
|
|||||||
Xml = "application/xml"
|
Xml = "application/xml"
|
||||||
Raw = "application/octet-stream"
|
Raw = "application/octet-stream"
|
||||||
Form = "application/x-www-form-urlencoded"
|
Form = "application/x-www-form-urlencoded"
|
||||||
|
FormData = "multipart/form-data"
|
||||||
|
|
||||||
Header = "Header"
|
Header = "Header"
|
||||||
Query = "Query"
|
Query = "Query"
|
||||||
Body = "Body"
|
Body = "Body"
|
||||||
|
BodyJson = "Json"
|
||||||
Path = "Path"
|
Path = "Path"
|
||||||
|
|
||||||
TEST = "TEST"
|
TEST = "TEST"
|
||||||
@ -95,6 +97,7 @@ type AcsRequest interface {
|
|||||||
AddHeaderParam(key, value string)
|
AddHeaderParam(key, value string)
|
||||||
addQueryParam(key, value string)
|
addQueryParam(key, value string)
|
||||||
addFormParam(key, value string)
|
addFormParam(key, value string)
|
||||||
|
addJsonParam(string, any)
|
||||||
}
|
}
|
||||||
|
|
||||||
type baseRequest struct {
|
type baseRequest struct {
|
||||||
@ -118,6 +121,7 @@ type baseRequest struct {
|
|||||||
QueryParams map[string]string
|
QueryParams map[string]string
|
||||||
Headers map[string]string
|
Headers map[string]string
|
||||||
FormParams map[string]string
|
FormParams map[string]string
|
||||||
|
JsonParams map[string]any
|
||||||
Content []byte
|
Content []byte
|
||||||
|
|
||||||
queries string
|
queries string
|
||||||
@ -230,6 +234,10 @@ func (request *baseRequest) addFormParam(key, val string) {
|
|||||||
request.FormParams[key] = val
|
request.FormParams[key] = val
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (request *baseRequest) addJsonParam(key string, val any) {
|
||||||
|
request.JsonParams[key] = val
|
||||||
|
}
|
||||||
|
|
||||||
func defaultBaseRequest() (request *baseRequest) {
|
func defaultBaseRequest() (request *baseRequest) {
|
||||||
request = &baseRequest{
|
request = &baseRequest{
|
||||||
Scheme: HTTP,
|
Scheme: HTTP,
|
||||||
@ -242,6 +250,7 @@ func defaultBaseRequest() (request *baseRequest) {
|
|||||||
"Accept-Encoding": Json,
|
"Accept-Encoding": Json,
|
||||||
},
|
},
|
||||||
FormParams: make(map[string]string),
|
FormParams: make(map[string]string),
|
||||||
|
JsonParams: make(map[string]any),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -290,14 +299,14 @@ func flatRepeatedList(reflectValue reflect.Value, request AcsRequest, position s
|
|||||||
value = fieldDefault
|
value = fieldDefault
|
||||||
}
|
}
|
||||||
|
|
||||||
err = addParam(request, fieldPosition, name, value)
|
err = addParam(request, fieldPosition, name, value, reflectValue.Field(i).Interface())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func addParam(request AcsRequest, position, key, value string) (err error) {
|
func addParam(request AcsRequest, position, key, value string, vAny any) (err error) {
|
||||||
if len(value) > 0 {
|
if len(value) > 0 {
|
||||||
switch position {
|
switch position {
|
||||||
case Header:
|
case Header:
|
||||||
@ -306,6 +315,8 @@ func addParam(request AcsRequest, position, key, value string) (err error) {
|
|||||||
request.addQueryParam(key, value)
|
request.addQueryParam(key, value)
|
||||||
case Body:
|
case Body:
|
||||||
request.addFormParam(key, value)
|
request.addFormParam(key, value)
|
||||||
|
case BodyJson:
|
||||||
|
request.addJsonParam(key, vAny)
|
||||||
default:
|
default:
|
||||||
errmsg := fmt.Sprintf("unsupport positions add param `%s`", position)
|
errmsg := fmt.Sprintf("unsupport positions add param `%s`", position)
|
||||||
err = errors.New(errmsg)
|
err = errors.New(errmsg)
|
||||||
|
@ -13,6 +13,7 @@ type RpcRequest struct {
|
|||||||
|
|
||||||
func (request *RpcRequest) init() {
|
func (request *RpcRequest) init() {
|
||||||
request.baseRequest = defaultBaseRequest()
|
request.baseRequest = defaultBaseRequest()
|
||||||
|
request.baseRequest.AddHeaderParam("Content-Type", Form)
|
||||||
request.Method = POST
|
request.Method = POST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ type StreamRequest struct {
|
|||||||
|
|
||||||
func (s *StreamRequest) init() {
|
func (s *StreamRequest) init() {
|
||||||
s.baseRequest = defaultBaseRequest()
|
s.baseRequest = defaultBaseRequest()
|
||||||
s.baseRequest.AddHeaderParam("Content-Type", "application/form-data")
|
s.baseRequest.AddHeaderParam("Content-Type", FormData)
|
||||||
s.Method = POST
|
s.Method = POST
|
||||||
}
|
}
|
||||||
|
|
||||||
|
42
services/capk/client.go
Normal file
42
services/capk/client.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
package capk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VERSION = "2024-10-30"
|
||||||
|
)
|
||||||
|
|
||||||
|
var HOST requests.Host = requests.Host{
|
||||||
|
Default: "capk.gaore.com",
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
sdk.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClient() (client *Client, err error) {
|
||||||
|
client = new(Client)
|
||||||
|
err = client.Init()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) TaskCreate(req *TaskCreateRequest) (resp *TaskCreateResponse, err error) {
|
||||||
|
resp = CreateTaskCreateResponse()
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) ConfigModify(req *ConfigModifyRequest) (resp *ConfigModifyResponse, err error) {
|
||||||
|
resp = CreateConfigModifyResponse()
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) ConfigGet(req *ConfigGetRequest) (resp *ConfigGetResponse, err error) {
|
||||||
|
resp = CreateConfigGetResponse()
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
return
|
||||||
|
}
|
39
services/capk/client_test.go
Normal file
39
services/capk/client_test.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package capk
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestTask_Create(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
req := CreateTaskCreateRequest()
|
||||||
|
req.GameId = 7788
|
||||||
|
req.GameVersion = "1.0.1"
|
||||||
|
req.Config = "{\"data\":{\"sdkPath\":\"\",\"localPath\":\"\",\"plugins\":{\"addictioncheck\":\"\",\"msaid\":\"\",\"bugly\":\"\",\"gdt\":\"\",\"gdt_channel\":\"\"},\"decompileApk\":\"\"},\"game\":{\"appID\":\"7477\",\"appName\":\"xyxmz_xlhh_ylh\",\"appKey\":\"yWpx3hWQHFhSnTCj#7477#6KuRKuaAjLJ5sYRy\",\"appDescNew\":\"西游仙魔传\",\"orientation\":\"landscape\",\"cpuSupport\":\"armeabi-v7a|arm64-v8a\",\"minSdkVersion\":\"21\",\"targetSdkVersion\":\"31\",\"outputApkName\":\"{appName}_{appID}_{versionCode}_{versionName}_{time}.apk\",\"gameCategory\":\"25|771-2.0.4.3\",\"icon\":\"\",\"logoPath\":\"\",\"loadingPath\":\"\",\"certificatePath\":\"\"},\"channel\":{\"id\":\"1\",\"name\":\"gaore\",\"sdk\":\"gaore\",\"desc\":\"GRSDK\",\"suffix\":\"com.bjhr.xyxmz\",\"splash\":\"0\",\"splash_copy_to_unity\":\"0\",\"sdkParams\":{\"SCREEN_ORIENTATION\":\"0\",\"GAORE_CHANNELID\":\"1\",\"GAORE_VERSION_TAG\":\"1\",\"GAORE_LOGO_SHOW\":\"1\",\"GAORE_CHANNEL_KEY\":\"GRSDK\",\"GAORE_GAME_VERSION\":\"1.0.0\",\"GAORE_APPLICATION_PROXY_NAME\":\"com.gr.sdk.GaoreApplication,com.gr.sdk.MSAApplication,com.gr.sdk.addictioncheck.application.GaoreApplication,com.gr.sdk.BuglyProxyApplication,com.gr.sdk.GDTProxyApplication,com.gr.sdk.GDTChannelProxyApplication\",\"GAORE_WX_APP_ID\":\"\",\"GAORE_FLOAT_POSITION\":\"0|30\",\"GAORE_ROUND_ICON\":\"0\",\"GAORE_ROUND_ICON_PATH\":\"\",\"GAORE_ROUND_ICON_FOREGROUND_PATH\":\"\",\"GAORE_ROUND_ICON_BACKGROUND_PATH\":\"\",\"GR_AGEWARN\":\"true\",\"GR_REDPACKET\":\"1\",\"GR_REDPACKET_GUIDE\":\"1\",\"GAORE_INIT_SDK_TYPE\":\"2\",\"appkey_avscan\":\"\",\"seckey_avscan\":\"\",\"GDT_USER_ACTION_SET_ID\":\"1203968086\",\"GDT_APP_SECRET_KEY\":\"8ad271167be3dcf120468770a4ee9b21\",\"GISM_APPID\":\"\",\"GISM_APPNAME\":\"\",\"QL_APPID\":\"\",\"KUAISHOU_APPID\":\"\",\"KUAISHOU_APPNAME\":\"\",\"TOUTIAO_AID\":\"\",\"addPermissionActivity\":\"1\",\"VIVO_SRC_ID\":\"\"},\"sdkVersion\":{\"versionName\":\"2.6.1\"},\"plugins\":{\"addictioncheck\":\"\",\"msaid\":\"\",\"bugly\":\"\",\"gdt\":\"\",\"gdt_channel\":\"\"}}}"
|
||||||
|
req.Env = 0 // 灰度为 1 正式为0
|
||||||
|
resp, err := client.TaskCreate(req)
|
||||||
|
t.Logf("%v", resp.Data.TaskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestConfig_Modify(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
req := CreateConfigModifyRequest()
|
||||||
|
req.Content = []byte(`<?xml version='1.0' encoding='UTF-8'?><xml><apks><!-- name:母包文件名 --><!-- screen:屏幕方向 0竖屏 1横屏 --><!-- targetSdk:targetSdkVersion支持30以上 0否 1是 --><apk><param name="id" value="1" /><param name="name" value="heji" /><param name="desc" value="合击" /><param name="screen" value="1" /><param name="targetSdk" value="0" /></apk><apk><param name="id" value="2" /><param name="name" value="lanyue" /><param name="desc" value="蓝月" /><param name="screen" value="1" /><param name="targetSdk" value="0" /></apk></apks></xmls>`)
|
||||||
|
resp, err := client.ConfigModify(req)
|
||||||
|
t.Log(resp.Code, resp.Msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestConfig_Get(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
req := CreateConfigGetRequest()
|
||||||
|
resp, err := client.ConfigGet(req)
|
||||||
|
t.Log(resp.Code, resp.Data)
|
||||||
|
}
|
34
services/capk/config_get.go
Normal file
34
services/capk/config_get.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
package capk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ConfigGetRequest struct {
|
||||||
|
*requests.JsonRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConfigGetResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data string `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateConfigGetRequest() *ConfigGetRequest {
|
||||||
|
req := &ConfigGetRequest{
|
||||||
|
JsonRequest: &requests.JsonRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/pack/config/get")
|
||||||
|
req.Method = requests.GET
|
||||||
|
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateConfigGetResponse() *ConfigGetResponse {
|
||||||
|
return &ConfigGetResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
33
services/capk/config_modify.go
Normal file
33
services/capk/config_modify.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package capk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ConfigModifyRequest struct {
|
||||||
|
*requests.StreamRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConfigModifyResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data string `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateConfigModifyRequest() (req *ConfigModifyRequest) {
|
||||||
|
req = &ConfigModifyRequest{
|
||||||
|
StreamRequest: &requests.StreamRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/pack/config/set")
|
||||||
|
req.Method = requests.POST
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateConfigModifyResponse() (resp *ConfigModifyResponse) {
|
||||||
|
return &ConfigModifyResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
38
services/capk/task_create.go
Normal file
38
services/capk/task_create.go
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package capk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TaskCreateRequest struct {
|
||||||
|
*requests.JsonRequest
|
||||||
|
GameId int `position:"Json" field:"game_id"`
|
||||||
|
GameVersion string `position:"Json" field:"game_version"`
|
||||||
|
Config string `position:"Json" field:"config"`
|
||||||
|
Env int `position:"Json" field:"env"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type TaskCreateResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data struct {
|
||||||
|
TaskId string `json:"task_id"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateTaskCreateRequest() (req *TaskCreateRequest) {
|
||||||
|
req = &TaskCreateRequest{
|
||||||
|
JsonRequest: &requests.JsonRequest{},
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/pack/task/create")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateTaskCreateResponse() (resp *TaskCreateResponse) {
|
||||||
|
resp = &TaskCreateResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
31
services/center-api/client.go
Normal file
31
services/center-api/client.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package center_api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
VERSION = "2020-11-16"
|
||||||
|
)
|
||||||
|
|
||||||
|
var HOST = requests.Host{
|
||||||
|
Default: "center-api",
|
||||||
|
}
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
sdk.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewClient() (client *Client, err error) {
|
||||||
|
client = new(Client)
|
||||||
|
err = client.Init()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// PackagingTaskCallback 打包任务回调
|
||||||
|
func (c *Client) PackagingTaskCallback(req *PackagingTaskCallbackReq) (resp *PackagingTaskCallbackResp, err error) {
|
||||||
|
resp = CreatePackagingTaskCallbackResp()
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
return
|
||||||
|
}
|
28
services/center-api/client_test.go
Normal file
28
services/center-api/client_test.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package center_api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPackagingTaskCallback(t *testing.T) {
|
||||||
|
client, err := NewClient()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
req := CreatePackagingTaskCallbackReq(Data{
|
||||||
|
TaskId: "asdada120",
|
||||||
|
Status: 1,
|
||||||
|
Msg: "test",
|
||||||
|
Url: "http://www.baidu.com",
|
||||||
|
Md5: "adadsadasdasda",
|
||||||
|
})
|
||||||
|
|
||||||
|
resp, err := client.PackagingTaskCallback(req)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(resp.StatusCode, resp.StatusMsg)
|
||||||
|
}
|
64
services/center-api/packaging.go
Normal file
64
services/center-api/packaging.go
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package center_api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/md5"
|
||||||
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type PackagingTaskCallbackReq struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
TaskId string `position:"Body" field:"task_id"`
|
||||||
|
Status int `position:"Body" field:"status"`
|
||||||
|
Msg string `position:"Body" field:"msg"`
|
||||||
|
Url string `position:"Body" field:"url"`
|
||||||
|
Md5 string `position:"Body" field:"md5"`
|
||||||
|
Sign string `position:"Body" field:"sign"`
|
||||||
|
Ts int64 `position:"Body" field:"ts"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PackagingTaskCallbackResp struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
StatusCode int `json:"status_code"`
|
||||||
|
StatusMsg string `json:"status_msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Data struct {
|
||||||
|
TaskId string `json:"task_id"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Url string `json:"url"`
|
||||||
|
Md5 string `json:"md5"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreatePackagingTaskCallbackReq(data Data) *PackagingTaskCallbackReq {
|
||||||
|
req := &PackagingTaskCallbackReq{
|
||||||
|
RpcRequest: &requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.TaskId = data.TaskId
|
||||||
|
req.Status = data.Status
|
||||||
|
req.Msg = data.Msg
|
||||||
|
req.Url = data.Url
|
||||||
|
req.Md5 = data.Md5
|
||||||
|
req.Ts = 1730357662
|
||||||
|
|
||||||
|
// sign=md5(ts+task_id+sign_key) 32位
|
||||||
|
// 生成 MD5 哈希
|
||||||
|
hash := md5.Sum([]byte(fmt.Sprintf("%d%s%s", req.Ts, req.TaskId, "xBPVBJ132asdUeJC3XjD7AnFWD2sbGH6pJC4654y89")))
|
||||||
|
|
||||||
|
// 将哈希结果转换为十六进制字符串
|
||||||
|
hashString := hex.EncodeToString(hash[:])
|
||||||
|
req.Sign = hashString
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/v1/packaging/task/callback")
|
||||||
|
req.Method = requests.POST
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreatePackagingTaskCallbackResp() *PackagingTaskCallbackResp {
|
||||||
|
return &PackagingTaskCallbackResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
@ -3,11 +3,12 @@ package oss
|
|||||||
import (
|
import (
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GetApkVersionRequest struct {
|
type GetApkVersionRequest struct {
|
||||||
*requests.JsonRequest
|
*requests.JsonRequest
|
||||||
Filepath string `position:"Body" field:"filepath"`
|
Filepath string `position:"Json" field:"filepath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetApkVersionResponse struct {
|
type GetApkVersionResponse struct {
|
||||||
@ -17,6 +18,8 @@ type GetApkVersionResponse struct {
|
|||||||
Data struct {
|
Data struct {
|
||||||
VersionCode string `json:"versionCode"`
|
VersionCode string `json:"versionCode"`
|
||||||
VersionName string `json:"versionName"`
|
VersionName string `json:"versionName"`
|
||||||
|
MinSdkVersion string `json:"minSdkVersion"`
|
||||||
|
TargetSdkVersion string `json:"targetSdkVersion"`
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +29,7 @@ func CreateGetApkVersionRequest() (req *GetApkVersionRequest) {
|
|||||||
}
|
}
|
||||||
req.InitWithApiInfo(HOST, VERSION, "/api/apk/version")
|
req.InitWithApiInfo(HOST, VERSION, "/api/apk/version")
|
||||||
req.Method = requests.POST
|
req.Method = requests.POST
|
||||||
|
req.SetReadTimeout(30 * time.Second)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +43,16 @@ func TestUpload_Del(t *testing.T) {
|
|||||||
|
|
||||||
func TestCreateInitMultipartUpload(t *testing.T) {
|
func TestCreateInitMultipartUpload(t *testing.T) {
|
||||||
req := CreateInitMultipartUploadRequest()
|
req := CreateInitMultipartUploadRequest()
|
||||||
req.Filepath = "test.jpg"
|
|
||||||
|
extInfo := map[string]any{"game_byname": "tech_test_tencent"}
|
||||||
|
bExtInfo, _ := json.Marshal(extInfo)
|
||||||
|
|
||||||
|
req.UploadType = "package"
|
||||||
req.TargetType = "oss"
|
req.TargetType = "oss"
|
||||||
req.TargetName = "image"
|
req.TargetName = "image"
|
||||||
req.FileHash = "51c68615b8d21f9b72b02f48c400cb87"
|
req.FileHash = "51c68615b8d21f9b72b02f48c400cb87"
|
||||||
|
req.Filepath = "q5-01.zip"
|
||||||
|
req.ExtInfo = string(bExtInfo)
|
||||||
client, err := NewClient()
|
client, err := NewClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
@ -66,7 +72,7 @@ func TestCreateInitMultipartUpload(t *testing.T) {
|
|||||||
|
|
||||||
func TestClient_GetApkVersion(t *testing.T) {
|
func TestClient_GetApkVersion(t *testing.T) {
|
||||||
req := CreateGetApkVersionRequest()
|
req := CreateGetApkVersionRequest()
|
||||||
req.Filepath = "36c55c4c3a2f4c79e3917b989d580496.zip"
|
req.Filepath = "uploads/files/package/1f57ac9693f0593fc9073f366b1c1936.zip"
|
||||||
client, err := NewClient()
|
client, err := NewClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
@ -15,10 +15,12 @@ const (
|
|||||||
|
|
||||||
type InitMultipartUploadRequest struct {
|
type InitMultipartUploadRequest struct {
|
||||||
*requests.JsonRequest
|
*requests.JsonRequest
|
||||||
Filepath string `position:"Body" field:"filepath"`
|
UploadType string `position:"Json" field:"upload_type"`
|
||||||
TargetType string `position:"Body" field:"target_type"`
|
TargetType string `position:"Json" field:"target_type"`
|
||||||
TargetName string `position:"Body" field:"target_name"`
|
TargetName string `position:"Json" field:"target_name"`
|
||||||
FileHash string `position:"Body" field:"file_hash"`
|
FileHash string `position:"Json" field:"file_hash"`
|
||||||
|
Filepath string `position:"Json" field:"filepath"`
|
||||||
|
ExtInfo string `position:"Json" field:"ext_info"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type InitMultipartUploadResponse struct {
|
type InitMultipartUploadResponse struct {
|
||||||
@ -50,7 +52,7 @@ func CreateInitMultipartUploadRequest() (req *InitMultipartUploadRequest) {
|
|||||||
JsonRequest: &requests.JsonRequest{},
|
JsonRequest: &requests.JsonRequest{},
|
||||||
}
|
}
|
||||||
|
|
||||||
req.InitWithApiInfo(HOST, VERSION, "/api/upload/multipart/init?ts="+ts+"&sign="+sign)
|
req.InitWithApiInfo(HOST, VERSION, "/api/upload/multipart/init?_ts="+ts+"&_sign="+sign)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
type DelOssRequest struct {
|
type DelOssRequest struct {
|
||||||
*requests.JsonRequest
|
*requests.JsonRequest
|
||||||
BucketName string `position:"Body" field:"bucket_name" default:"image"`
|
BucketName string `position:"Json" field:"bucket_name" default:"image"`
|
||||||
MediaUrl string `position:"Body" field:"url" default:"-"`
|
MediaUrl string `position:"Json" field:"url" default:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DelOssResponse struct {
|
type DelOssResponse struct {
|
||||||
|
@ -10,12 +10,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var HOST requests.Host = requests.Host{
|
var HOST requests.Host = requests.Host{
|
||||||
Default: "pay.gaore.com",
|
Default: "pay.api.gaore.com",
|
||||||
Func: func(s string) string {
|
Func: func(s string) string {
|
||||||
var a = map[string]string{
|
var a = map[string]string{
|
||||||
requests.RELEASE: "pay.gaore.com",
|
requests.RELEASE: "pay.api.gaore.com",
|
||||||
requests.PRE: "pay.gaore.com",
|
requests.PRE: "pay.api.gaore.com",
|
||||||
requests.TEST: "pay.gaore.com",
|
requests.TEST: "pay.api.gaore.com",
|
||||||
}
|
}
|
||||||
return a[s]
|
return a[s]
|
||||||
},
|
},
|
||||||
@ -49,8 +49,8 @@ func (c *Client) ComplaintUpload(req *ComplaintUploadRequest) (response *Complai
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ComplaintNotifyUrl(req *ComplaintNotifyUrlRequest) (response *ComplaintNotifyUrlResponse, err error) {
|
func (c *Client) MerchantConfigDebug(req *merchantConfigDebugRequest) (response *merchantConfigDebugResponse, err error) {
|
||||||
response = CreateComplaintNotifyUrlResponse()
|
response = CreateMerchantConfigDebugResponse()
|
||||||
err = c.DoAction(req, response)
|
err = c.DoAction(req, response)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
package pay
|
|
||||||
|
|
||||||
import (
|
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ComplaintNotifyUrlRequest struct {
|
|
||||||
*requests.RpcRequest
|
|
||||||
MchId string `position:"Body" field:"mch_id" default:"" `
|
|
||||||
NotifyUrl string `position:"Body" field:"notify_url" default:"" `
|
|
||||||
Type int `position:"Body" field:"type" default:""`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ComplaintNotifyUrlResponse struct {
|
|
||||||
*responses.BaseResponse
|
|
||||||
Code int `json:"code"`
|
|
||||||
Msg string `json:"msg"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateComplaintNotifyUrlRequest() (req *ComplaintNotifyUrlRequest) {
|
|
||||||
req = &ComplaintNotifyUrlRequest{
|
|
||||||
RpcRequest: &requests.RpcRequest{},
|
|
||||||
}
|
|
||||||
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/createWxNotifyUrl")
|
|
||||||
req.Method = requests.POST
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateComplaintNotifyUrlResponse() (response *ComplaintNotifyUrlResponse) {
|
|
||||||
response = &ComplaintNotifyUrlResponse{
|
|
||||||
BaseResponse: &responses.BaseResponse{},
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
33
services/pay/merchant_config_debug.go
Normal file
33
services/pay/merchant_config_debug.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package pay
|
||||||
|
|
||||||
|
import (
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
type merchantConfigDebugRequest struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
MchId string `position:"Body" field:"mch_id" default:"" `
|
||||||
|
}
|
||||||
|
|
||||||
|
type merchantConfigDebugResponse struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateMerchantConfigDebugRequest() (req *merchantConfigDebugRequest) {
|
||||||
|
req = &merchantConfigDebugRequest{
|
||||||
|
RpcRequest: &requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/configDebug")
|
||||||
|
req.Method = requests.POST
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateMerchantConfigDebugResponse() (response *merchantConfigDebugResponse) {
|
||||||
|
response = &merchantConfigDebugResponse{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user