7
0

Compare commits

..

No commits in common. "master" and "v1.1.15" have entirely different histories.

45 changed files with 55 additions and 1628 deletions

3
go.mod
View File

@ -1,3 +0,0 @@
module golib.gaore.com/GaoreGo/gaore-common-sdk-go
go 1.19

View File

@ -83,10 +83,6 @@ func (client *Client) InitClientConfig() (config *Config) {
} }
func (client *Client) Init() (err error) {
return client.InitWithAccessKey("", "", "")
}
func (client *Client) InitWithAccessKey(accessKeyId, accessKeySecret, accessKeyFrom string) (err error) { func (client *Client) InitWithAccessKey(accessKeyId, accessKeySecret, accessKeyFrom string) (err error) {
config := client.InitWithConfig() config := client.InitWithConfig()
credential := &credentials.BaseCredential{ credential := &credentials.BaseCredential{

View File

@ -1,71 +0,0 @@
package requests
import (
"bytes"
"encoding/json"
"fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils"
"io"
"strings"
)
type JsonRequest struct {
*baseRequest
}
func (request *JsonRequest) init() {
request.baseRequest = defaultBaseRequest()
request.baseRequest.AddHeaderParam("Content-Type", Json)
request.Method = POST
}
func (request *JsonRequest) BuildUrl() string {
var hostname string
if request.Domain.Func == nil {
hostname = request.Domain.Default
} else if hostname = request.Domain.Func(request.GetEnv()); hostname == "" {
hostname = request.Domain.Default
}
url := fmt.Sprintf("%s://%s", strings.ToLower(request.Scheme), hostname)
if len(request.Port) > 0 {
url = fmt.Sprintf("%s:%s", url, request.Port)
}
return url + request.BuildQueries()
}
func (request *JsonRequest) GetStyle() string {
return STREAM
}
func (request *JsonRequest) BuildQueries() string {
path := strings.TrimLeft(strings.TrimSpace(request.GetActionName()), "/")
mod := "&"
if !strings.Contains(path, "?") {
mod = "?"
}
request.queries = "/" + path + mod + utils.GetUrlFormedMap(request.QueryParams)
return request.queries
}
func (request *JsonRequest) GetActionName() string {
return request.actionName
}
func (request *JsonRequest) InitWithApiInfo(domain Host, version, urlPath string) {
request.init()
request.SetDomain(domain)
request.version = version
request.actionName = urlPath
}
func (request *JsonRequest) GetBodyReader() io.Reader {
if request.JsonParams != nil && len(request.JsonParams) > 0 {
body, err := json.Marshal(request.JsonParams)
if err == nil {
return bytes.NewReader(body)
}
}
return strings.NewReader("")
}

View File

@ -14,7 +14,6 @@ import (
const ( const (
RPC = "RPC" RPC = "RPC"
ROA = "ROA" ROA = "ROA"
STREAM = "STREAM"
HTTP = "HTTP" HTTP = "HTTP"
HTTPS = "HTTPS" HTTPS = "HTTPS"
@ -36,12 +35,10 @@ 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"
@ -97,7 +94,6 @@ 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 {
@ -121,7 +117,6 @@ 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
@ -234,10 +229,6 @@ 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,
@ -250,7 +241,6 @@ 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
} }
@ -299,14 +289,14 @@ func flatRepeatedList(reflectValue reflect.Value, request AcsRequest, position s
value = fieldDefault value = fieldDefault
} }
err = addParam(request, fieldPosition, name, value, reflectValue.Field(i).Interface()) err = addParam(request, fieldPosition, name, value)
} }
} }
return return
} }
func addParam(request AcsRequest, position, key, value string, vAny any) (err error) { func addParam(request AcsRequest, position, key, value string) (err error) {
if len(value) > 0 { if len(value) > 0 {
switch position { switch position {
case Header: case Header:
@ -315,8 +305,6 @@ func addParam(request AcsRequest, position, key, value string, vAny any) (err er
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)

View File

@ -13,7 +13,6 @@ 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
} }

View File

@ -1,55 +0,0 @@
package requests
import (
"bytes"
"fmt"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils"
"io"
"strings"
)
type StreamRequest struct {
*baseRequest
}
func (s *StreamRequest) init() {
s.baseRequest = defaultBaseRequest()
s.baseRequest.AddHeaderParam("Content-Type", FormData)
s.Method = POST
}
func (s *StreamRequest) GetStyle() string {
return STREAM
}
func (s *StreamRequest) InitWithApiInfo(domain Host, version, urlPath string) {
s.init()
s.SetDomain(domain)
s.version = version
s.actionName = urlPath
}
func (s *StreamRequest) BuildUrl() string {
var hostname string
if s.Domain.Func == nil {
hostname = s.Domain.Default
} else if hostname = s.Domain.Func(s.GetEnv()); hostname == "" {
hostname = s.Domain.Default
}
url := fmt.Sprintf("%s://%s", strings.ToLower(s.Scheme), hostname)
if len(s.Port) > 0 {
url = fmt.Sprintf("%s:%s", url, s.Port)
}
return url + s.BuildQueries()
}
func (s *StreamRequest) BuildQueries() string {
path := strings.TrimLeft(strings.TrimSpace(s.GetActionName()), "/")
s.queries = "/" + path + "?" + utils.GetUrlFormedMap(s.QueryParams)
return s.queries
}
func (s *StreamRequest) GetBodyReader() io.Reader {
return bytes.NewReader(s.Content)
}

View File

@ -15,7 +15,6 @@ type SearchApkRequest struct {
Ver string `position:"Body" field:"ver" default:"" ` Ver string `position:"Body" field:"ver" default:"" `
SiteId int `position:"Body" field:"siteId" default:"" ` SiteId int `position:"Body" field:"siteId" default:"" `
AgentId int `position:"Body" field:"agentId" default:"" ` AgentId int `position:"Body" field:"agentId" default:"" `
Top int `position:"Body" field:"top" default:"" `
GameIds string `position:"Body" field:"gameIds" default:"" ` GameIds string `position:"Body" field:"gameIds" default:"" `
Autor string `position:"Body" field:"autor" default:"" ` Autor string `position:"Body" field:"autor" default:"" `
Page int `position:"Body" field:"page" default:"1" ` Page int `position:"Body" field:"page" default:"1" `
@ -40,7 +39,6 @@ type ApkLog struct {
AliOss int `json:"AliOss"` AliOss int `json:"AliOss"`
NeedCdn bool `json:"NeedCdn"` NeedCdn bool `json:"NeedCdn"`
Autor string `json:"Autor"` Autor string `json:"Autor"`
Ext string `json:"Ext"`
IsAugment bool `json:"IsAugment"` IsAugment bool `json:"IsAugment"`
} }

View File

@ -1,48 +0,0 @@
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() {
}
// 上报付费
// 上报注册

View File

@ -1,49 +0,0 @@
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
}

View File

@ -1,42 +0,0 @@
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
}

View File

@ -1,39 +0,0 @@
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横屏 --><!-- targetSdktargetSdkVersion支持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)
}

