Compare commits
No commits in common. "bee78a0b1233e7675a5b3810a0d3dba983e8b67d" and "14551a66b4dc1ea54045caf5a24e0eb77b3dba02" have entirely different histories.
bee78a0b12
...
14551a66b4
9
go.mod
9
go.mod
@ -1,10 +1,3 @@
|
|||||||
module golib.gaore.com/GaoreGo/gaore-common-sdk-go
|
module golib.gaore.com/GaoreGo/gaore-common-sdk-go
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
require github.com/json-iterator/go v1.1.12
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
|
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
|
||||||
)
|
|
@ -5,7 +5,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/json-iterator/go/extra"
|
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/auth"
|
"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/auth/credentials"
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
@ -19,7 +18,6 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -361,10 +359,3 @@ func (client *Client) getNoProxy(scheme string) []string {
|
|||||||
func hookDo(fn func(req *http.Request) (*http.Response, error)) func(req *http.Request) (*http.Response, error) {
|
func hookDo(fn func(req *http.Request) (*http.Response, error)) func(req *http.Request) (*http.Response, error) {
|
||||||
return fn
|
return fn
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
|
||||||
once := sync.Once{}
|
|
||||||
once.Do(func() {
|
|
||||||
extra.RegisterFuzzyDecoders()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package responses
|
package responses
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/json-iterator/go"
|
|
||||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -97,7 +97,7 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string)
|
|||||||
if contentType, ok := response.GetHttpHeaders()["Content-Type"]; ok {
|
if contentType, ok := response.GetHttpHeaders()["Content-Type"]; ok {
|
||||||
for _, v := range contentType {
|
for _, v := range contentType {
|
||||||
if strings.Contains(v, requests.Json) {
|
if strings.Contains(v, requests.Json) {
|
||||||
jsoniter.Unmarshal(response.GetHttpContentBytes(), response)
|
json.Unmarshal(response.GetHttpContentBytes(), response)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if format != "xml" {
|
if format != "xml" {
|
||||||
err = jsoniter.Unmarshal(response.GetHttpContentBytes(), response)
|
err = json.Unmarshal(response.GetHttpContentBytes(), response)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("json Unmarshal:" + err.Error())
|
return errors.New("json Unmarshal:" + err.Error())
|
||||||
}
|
}
|
||||||
|
@ -1,43 +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 ChannelInfoReq struct {
|
|
||||||
*requests.RpcRequest
|
|
||||||
ChannelId int64 `position:"Body" field:"channelId"`
|
|
||||||
ChannelKey string `position:"Body" field:"channelKey"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ChannelInfoResp struct {
|
|
||||||
*responses.BaseResponse
|
|
||||||
Code int `json:"code"`
|
|
||||||
Msg string `json:"msg"`
|
|
||||||
Data map[int64]struct {
|
|
||||||
Id int64 `json:"id"`
|
|
||||||
PlatKey string `json:"plat_key"`
|
|
||||||
PlatName string `json:"plat_name"`
|
|
||||||
PlatCompany string `json:"plat_company"`
|
|
||||||
PlatUrl string `json:"plat_url"`
|
|
||||||
Company string `json:"company"`
|
|
||||||
PlatCategoryId int64 `json:"plat_category_id"`
|
|
||||||
CategoryName string `json:"category_name"`
|
|
||||||
} `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateChannelInfoReq() *ChannelInfoReq {
|
|
||||||
req := &ChannelInfoReq{
|
|
||||||
RpcRequest: &requests.RpcRequest{},
|
|
||||||
}
|
|
||||||
req.InitWithApiInfo(HOST, VERSION, "/api/channel/getChannelInfo")
|
|
||||||
return req
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateChannelInfoResp() *ChannelInfoResp {
|
|
||||||
resp := &ChannelInfoResp{
|
|
||||||
BaseResponse: &responses.BaseResponse{},
|
|
||||||
}
|
|
||||||
return resp
|
|
||||||
}
|
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VERSION = "2025-04-27"
|
VERSION = "2020-11-16"
|
||||||
)
|
)
|
||||||
|
|
||||||
var HOST = requests.Host{
|
var HOST = requests.Host{
|
||||||
@ -36,9 +36,3 @@ func (c *Client) GetGameInfo(req *GetGameInfoReq) (resp *GetGameInfoResp, err er
|
|||||||
err = c.DoAction(req, resp)
|
err = c.DoAction(req, resp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) GetChannelInfo(req *ChannelInfoReq) (resp *ChannelInfoResp, err error) {
|
|
||||||
resp = CreateChannelInfoResp()
|
|
||||||
err = c.DoAction(req, resp)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@ -32,17 +32,3 @@ func TestGetGameInfo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
fmt.Println(resp.Code, resp.Msg, resp.Data)
|
fmt.Println(resp.Code, resp.Msg, resp.Data)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestChannelInfo(t *testing.T) {
|
|
||||||
client, err := NewClient()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
req := CreateChannelInfoReq()
|
|
||||||
req.ChannelKey = "GRSDK"
|
|
||||||
resp, err := client.GetChannelInfo(req)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
fmt.Println(resp)
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user