View File

@ -1,34 +0,0 @@
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{},
}
}

View File

@ -1,33 +0,0 @@
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{},
}
}

View File

@ -1,38 +0,0 @@
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
}

View File

@ -1,31 +0,0 @@
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
}

View File

@ -1,28 +0,0 @@
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)
}

View File

@ -1,64 +0,0 @@
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{},
}
}

View File

@ -1,31 +0,0 @@
package game
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: "game",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
// GetGameOsInfo 获取游戏系统信息
func (c *Client) GetGameOsInfo(req *GetGameOsInfoReq) (resp *GetGameOsInfoResp, err error) {
resp = CreateGetGameOsInfoResp()
err = c.DoAction(req, resp)
return
}

View File

@ -1,22 +0,0 @@
package game
import (
"fmt"
"testing"
)
func TestGetGameOsInfo(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateGetGameOsInfoReq()
resp, err := client.GetGameOsInfo(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data.OsList, resp.Data.OsRelList2)
}

View File

@ -1,49 +0,0 @@
package game
import (
"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{},
}
}

View File

@ -35,6 +35,12 @@ func (c *Client) SendSms(req *SendSmsRequest) (response *SendSmsResponse, err er
return 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) { func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) {
client = &Client{} client = &Client{}
err = client.InitWithAccessKey(accesskey, secrect, source) err = client.InitWithAccessKey(accesskey, secrect, source)

View File

@ -0,0 +1,37 @@
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{},
}
}

View File

@ -29,15 +29,3 @@ func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client,
err = client.InitWithAccessKey(accesskey, secrect, source) err = client.InitWithAccessKey(accesskey, secrect, source)
return return
} }
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
func (c *Client) SubjectList(req *SubjectListRequest) (response *SubjectListResponse, err error) {
response = CreateSubjectListResponse()
err = c.DoAction(req, response)
return
}

View File

@ -1,22 +0,0 @@
package mkt
import (
"fmt"
"testing"
)
func TestSubjectList(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateSubjectListRequest(0)
req.Port = "9090"
list, err := client.SubjectList(req)
if err != nil {
panic(err)
}
fmt.Println(list.Status, list.Code, list.Msg, list.Data)
}

View File

@ -1,68 +0,0 @@
package mkt
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"
"time"
)
const appKey = "fc1f841#@de!!08"
type SubjectListRequest struct {
*requests.RpcRequest
}
type SubjectListResponse struct {
*responses.BaseResponse
Status bool `json:"status"`
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
List map[int]Data `json:"list"`
} `json:"data"`
}
type Data struct {
Abbr string `json:"abbr"`
AbbrSign string `json:"abbr_sign"`
Id int `json:"id"`
Name string `json:"name"`
State int `json:"state"`
System string `json:"system"`
Type int `json:"type"`
}
// CreateSubjectListRequest 公司列表请求
func CreateSubjectListRequest(state int) (req *SubjectListRequest) {
ts := time.Now().Unix()
hash := md5.New()
hash.Write([]byte(fmt.Sprintf("%v%v", ts, appKey)))
hashBytes := hash.Sum(nil)
token := hex.EncodeToString(hashBytes)
req = &SubjectListRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, fmt.Sprintf("/api/subject/list"))
req.FormParams = map[string]string{
"token": token,
"ts": fmt.Sprintf("%v", ts),
"state": fmt.Sprintf("%v", state),
}
req.Method = requests.POST
return
}
// CreateSubjectListResponse 公司列表请求响应
func CreateSubjectListResponse() (response *SubjectListResponse) {
response = &SubjectListResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -1,38 +0,0 @@
package oss
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type GetApkVersionRequest struct {
*requests.JsonRequest
Filepath string `position:"Json" field:"filepath"`
}
type GetApkVersionResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
VersionCode string `json:"versionCode"`
VersionName string `json:"versionName"`
MinSdkVersion string `json:"minSdkVersion"`
TargetSdkVersion string `json:"targetSdkVersion"`
} `json:"data"`
}
func CreateGetApkVersionRequest() (req *GetApkVersionRequest) {
req = &GetApkVersionRequest{
JsonRequest: &requests.JsonRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/apk/version")
req.Method = requests.POST
return
}
func CreateGetApkVersionResponse() *GetApkVersionResponse {
return &GetApkVersionResponse{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -1,65 +0,0 @@
package oss
import (
"errors"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth/credentials"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "2024-05-30"
)
var HOST = requests.Host{
Default: "oss.gaore.com",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
func NewClientWithSts() {
}
func (c *Client) PutOss(req *PutOssRequest) (resp *PutOssResponse, err error) {
if req.BucketName == "" {
err = errors.New("bucket name is empty")
return
}
if req.FileStream == nil {
err = errors.New("stream is empty")
return
}
req.SetContent(req.FileStream)
resp = CreatePutOssResponse()
err = c.DoAction(req, resp)
return
}
func (c *Client) DelOss(req *DelOssRequest) (resp *DelOssResponse, err error) {
resp = CreateDelOssResponse()
err = c.DoAction(req, resp)
return
}
func (c *Client) InitMultipartUpload(req *InitMultipartUploadRequest) (resp *InitMultipartUploadResponse, err error) {
resp = CreateInitMultipartUploadResponse()
err = c.DoAction(req, resp)
return
}
func (c *Client) GetApkVersion(req *GetApkVersionRequest) (resp *GetApkVersionResponse, err error) {
resp = CreateGetApkVersionResponse()
sign, err := auth.NewSignerWithCredential(credentials.NewStsTokenCredential("", "ccc", ""), nil)
err = c.DoActionWithSigner(req, resp, sign)
return
}

View File

@ -1,87 +0,0 @@
package oss
import (
"encoding/json"
"os"
"testing"
)
func TestUpload_Put(t *testing.T) {
req := CreatePutOssRequest()
req.BucketName = "image"
file, err := os.ReadFile("test.jpg")
if err != nil {
t.Error(err)
return
}
req.FileStream = file
client, err := NewClient()
resp, err := client.PutOss(req)
if err != nil {
t.Error(err)
return
}
t.Log(resp.Data.Url)
}
func TestUpload_Del(t *testing.T) {
req := CreateDelOssRequest()
req.BucketName = "image"
req.MediaUrl = "https://image.89yoo.com/uploads/549/549e887460a72333c361661683023018.jpeg"
client, err := NewClient()
if err != nil {
t.Error(err)
return
}
resp, err := client.DelOss(req)
if err != nil {
t.Error(err)
return
}
t.Log(resp.Code)
}
func TestCreateInitMultipartUpload(t *testing.T) {
req := CreateInitMultipartUploadRequest()
extInfo := map[string]any{"game_byname": "tech_test_tencent"}
bExtInfo, _ := json.Marshal(extInfo)
req.UploadType = "package"
req.TargetType = "oss"
req.TargetName = "image"
req.FileHash = "51c68615b8d21f9b72b02f48c400cb87"
req.Filepath = "q5-01.zip"
req.ExtInfo = string(bExtInfo)
client, err := NewClient()
if err != nil {
t.Error(err)
return
}
resp, err := client.InitMultipartUpload(req)
if err != nil {
t.Error(err)
return
}
r, err := json.Marshal(resp)
if err != nil {
return
}
t.Log(string(r))
}
func TestClient_GetApkVersion(t *testing.T) {
req := CreateGetApkVersionRequest()
req.Filepath = "51c68615b8d21f9b72b02f48c400cb87.zip"
client, err := NewClient()
if err != nil {
t.Error(err)
return
}
resp, err := client.GetApkVersion(req)
if err != nil {
t.Error(err)
return
}
t.Log(resp.Data.VersionCode, resp.Data.VersionName)
}

View File

@ -1,64 +0,0 @@
package oss
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"
"time"
)
const (
multipartUploadKeys = "b4471b940d98"
)
type InitMultipartUploadRequest struct {
*requests.JsonRequest
UploadType string `position:"Json" field:"upload_type"`
TargetType string `position:"Json" field:"target_type"`
TargetName string `position:"Json" field:"target_name"`
FileHash string `position:"Json" field:"file_hash"`
Filepath string `position:"Json" field:"filepath"`
ExtInfo string `position:"Json" field:"ext_info"`
}
type InitMultipartUploadResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
FileUploaded bool `json:"file_uploaded"`
UploadId string `json:"upload_id,omitempty"`
Links []Link `json:"links,omitempty"`
Hash string `json:"hash,omitempty"`
Url string `json:"url,omitempty"`
Filepath string `json:"filepath,omitempty"`
FileName string `json:"filename,omitempty"`
} `json:"data"`
}
type Link struct {
Href string `json:"href"`
Rel string `json:"rel"`
Method string `json:"method"`
}
func CreateInitMultipartUploadRequest() (req *InitMultipartUploadRequest) {
ts := fmt.Sprintf("%d", time.Now().Unix())
m := md5.Sum([]byte(ts + multipartUploadKeys))
sign := hex.EncodeToString(m[:])
req = &InitMultipartUploadRequest{
JsonRequest: &requests.JsonRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/upload/multipart/init?_ts="+ts+"&_sign="+sign)
return
}
func CreateInitMultipartUploadResponse() (resp *InitMultipartUploadResponse) {
resp = &InitMultipartUploadResponse{
BaseResponse: &responses.BaseResponse{},
}
return resp
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 KiB

View File

@ -1,31 +0,0 @@
package oss
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type DelOssRequest struct {
*requests.JsonRequest
BucketName string `position:"Json" field:"bucket_name" default:"image"`
MediaUrl string `position:"Json" field:"url" default:"-"`
}
type DelOssResponse struct {
*responses.BaseResponse
}
func CreateDelOssRequest() (req *DelOssRequest) {
req = &DelOssRequest{
JsonRequest: &requests.JsonRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/upload/del")
req.Method = requests.POST
return
}
func CreateDelOssResponse() (resp *DelOssResponse) {
return &DelOssResponse{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -1,37 +0,0 @@
package oss
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type PutOssRequest struct {
*requests.StreamRequest
BucketName string `position:"Query" field:"bucket_name" default:"image"`
FileStream []byte
}
type PutOssResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Url string `json:"url"`
}
}
func CreatePutOssRequest() (req *PutOssRequest) {
req = &PutOssRequest{
StreamRequest: &requests.StreamRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "api/upload/put")
req.Method = requests.POST
return
}
func CreatePutOssResponse() (resp *PutOssResponse) {
return &PutOssResponse{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -1,56 +0,0 @@
package pay
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "2024-06-03"
)
var HOST requests.Host = requests.Host{
Default: "pay.api.gaore.com",
Func: func(s string) string {
var a = map[string]string{
requests.RELEASE: "pay.api.gaore.com",
requests.PRE: "pay.api.gaore.com",
requests.TEST: "pay.api.gaore.com",
}
return a[s]
},
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
func (c *Client) ComplaintReply(req *ComplaintReplyRequest) (response *ComplaintReplyResponse, err error) {
response = CreateComplaintReplyResponse()
err = c.DoAction(req, response)
return
}
func (c *Client) ComplaintComplete(req *ComplaintCompleteRequest) (response *ComplaintCompleteResponse, err error) {
response = CreateComplaintCompleteResponse()
err = c.DoAction(req, response)
return
}
func (c *Client) ComplaintUpload(req *ComplaintUploadRequest) (response *ComplaintUploadResponse, err error) {
response = CreateComplaintUploadResponse()
err = c.DoAction(req, response)
return
}
func (c *Client) MerchantConfigDebug(req *merchantConfigDebugRequest) (response *merchantConfigDebugResponse, err error) {
response = CreateMerchantConfigDebugResponse()
err = c.DoAction(req, response)
return
}

View File

@ -1,28 +0,0 @@
package pay
import (
"fmt"
"log"
"testing"
)
func TestClient_GetUserInfo(t *testing.T) {
c, err := NewClient()
if err != nil {
t.Error(err)
}
req := CreateComplaintNotifyUrlRequest()
req.MchId = "3503"
req.NotifyUrl = "https://pay.uu89.com/api/complaint/wxNotify/3503"
req.Type = 1
resp, err := c.ComplaintNotifyUrl(req)
if err != nil {
log.Fatalln(err)
}
fmt.Println(resp.GetHttpContentString())
fmt.Println(resp.GetHttpHeaders())
}

View File

@ -1,34 +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 ComplaintCompleteRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" default:"" `
}
type ComplaintCompleteResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
}
func CreateComplaintCompleteRequest() (req *ComplaintCompleteRequest) {
req = &ComplaintCompleteRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/complete")
req.Method = requests.POST
return
}
func CreateComplaintCompleteResponse() (response *ComplaintCompleteResponse) {
response = &ComplaintCompleteResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -1,36 +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 ComplaintReplyRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" default:"" `
Content string `position:"Body" field:"content" default:"" `
Images string `position:"Body" field:"images" default:"" `
}
type ComplaintReplyResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
}
func CreateComplaintReplyRequest() (req *ComplaintReplyRequest) {
req = &ComplaintReplyRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/reply")
req.Method = requests.POST
return
}
func CreateComplaintReplyResponse() (response *ComplaintReplyResponse) {
response = &ComplaintReplyResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -1,36 +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 ComplaintUploadRequest struct {
*requests.RpcRequest
MchId string `position:"Body" field:"mch_id" default:"" `
ImageUrl string `position:"Body" field:"image_url" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" default:" " `
}
type ComplaintUploadResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data map[string]string `json:"data"`
}
func CreateComplaintUploadRequest() (req *ComplaintUploadRequest) {
req = &ComplaintUploadRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/complaint/imageUpload")
req.Method = requests.POST
return
}
func CreateComplaintUploadResponse() (response *ComplaintUploadResponse) {
response = &ComplaintUploadResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -1,33 +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 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
}

View File

@ -1,35 +0,0 @@
package script
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: "script",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
// OpenGame 同步到游戏中心
func (c *Client) OpenGame(req *OpenGameReq) (resp *OpenGameResp, err error) {
resp = CreateOpenGameResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}

View File

@ -1,21 +0,0 @@
package script
import (
"fmt"
"testing"
)
func TestOpenGame(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateOpenGameReq(7275)
resp, err := client.OpenGame(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg)
}

View File

@ -1,41 +0,0 @@
package script
import (
"encoding/json"
"fmt"
"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
}
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{},
}
req.InitWithApiInfo(HOST, VERSION, "open_game.php?game_id="+fmt.Sprintf("%v", gameId))
req.Method = requests.POST
return req
}
// CreateOpenGameResp 创建同步到游戏中心响应
func CreateOpenGameResp() *OpenGameResp {
return &OpenGameResp{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -1,41 +0,0 @@
package stat
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: "stat",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
// SyncGameServerList 同步开服数据
func (c *Client) SyncGameServerList(req *SyncGameServerListReq) (resp *SyncGameServerListResp, err error) {
resp = CreateSyncGameServerListResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}
func (c *Client) SetUserNewGameAuth(req *SetUserNewGameAuthReq) (resp *SetUserNewGameAuthResp, err error) {
resp = CreateSetUserNewGameAuthResp()
err = c.DoAction(req, resp)
return
}

View File

@ -1,54 +0,0 @@
package stat
import (
"fmt"
"testing"
)
func TestSyncGameServerList(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateSyncGameServerListReq("insertOrUpdate", []map[string]interface{}{
{
"id": 123564,
"channel_id": 12456,
"version_id": 1,
"game_id": 1,
"server_id": 1,
"game_sign": "test",
"name": "test",
"open_date": "2099-03-01",
"open_time": "12:00:00",
"remark": "",
"status": 1,
"if_tj": 1,
},
})
resp, err := client.SyncGameServerList(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Count)
}
func TestClient_SetUserNewGameAuth(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateSetUserNewGameAuthReq(map[string]string{
"game_sign": "qwldy",
"game_id": "7275",
})
resp, err := client.SetUserNewGameAuth(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data.Result)
}

View File

@ -1,62 +0,0 @@
package stat
import (
"encoding/json"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type SyncGameServerListReq struct {
*requests.RpcRequest
}
type SyncGameServerListResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Count int `json:"count"`
}
// CreateSyncGameServerListReq 创建同步开服数据请求
// opt: 更新 insertOrUpdate, 删除 del
//
// data: []map[string]interface{}{
// {
// "id": data.ID,
// "channel_id": data.ChannelID,
// "version_id": data.VersionID,
// "game_id": data.GameID,
// "server_id": data.ServerID,
// "game_sign": data.GameSign,
// "name": data.Name,
// "open_date": data.OpenDate.Format(constants.DateFormat),
// "open_time": data.OpenTime,
// "remark": data.Remark,
// "status": data.Status,
// "if_tj": data.IfTj,
// },
// }
func CreateSyncGameServerListReq(opt string, data []map[string]interface{}) *SyncGameServerListReq {
req := &SyncGameServerListReq{
&requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/game/syncGameServerList")
req.Method = requests.POST
marshal, _ := json.Marshal(data)
req.FormParams = map[string]string{
"opt": opt,
"data": string(marshal),
}
return req
}
// CreateSyncGameServerListResp 创建同步开服数据响应
func CreateSyncGameServerListResp() *SyncGameServerListResp {
return &SyncGameServerListResp{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -1,59 +0,0 @@
package stat
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"
"time"
)
type SetUserNewGameAuthReq struct {
*requests.RpcRequest
}
type SetUserNewGameAuthResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data Data `json:"data"`
}
type Data struct {
Result string `json:"result"`
}
const key = "gr_new_game"
// CreateSetUserNewGameAuthReq 设置用户新游戏授权
func CreateSetUserNewGameAuthReq(data map[string]string) *SetUserNewGameAuthReq {
req := &SetUserNewGameAuthReq{
&requests.RpcRequest{},
}
ts := time.Now().Unix()
hash := md5.New()
hash.Write([]byte(fmt.Sprintf("%v%v", ts, key)))
hashBytes := hash.Sum(nil)
token := hex.EncodeToString(hashBytes)
req.InitWithApiInfo(HOST, VERSION, "/user/setUserNewGameAuth")
req.Method = requests.POST
req.FormParams = data
if req.FormParams == nil {
req.FormParams = make(map[string]string)
}
req.FormParams["sign"] = token
req.FormParams["time"] = fmt.Sprintf("%v", ts)
return req
}
// CreateSetUserNewGameAuthResp 创建设置用户新游戏授权响应
func CreateSetUserNewGameAuthResp() *SetUserNewGameAuthResp {
return &SetUserNewGameAuthResp{
BaseResponse: &responses.BaseResponse{},
}
}