Compare commits
No commits in common. "master" and "v1.1.32" have entirely different histories.
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,4 +7,3 @@
|
||||
*.iml
|
||||
out
|
||||
gen
|
||||
.claude
|
||||
|
||||
134
CLAUDE.md
134
CLAUDE.md
@ -1,134 +0,0 @@
|
||||
# CLAUDE.md
|
||||
|
||||
本文件为 Claude Code (claude.ai/code) 在此仓库中工作时提供指引。
|
||||
|
||||
## 常用命令
|
||||
|
||||
```bash
|
||||
# 运行某个 service 的全部测试
|
||||
go test ./services/apk/...
|
||||
|
||||
# 运行单个测试函数
|
||||
go test ./services/apk/... -run TestClient_GetUserInfo -v
|
||||
|
||||
# 编译检查
|
||||
go build ./...
|
||||
```
|
||||
|
||||
## 整体架构
|
||||
|
||||
分两层:
|
||||
|
||||
- `sdk/`:核心框架,处理签名、HTTP 请求、响应解析,不含业务逻辑
|
||||
- `services/<name>/`:各业务服务封装,每个包是一个独立 SDK client
|
||||
|
||||
### sdk/ 核心流程
|
||||
|
||||
```
|
||||
调用方 → Client.DoAction(req, resp)
|
||||
→ auth.Sign(req, signer) # 根据 credential 类型签名
|
||||
→ req.BuildUrl() # RpcRequest 拼接域名+路径+query
|
||||
→ HTTP 请求
|
||||
→ responses.Unmarshal(resp) # JSON 反序列化
|
||||
```
|
||||
|
||||
- `sdk/auth/credentials/`:三种凭证类型(AccessKey、StsToken、AliAppcode)
|
||||
- `sdk/auth/signers/`:对应签名器实现
|
||||
- `sdk/requests/`:`RpcRequest`(主流)和 `RoaRequest` 两种请求风格;字段通过 struct tag `position:"Body|Query|Header"` 和 `field:"xxx"` 声明参数位置
|
||||
- `sdk/config.go`:`Config` 结构体,字段用 `default:"..."` tag 自动初始化
|
||||
|
||||
### services/ 统一模式
|
||||
|
||||
每个服务包含:
|
||||
|
||||
| 文件 | 职责 |
|
||||
|------|------|
|
||||
| `client.go` | 定义 `Client`(内嵌 `sdk.Client`)、`HOST`、`VERSION` 常量,以及所有对外方法 |
|
||||
| `xxx_action.go` | 每个接口一个文件,包含 Request/Response 结构体和两个工厂函数 |
|
||||
|
||||
## 添加新接口的标准步骤
|
||||
|
||||
**1. 新建 `services/<name>/new_action.go`:**
|
||||
|
||||
```go
|
||||
package <name>
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type NewActionRequest struct {
|
||||
*requests.RpcRequest
|
||||
Field1 string `position:"Body" field:"field1" default:""`
|
||||
Field2 int64 `position:"Body" field:"field2"`
|
||||
}
|
||||
|
||||
type NewActionResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
// ...
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateNewActionRequest() *NewActionRequest {
|
||||
req := &NewActionRequest{RpcRequest: &requests.RpcRequest{}}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/path/here")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateNewActionResponse() *NewActionResponse {
|
||||
return &NewActionResponse{BaseResponse: &responses.BaseResponse{}}
|
||||
}
|
||||
```
|
||||
|
||||
**2. 在 `client.go` 添加方法:**
|
||||
|
||||
```go
|
||||
func (c *Client) NewAction(req *NewActionRequest) (response *NewActionResponse, err error) {
|
||||
response = CreateNewActionResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
```
|
||||
|
||||
## HOST 两种写法
|
||||
|
||||
```go
|
||||
// 简单写法(内部服务,hostname 由调用方注入)
|
||||
var HOST = requests.Host{Default: "service-name"}
|
||||
|
||||
// 带环境路由写法(外部服务,各环境域名不同)
|
||||
var HOST = requests.Host{
|
||||
Default: "api.example.com",
|
||||
Func: func(env string) string {
|
||||
return map[string]string{
|
||||
requests.RELEASE: "api.example.com",
|
||||
requests.TEST: "test.api.example.com",
|
||||
}[env]
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
环境常量:`requests.RELEASE`、`requests.PRE`、`requests.TEST`
|
||||
|
||||
## Client 初始化两种模式
|
||||
|
||||
```go
|
||||
// 模式一:无需认证(apk、callback 等内部服务)
|
||||
func NewClient() *Client {
|
||||
client := &Client{}
|
||||
client.InitWithAccessKey("", "", "")
|
||||
return client
|
||||
}
|
||||
|
||||
// 模式二:需要认证(sso、pay 等)
|
||||
func NewClient() (*Client, error) {
|
||||
client := new(Client)
|
||||
err := client.Init()
|
||||
return client, err
|
||||
}
|
||||
```
|
||||
27
README.md
27
README.md
@ -176,31 +176,4 @@ func CreateDemoTestResponse() *DemoTestResponse {
|
||||
终端调试打开方式, 需要在系统环境变量上加入(三选一):
|
||||
```
|
||||
DEBUG=sdk,signer,request
|
||||
```
|
||||
|
||||
### 5.测试用例编写要求
|
||||
|
||||
新增或修改 `services/*` 下的接口封装时,**必须**配套可编译的测试,并遵循下列约定(风格可参考 `services/cs/client_test.go` 与 `services/game/client_test.go`)。
|
||||
|
||||
#### 5.1 单测职责(一条用例里要覆盖什么)
|
||||
|
||||
- **请求侧**:构造 `Create*Request`,填入业务参数后调用 `requests.InitParam(req)`,再断言 HTTP 方法、`GetActionName()` 路径、以及 Query/Form 等关键参数是否注入正确。
|
||||
- **调用侧**:使用本服务 `NewClient()`(或项目约定的构造方式)**真实调用** `Client` 上对应方法,覆盖 `DoAction` 与签名、序列化整条链路。
|
||||
- **响应侧**:断言 `err == nil`、响应非 `nil`,并对业务字段做断言(如 `Code`、`Msg`、`Data` 及关键业务 ID、类型等);**必须**通过 `fmt.Printf` 打印返回内容,便于人工核对逻辑是否正确。
|
||||
- **风格**:与 `cs` 一致时优先使用 `t.Error` / `t.Errorf` + `return` 早退出;断言失败时除 `t.Errorf` 外可再 `fmt.Printf("%#+v\n", resp)`(及对 `*resp.Data`)便于排错。
|
||||
|
||||
#### 5.2 组织方式
|
||||
|
||||
- **同一能力的多条场景**(如白名单与黑名单):可拆成 `TestXxx`、`TestXxxBlack` 等若干函数,**每个函数内**仍应完整包含「请求校验 → 真实调用 → 响应断言 → 打印」,避免把断言拆成大量只测一行的小函数。
|
||||
- **禁止**仅写「只校验 `InitParam`、不调 Client」的孤立用例作为唯一测试;若需 mock(无网/CI),可另加辅助函数,但不应替代上述真实调用用例作为唯一验收。
|
||||
|
||||
#### 5.3 输出与可读性
|
||||
|
||||
- 使用 `fmt.Printf("%#+v\n", resp)` 打印完整响应结构体;若 `Data` 为指针,再打印 `fmt.Printf("%#+v\n", *resp.Data)`。
|
||||
- 测试函数顶部用简短中文注释说明测的是哪条接口、什么场景。
|
||||
|
||||
#### 5.4 运行
|
||||
|
||||
```bash
|
||||
go test ./services/<包名> -run Test<名称> -v
|
||||
```
|
||||
13
go.mod
13
go.mod
@ -1,13 +0,0 @@
|
||||
module golib.gaore.com/GaoreGo/gaore-common-sdk-go
|
||||
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/spf13/cast v1.8.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
)
|
||||
26
go.sum
26
go.sum
@ -1,26 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/spf13/cast v1.8.0 h1:gEN9K4b8Xws4EX0+a0reLmhq8moKn7ntRlQYgjPeCDk=
|
||||
github.com/spf13/cast v1.8.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
|
||||
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
@ -18,40 +18,38 @@ func signRpcRequest(request requests.AcsRequest, signer Signer) (err error) {
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if signer != nil {
|
||||
if _, isContainsSign := request.GetQueryParams()["sign"]; isContainsSign {
|
||||
delete(request.GetQueryParams(), "sign")
|
||||
}
|
||||
stringToSign := buildRpcStringToSign(request)
|
||||
request.SetStringToSign(stringToSign)
|
||||
signature := signer.Sign(stringToSign, "&")
|
||||
request.GetQueryParams()["sign"] = signature
|
||||
debug("GrSdk sign: %s", signature)
|
||||
debug("GrSdk sign string: %s", stringToSign)
|
||||
debug("GrSdk sign: \r\n")
|
||||
if _, isContainsSign := request.GetQueryParams()["sign"]; isContainsSign {
|
||||
delete(request.GetQueryParams(), "sign")
|
||||
}
|
||||
|
||||
stringToSign := buildRpcStringToSign(request)
|
||||
request.SetStringToSign(stringToSign)
|
||||
signature := signer.Sign(stringToSign, "&")
|
||||
request.GetQueryParams()["sign"] = signature
|
||||
debug("GrSdk sign: %s", signature)
|
||||
debug("GrSdk sign string: %s", stringToSign)
|
||||
debug("GrSdk sign: \r\n")
|
||||
return
|
||||
}
|
||||
|
||||
func completeRpcSignParams(request requests.AcsRequest, signer Signer) (err error) {
|
||||
if signer != nil {
|
||||
var accessKeyFrom string
|
||||
if accessKeyFrom, err = signer.GetAccessKeyFrom(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
queryParams := request.GetQueryParams()
|
||||
queryParams["access_time"] = fmt.Sprintf("%d", time.Now().Unix())
|
||||
queryParams["access_key"], err = signer.GetAccessKeyId()
|
||||
queryParams["access_from"] = accessKeyFrom
|
||||
request.GetHeaders()["Gr-Sdk-From"] = accessKeyFrom
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var accessKeyFrom string
|
||||
if accessKeyFrom, err = signer.GetAccessKeyFrom(); err != nil {
|
||||
return
|
||||
}
|
||||
request.GetHeaders()["Content-type"] = requests.Form
|
||||
|
||||
queryParams := request.GetQueryParams()
|
||||
queryParams["access_time"] = fmt.Sprintf("%d", time.Now().Unix())
|
||||
queryParams["access_key"], err = signer.GetAccessKeyId()
|
||||
queryParams["access_from"] = accessKeyFrom
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
request.GetHeaders()["Content-type"] = requests.Form
|
||||
request.GetHeaders()["Gr-Sdk-From"] = accessKeyFrom
|
||||
formString := utils.GetUrlFormedMap(request.GetFormParams())
|
||||
request.SetContent(bytes.NewBufferString(formString).Bytes())
|
||||
return
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"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/credentials"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
@ -19,7 +18,6 @@ import (
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -46,27 +44,6 @@ type Client struct {
|
||||
httpProxy string
|
||||
httpsProxy string
|
||||
noProxy string
|
||||
|
||||
header *requests.RefererHeader
|
||||
}
|
||||
|
||||
func (client *Client) SetRefererHeader(header *requests.RefererHeader) {
|
||||
client.header = header
|
||||
}
|
||||
|
||||
func (client *Client) getRefererHeader() map[string]string {
|
||||
var header *requests.RefererHeader
|
||||
if client.header == nil {
|
||||
header = &requests.RefererHeader{
|
||||
TraceId: utils.MakeTraceId(),
|
||||
}
|
||||
} else {
|
||||
header = client.header
|
||||
}
|
||||
return map[string]string{
|
||||
"Referer": header.Referer,
|
||||
"Traceparent": header.TraceId,
|
||||
}
|
||||
}
|
||||
|
||||
func (client *Client) GetNoProxy() string {
|
||||
@ -112,15 +89,11 @@ func (client *Client) Init() (err error) {
|
||||
|
||||
func (client *Client) InitWithAccessKey(accessKeyId, accessKeySecret, accessKeyFrom string) (err error) {
|
||||
config := client.InitWithConfig()
|
||||
var credential auth.Credential
|
||||
if accessKeyId != "" {
|
||||
credential = &credentials.BaseCredential{
|
||||
AccessKeyId: accessKeyId,
|
||||
AccessKeySecret: accessKeySecret,
|
||||
AccessKeyFrom: accessKeyFrom,
|
||||
}
|
||||
credential := &credentials.BaseCredential{
|
||||
AccessKeyId: accessKeyId,
|
||||
AccessKeySecret: accessKeySecret,
|
||||
AccessKeyFrom: accessKeyFrom,
|
||||
}
|
||||
|
||||
return client.InitWithOptions(config, credential)
|
||||
}
|
||||
|
||||
@ -158,9 +131,8 @@ func (client *Client) InitWithOptions(config *Config, credential auth.Credential
|
||||
if config.Timeout > 0 {
|
||||
client.httpClient.Timeout = config.Timeout
|
||||
}
|
||||
if credential != nil {
|
||||
client.signer, err = auth.NewSignerWithCredential(credential, client.ProcessCommonRequestWithSigner)
|
||||
}
|
||||
|
||||
client.signer, err = auth.NewSignerWithCredential(credential, client.ProcessCommonRequestWithSigner)
|
||||
return
|
||||
}
|
||||
|
||||
@ -181,7 +153,7 @@ func (client *Client) ProcessCommonRequestWithSigner(request *requests.CommonReq
|
||||
panic("should not be here")
|
||||
}
|
||||
|
||||
func timeout(connectTimeout time.Duration) func(ctx context.Context, net, addr string) (c net.Conn, err error) {
|
||||
func Timeout(connectTimeout time.Duration) func(ctx context.Context, net, addr string) (c net.Conn, err error) {
|
||||
return func(ctx context.Context, network, address string) (c net.Conn, err error) {
|
||||
return (&net.Dialer{
|
||||
Timeout: connectTimeout,
|
||||
@ -194,11 +166,11 @@ func (client *Client) setTimeOut(request requests.AcsRequest) {
|
||||
readTimeout, connectTimeout := client.getTimeOut(request)
|
||||
client.httpClient.Timeout = readTimeout
|
||||
if trans, ok := client.httpClient.Transport.(*http.Transport); ok && trans != nil {
|
||||
trans.DialContext = timeout(connectTimeout)
|
||||
trans.DialContext = Timeout(connectTimeout)
|
||||
client.httpClient.Transport = trans
|
||||
} else if client.httpClient.Transport == nil {
|
||||
client.httpClient.Transport = &http.Transport{
|
||||
DialContext: timeout(connectTimeout),
|
||||
DialContext: Timeout(connectTimeout),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,7 +211,7 @@ func (client *Client) DoAction(request requests.AcsRequest, response responses.A
|
||||
}
|
||||
|
||||
func (client *Client) DoActionWithSigner(request requests.AcsRequest, response responses.AcsResponse, signer auth.Signer) (err error) {
|
||||
request.AddHeaders(client.getRefererHeader())
|
||||
|
||||
httpRequest, err := client.buildRequestWithSigner(request, signer)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -387,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) {
|
||||
return fn
|
||||
}
|
||||
|
||||
func init() {
|
||||
once := sync.Once{}
|
||||
once.Do(func() {
|
||||
extra.RegisterFuzzyDecoders()
|
||||
})
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@ type JsonRequest struct {
|
||||
|
||||
func (request *JsonRequest) init() {
|
||||
request.baseRequest = defaultBaseRequest()
|
||||
request.baseRequest.AddHeaderParam("Content-Type", Json)
|
||||
request.Method = POST
|
||||
}
|
||||
|
||||
@ -36,16 +35,12 @@ func (request *JsonRequest) BuildUrl() string {
|
||||
}
|
||||
|
||||
func (request *JsonRequest) GetStyle() string {
|
||||
return STREAM
|
||||
return RPC
|
||||
}
|
||||
|
||||
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)
|
||||
request.queries = "/" + path + "?" + utils.GetUrlFormedMap(request.QueryParams)
|
||||
return request.queries
|
||||
}
|
||||
|
||||
@ -61,8 +56,8 @@ func (request *JsonRequest) InitWithApiInfo(domain Host, version, urlPath string
|
||||
}
|
||||
|
||||
func (request *JsonRequest) GetBodyReader() io.Reader {
|
||||
if request.JsonParams != nil && len(request.JsonParams) > 0 {
|
||||
body, err := json.Marshal(request.JsonParams)
|
||||
if request.FormParams != nil && len(request.FormParams) > 0 {
|
||||
body, err := json.Marshal(request.FormParams)
|
||||
if err == nil {
|
||||
return bytes.NewReader(body)
|
||||
}
|
||||
|
||||
@ -32,17 +32,15 @@ const (
|
||||
HEAD = "HEAD"
|
||||
OPTIONS = "OPTIONS"
|
||||
|
||||
Json = "application/json"
|
||||
Xml = "application/xml"
|
||||
Raw = "application/octet-stream"
|
||||
Form = "application/x-www-form-urlencoded"
|
||||
FormData = "multipart/form-data"
|
||||
Json = "application/json"
|
||||
Xml = "application/xml"
|
||||
Raw = "application/octet-stream"
|
||||
Form = "application/x-www-form-urlencoded"
|
||||
|
||||
Header = "Header"
|
||||
Query = "Query"
|
||||
Body = "Body"
|
||||
BodyJson = "Json"
|
||||
Path = "Path"
|
||||
Header = "Header"
|
||||
Query = "Query"
|
||||
Body = "Body"
|
||||
Path = "Path"
|
||||
|
||||
TEST = "TEST"
|
||||
PRE = "PRE"
|
||||
@ -56,11 +54,6 @@ type Host struct {
|
||||
Func func(string) string
|
||||
}
|
||||
|
||||
type RefererHeader struct {
|
||||
Referer string
|
||||
TraceId string
|
||||
}
|
||||
|
||||
var debug utils.Debug
|
||||
|
||||
func init() {
|
||||
@ -100,10 +93,8 @@ type AcsRequest interface {
|
||||
GetBodyReader() io.Reader
|
||||
|
||||
AddHeaderParam(key, value string)
|
||||
AddHeaders(headers map[string]string)
|
||||
addQueryParam(key, value string)
|
||||
addFormParam(key, value string)
|
||||
addJsonParam(string, any)
|
||||
}
|
||||
|
||||
type baseRequest struct {
|
||||
@ -127,7 +118,6 @@ type baseRequest struct {
|
||||
QueryParams map[string]string
|
||||
Headers map[string]string
|
||||
FormParams map[string]string
|
||||
JsonParams map[string]any
|
||||
Content []byte
|
||||
|
||||
queries string
|
||||
@ -232,12 +222,6 @@ func (request *baseRequest) AddHeaderParam(key, val string) {
|
||||
request.Headers[key] = val
|
||||
}
|
||||
|
||||
func (request *baseRequest) AddHeaders(headers map[string]string) {
|
||||
for key, val := range headers {
|
||||
request.Headers[key] = val
|
||||
}
|
||||
}
|
||||
|
||||
func (request *baseRequest) addQueryParam(key, val string) {
|
||||
request.QueryParams[key] = val
|
||||
}
|
||||
@ -246,10 +230,6 @@ func (request *baseRequest) addFormParam(key, val string) {
|
||||
request.FormParams[key] = val
|
||||
}
|
||||
|
||||
func (request *baseRequest) addJsonParam(key string, val any) {
|
||||
request.JsonParams[key] = val
|
||||
}
|
||||
|
||||
func defaultBaseRequest() (request *baseRequest) {
|
||||
request = &baseRequest{
|
||||
Scheme: HTTP,
|
||||
@ -262,7 +242,6 @@ func defaultBaseRequest() (request *baseRequest) {
|
||||
"Accept-Encoding": Json,
|
||||
},
|
||||
FormParams: make(map[string]string),
|
||||
JsonParams: make(map[string]any),
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -277,15 +256,6 @@ func flatRepeatedList(reflectValue reflect.Value, request AcsRequest, position s
|
||||
reflectType := reflectValue.Type()
|
||||
for i := 0; i < reflectType.NumField(); i++ {
|
||||
field := reflectType.Field(i)
|
||||
|
||||
if field.Anonymous && field.Type.Kind() == reflect.Struct {
|
||||
err = flatRepeatedList(reflectValue.Field(i), request, "")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
name, isContiansNameTag := field.Tag.Lookup("field")
|
||||
|
||||
fieldPosition := position
|
||||
@ -320,14 +290,14 @@ func flatRepeatedList(reflectValue reflect.Value, request AcsRequest, position s
|
||||
value = fieldDefault
|
||||
}
|
||||
|
||||
err = addParam(request, fieldPosition, name, value, reflectValue.Field(i).Interface())
|
||||
err = addParam(request, fieldPosition, name, value)
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
switch position {
|
||||
case Header:
|
||||
@ -336,8 +306,6 @@ func addParam(request AcsRequest, position, key, value string, vAny any) (err er
|
||||
request.addQueryParam(key, value)
|
||||
case Body:
|
||||
request.addFormParam(key, value)
|
||||
case BodyJson:
|
||||
request.addJsonParam(key, vAny)
|
||||
default:
|
||||
errmsg := fmt.Sprintf("unsupport positions add param `%s`", position)
|
||||
err = errors.New(errmsg)
|
||||
|
||||
@ -13,7 +13,6 @@ type RpcRequest struct {
|
||||
|
||||
func (request *RpcRequest) init() {
|
||||
request.baseRequest = defaultBaseRequest()
|
||||
request.baseRequest.AddHeaderParam("Content-Type", Form)
|
||||
request.Method = POST
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ type StreamRequest struct {
|
||||
|
||||
func (s *StreamRequest) init() {
|
||||
s.baseRequest = defaultBaseRequest()
|
||||
s.baseRequest.AddHeaderParam("Content-Type", FormData)
|
||||
s.baseRequest.AddHeaderParam("Content-Type", "application/form-data")
|
||||
s.Method = POST
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package responses
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/json-iterator/go"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@ -89,7 +89,7 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string)
|
||||
return
|
||||
}
|
||||
|
||||
if _, isCommonResponse := response.(*CommonResponse); isCommonResponse {
|
||||
if _, isCommonResponse := response.(CommonResponse); isCommonResponse {
|
||||
return
|
||||
}
|
||||
|
||||
@ -97,10 +97,7 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string)
|
||||
if contentType, ok := response.GetHttpHeaders()["Content-Type"]; ok {
|
||||
for _, v := range contentType {
|
||||
if strings.Contains(v, requests.Json) {
|
||||
err = jsoniter.Unmarshal(response.GetHttpContentBytes(), response)
|
||||
if err != nil {
|
||||
return errors.New("json Unmarshal:" + err.Error())
|
||||
}
|
||||
json.Unmarshal(response.GetHttpContentBytes(), response)
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -111,11 +108,10 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string)
|
||||
}
|
||||
|
||||
if format != "xml" {
|
||||
err = jsoniter.Unmarshal(response.GetHttpContentBytes(), response)
|
||||
err = json.Unmarshal(response.GetHttpContentBytes(), response)
|
||||
if err != nil {
|
||||
return errors.New("json Unmarshal:" + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
package random
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type Mode int // 随机数模式
|
||||
|
||||
const (
|
||||
Letter Mode = iota
|
||||
Number
|
||||
LetterNumber
|
||||
LetterHex
|
||||
)
|
||||
|
||||
const (
|
||||
letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
numbers = "0123456789"
|
||||
lettersHex = "0123456789abcdef"
|
||||
letterIdBit = 6
|
||||
letterIdxMask = 1<<letterIdBit - 1
|
||||
letterIdxMax = 63 / letterIdBit
|
||||
)
|
||||
|
||||
func StrRandom(n int64) string {
|
||||
return Random(n, Letter)
|
||||
}
|
||||
|
||||
func NumRandom(n int64) string {
|
||||
return Random(n, Number)
|
||||
}
|
||||
|
||||
func Random(n int64, mode ...Mode) string {
|
||||
var baseStr string
|
||||
mode = append(mode, LetterNumber)
|
||||
switch mode[0] {
|
||||
case LetterHex:
|
||||
baseStr = lettersHex
|
||||
case Letter:
|
||||
baseStr = letters
|
||||
case Number:
|
||||
baseStr = numbers
|
||||
case LetterNumber:
|
||||
fallthrough
|
||||
default:
|
||||
baseStr = letters + numbers
|
||||
}
|
||||
return random(n, baseStr)
|
||||
}
|
||||
|
||||
func random(n int64, baseStr string) string {
|
||||
|
||||
var src = rand.NewSource(time.Now().UnixNano())
|
||||
b := make([]byte, n)
|
||||
for i, cache, remain := n-1, src.Int63(), letterIdxMax; i >= 0; {
|
||||
if remain == 0 {
|
||||
cache, remain = src.Int63(), letterIdxMax
|
||||
}
|
||||
if idx := int(cache & letterIdxMask); idx < len(baseStr) {
|
||||
b[i] = baseStr[idx]
|
||||
i--
|
||||
}
|
||||
cache >>= letterIdBit
|
||||
remain--
|
||||
}
|
||||
return *(*string)(unsafe.Pointer(&b))
|
||||
}
|
||||
@ -5,8 +5,8 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils/random"
|
||||
"hash"
|
||||
rand2 "math/rand"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sort"
|
||||
@ -36,7 +36,11 @@ func NewUUID() UUID {
|
||||
}
|
||||
|
||||
func RandStringBytes(n int) string {
|
||||
return random.StrRandom(int64(n))
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
b[i] = letterBytes[rand2.Intn(len(letterBytes))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func newFromHash(h hash.Hash, ns UUID, name string) UUID {
|
||||
@ -105,12 +109,3 @@ func InitStructWithDefaultTag(bean interface{}) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Md5(data string) string {
|
||||
s := md5.Sum([]byte(data))
|
||||
return hex.EncodeToString(s[:])
|
||||
}
|
||||
|
||||
func MakeTraceId() string {
|
||||
return fmt.Sprintf("00-%s-%s-01", random.Random(32, random.LetterHex), random.Random(16, random.LetterHex))
|
||||
}
|
||||
|
||||
@ -23,7 +23,3 @@ func TestInitStructWithDefaultTag(t *testing.T) {
|
||||
InitStructWithDefaultTag(testcase)
|
||||
fmt.Printf("%+v", testcase)
|
||||
}
|
||||
|
||||
func TestMd5(t *testing.T) {
|
||||
t.Log(Md5("123456"))
|
||||
}
|
||||
|
||||
@ -1,34 +0,0 @@
|
||||
package asdk
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type AuthReq struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type AuthResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
Uid int64 `json:"uid"`
|
||||
UserName string `json:"user_name"`
|
||||
} `json:"data"`
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
|
||||
func CreateAuthReq(token string) *AuthReq {
|
||||
req := &AuthReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/auth")
|
||||
req.Method = requests.POST
|
||||
req.FormParams = map[string]string{
|
||||
"token": token,
|
||||
}
|
||||
return req
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
package asdk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"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/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "2020-11-16"
|
||||
)
|
||||
|
||||
var HOST = requests.Host{
|
||||
Default: "asdk",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = new(Client)
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
// GenerateInnerApiSign
|
||||
// 生成内部接口签名
|
||||
func GenerateInnerApiSign(ts int64) (int64, string) {
|
||||
const InnerSignSecret = "sYbfhozSu^@K8~y*"
|
||||
if ts == 0 {
|
||||
ts = time.Now().Unix()
|
||||
}
|
||||
return ts, utils.Md5(fmt.Sprintf("%d%s", ts, InnerSignSecret))
|
||||
}
|
||||
|
||||
// CreateKickUserReq 踢人
|
||||
func (c *Client) CreateKickUserReq(req *KickUserReq) (resp *KickUserResp, err error) {
|
||||
resp = CreateKickUserResp()
|
||||
err = c.DoAction(req, resp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) Auth(req *AuthReq) (resp *AuthResp, err error) {
|
||||
resp = &AuthResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// ClearPaySwitchCache 清切支付名单判定缓存(内网无签名接口,按 user_name + game_id 即时清 asdk 判定缓存)
|
||||
func (c *Client) ClearPaySwitchCache(req *ClearPaySwitchCacheReq) (resp *ClearPaySwitchCacheResp, err error) {
|
||||
resp = CreateClearPaySwitchCacheResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package asdk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// 获取用户累计付费
|
||||
func TestKickUser(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ts, sign := GenerateInnerApiSign(0)
|
||||
req := CreateKickUserReq(KickUserParam{
|
||||
Ts: ts,
|
||||
Sign: sign,
|
||||
UserName: "aq36604627",
|
||||
})
|
||||
|
||||
resp, err := client.CreateKickUserReq(req)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(resp.Code, resp.Msg, resp.Data)
|
||||
}
|
||||
|
||||
func TestAuth(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
resp, err := client.Auth(CreateAuthReq("t1w6rnlqxlYeSM3wAqVRljKDGVSTr9th"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(resp)
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
package asdk
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type KickUserReq struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type KickUserResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct{} `json:"data"`
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
type KickUserParam struct {
|
||||
Ts int64 `json:"ts"`
|
||||
Sign string `json:"sign"`
|
||||
UserName string `json:"user_name"`
|
||||
}
|
||||
|
||||
func CreateKickUserReq(data KickUserParam) *KickUserReq {
|
||||
req := &KickUserReq{
|
||||
&requests.RpcRequest{},
|
||||
}
|
||||
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/kick")
|
||||
req.Method = requests.GET
|
||||
req.QueryParams = map[string]string{
|
||||
"ts": strconv.FormatInt(data.Ts, 10),
|
||||
"sign": data.Sign,
|
||||
"user_name": data.UserName,
|
||||
}
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateKickUserResp() *KickUserResp {
|
||||
return &KickUserResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
package asdk
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// ClearPaySwitchCacheReq
|
||||
// 清切支付名单判定缓存请求(内网无签名接口,按 user_name + game_id 即时清 asdk 判定缓存)
|
||||
type ClearPaySwitchCacheReq struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type ClearPaySwitchCacheResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct{} `json:"data"`
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
|
||||
// CreateClearPaySwitchCacheReq 构造清缓存请求(user_name + game_id)
|
||||
func CreateClearPaySwitchCacheReq(userName string, gameId int64) *ClearPaySwitchCacheReq {
|
||||
req := &ClearPaySwitchCacheReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/vip/clear_pay_switch_cache")
|
||||
req.Method = requests.POST
|
||||
req.FormParams = map[string]string{
|
||||
"user_name": userName,
|
||||
"game_id": strconv.FormatInt(gameId, 10),
|
||||
}
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateClearPaySwitchCacheResp() *ClearPaySwitchCacheResp {
|
||||
return &ClearPaySwitchCacheResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
package big_data
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "v1"
|
||||
)
|
||||
|
||||
var HOST requests.Host = requests.Host{
|
||||
Default: "dms-api",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = new(Client)
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
// GetToken 获取访问 token
|
||||
func (c *Client) GetToken(req *GetTokenRequest) (response *GetTokenResponse, err error) {
|
||||
response = CreateGetTokenResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserProfile 用户筛选/圈选列表查询
|
||||
func (c *Client) GetUserProfile(req *GetUserProfileRequest) (response *GetUserProfileResponse, err error) {
|
||||
response = CreateGetUserProfileResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserLoginLog 用户登录日志查询
|
||||
func (c *Client) GetUserLoginLog(req *GetUserLoginLogRequest) (response *GetUserLoginLogResponse, err error) {
|
||||
response = CreateGetUserLoginLogResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetRoleCreateLog 角色创建日志查询
|
||||
func (c *Client) GetRoleCreateLog(req *GetRoleCreateLogRequest) (response *GetRoleCreateLogResponse, err error) {
|
||||
response = CreateGetRoleCreateLogResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserLoginLogOsOptions 登录日志 OS 选项查询
|
||||
func (c *Client) GetUserLoginLogOsOptions(req *GetUserLoginLogOsOptionsRequest) (response *GetUserLoginLogOsOptionsResponse, err error) {
|
||||
response = CreateGetUserLoginLogOsOptionsResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
@ -1,142 +0,0 @@
|
||||
package big_data
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// GetRoleCreateLogParam 角色创建日志查询参数
|
||||
// 说明:数值区间用 *int64,未设置(nil)时不参与筛选;切片为空表示不限定该条件
|
||||
type GetRoleCreateLogParam struct {
|
||||
Uid string `json:"uid"`
|
||||
EventTime []string `json:"event_time"` // 区间 [开始, 结束]
|
||||
GameSign string `json:"game_sign"`
|
||||
GameId string `json:"game_id"`
|
||||
RoleName string `json:"role_name"`
|
||||
RoleId string `json:"role_id"`
|
||||
ServerName string `json:"server_name"`
|
||||
ServerId string `json:"server_id"`
|
||||
RoleLevelMin *int64 `json:"role_level_min"`
|
||||
RoleLevelMax *int64 `json:"role_level_max"`
|
||||
PayAmtAccMin *float64 `json:"pay_amt_acc_min"`
|
||||
PayAmtAccMax *float64 `json:"pay_amt_acc_max"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
|
||||
}
|
||||
|
||||
// GetRoleCreateLogRequest 角色创建日志查询请求
|
||||
type GetRoleCreateLogRequest struct {
|
||||
*requests.JsonRequest
|
||||
Uid string `position:"Json" field:"uid"`
|
||||
EventTime []string `position:"Json" field:"event_time"`
|
||||
GameSign string `position:"Json" field:"game_sign"`
|
||||
GameId string `position:"Json" field:"game_id"`
|
||||
RoleName string `position:"Json" field:"role_name"`
|
||||
RoleId string `position:"Json" field:"role_id"`
|
||||
ServerName string `position:"Json" field:"server_name"`
|
||||
ServerId string `position:"Json" field:"server_id"`
|
||||
RoleLevelMin *int64 `position:"Json" field:"role_level_min"`
|
||||
RoleLevelMax *int64 `position:"Json" field:"role_level_max"`
|
||||
PayAmtAccMin *float64 `position:"Json" field:"pay_amt_acc_min"`
|
||||
PayAmtAccMax *float64 `position:"Json" field:"pay_amt_acc_max"`
|
||||
Page int `position:"Json" field:"page"`
|
||||
PageSize int `position:"Json" field:"page_size"`
|
||||
Authorization string `position:"Header" field:"Authorization"`
|
||||
XDebug string `position:"Header" field:"x-debug"`
|
||||
}
|
||||
|
||||
// getRoleCreateLogBody 自定义请求体序列化结构,绕开 core 的反射序列化(JsonParams):
|
||||
// - 数值字段 *float64 + omitempty:未设置(nil)时该字段不出现在 JSON 中,避免 0 被 DMS 当成真实筛选条件;
|
||||
// - event_time 切片统一为非 nil 空数组 []:避免 nil 被序列化成 null 触发 DMS 类型校验失败;
|
||||
// - 标量字符串用 omitempty:空串时不出现在 JSON 中。
|
||||
type getRoleCreateLogBody struct {
|
||||
Uid string `json:"uid,omitempty"`
|
||||
EventTime []string `json:"event_time"`
|
||||
GameSign string `json:"game_sign,omitempty"`
|
||||
GameId string `json:"game_id,omitempty"`
|
||||
RoleName string `json:"role_name,omitempty"`
|
||||
RoleId string `json:"role_id,omitempty"`
|
||||
ServerName string `json:"server_name,omitempty"`
|
||||
ServerId string `json:"server_id,omitempty"`
|
||||
RoleLevelMin *int64 `json:"role_level_min,omitempty"`
|
||||
RoleLevelMax *int64 `json:"role_level_max,omitempty"`
|
||||
PayAmtAccMin *float64 `json:"pay_amt_acc_min,omitempty"`
|
||||
PayAmtAccMax *float64 `json:"pay_amt_acc_max,omitempty"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
// GetBodyReader 覆盖 JsonRequest 默认实现,使用自定义结构序列化 body。
|
||||
// 鉴权头(Authorization / x-debug)仍由 core 的 InitParam 按 Header 字段设置,不受影响。
|
||||
func (request *GetRoleCreateLogRequest) GetBodyReader() io.Reader {
|
||||
body := getRoleCreateLogBody{
|
||||
Uid: request.Uid,
|
||||
EventTime: emptyStrSlice(request.EventTime),
|
||||
GameSign: request.GameSign,
|
||||
GameId: request.GameId,
|
||||
RoleName: request.RoleName,
|
||||
RoleId: request.RoleId,
|
||||
ServerName: request.ServerName,
|
||||
ServerId: request.ServerId,
|
||||
RoleLevelMin: request.RoleLevelMin,
|
||||
RoleLevelMax: request.RoleLevelMax,
|
||||
PayAmtAccMin: request.PayAmtAccMin,
|
||||
PayAmtAccMax: request.PayAmtAccMax,
|
||||
Page: request.Page,
|
||||
PageSize: request.PageSize,
|
||||
}
|
||||
b, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
return strings.NewReader("")
|
||||
}
|
||||
return bytes.NewReader(b)
|
||||
}
|
||||
|
||||
// GetRoleCreateLogResponse 角色创建日志查询响应(返回不做处理,data 原样透出)
|
||||
type GetRoleCreateLogResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
}
|
||||
|
||||
// CreateGetRoleCreateLogRequest 创建角色创建日志查询请求
|
||||
// token 为 GetToken 返回的 data.token,直接放入 Authorization 头
|
||||
func CreateGetRoleCreateLogRequest(token string, param GetRoleCreateLogParam) *GetRoleCreateLogRequest {
|
||||
req := &GetRoleCreateLogRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Uid: param.Uid,
|
||||
EventTime: param.EventTime,
|
||||
GameSign: param.GameSign,
|
||||
GameId: param.GameId,
|
||||
RoleName: param.RoleName,
|
||||
RoleId: param.RoleId,
|
||||
ServerName: param.ServerName,
|
||||
ServerId: param.ServerId,
|
||||
RoleLevelMin: param.RoleLevelMin,
|
||||
RoleLevelMax: param.RoleLevelMax,
|
||||
PayAmtAccMin: param.PayAmtAccMin,
|
||||
PayAmtAccMax: param.PayAmtAccMax,
|
||||
Page: param.Page,
|
||||
PageSize: param.PageSize,
|
||||
Authorization: token,
|
||||
XDebug: param.XDebug,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/get_role_create_log")
|
||||
req.Method = requests.POST
|
||||
req.Scheme = requests.HTTPS
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateGetRoleCreateLogResponse 创建角色创建日志查询响应
|
||||
func CreateGetRoleCreateLogResponse() *GetRoleCreateLogResponse {
|
||||
return &GetRoleCreateLogResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,126 +0,0 @@
|
||||
package big_data
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// GetUserLoginLogParam 用户登录日志查询参数
|
||||
// 说明:切片为空表示不限定该条件;标量字符串为空时不参与筛选
|
||||
type GetUserLoginLogParam struct {
|
||||
Uid string `json:"uid"`
|
||||
EventTime []string `json:"event_time"` // 区间 [开始, 结束]
|
||||
GameSign string `json:"game_sign"`
|
||||
ServerGroupId []string `json:"server_group_id"`
|
||||
GameId string `json:"game_id"`
|
||||
Os []string `json:"os"`
|
||||
OsTwo []string `json:"os_two"`
|
||||
Ip string `json:"ip"`
|
||||
DeviceId string `json:"device_id"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
|
||||
}
|
||||
|
||||
// GetUserLoginLogRequest 用户登录日志查询请求
|
||||
type GetUserLoginLogRequest struct {
|
||||
*requests.JsonRequest
|
||||
Uid string `position:"Json" field:"uid"`
|
||||
EventTime []string `position:"Json" field:"event_time"`
|
||||
GameSign string `position:"Json" field:"game_sign"`
|
||||
ServerGroupId []string `position:"Json" field:"server_group_id"`
|
||||
GameId string `position:"Json" field:"game_id"`
|
||||
Os []string `position:"Json" field:"os"`
|
||||
OsTwo []string `position:"Json" field:"os_two"`
|
||||
Ip string `position:"Json" field:"ip"`
|
||||
DeviceId string `position:"Json" field:"device_id"`
|
||||
Page int `position:"Json" field:"page"`
|
||||
PageSize int `position:"Json" field:"page_size"`
|
||||
Authorization string `position:"Header" field:"Authorization"`
|
||||
XDebug string `position:"Header" field:"x-debug"`
|
||||
}
|
||||
|
||||
// getUserLoginLogBody 自定义请求体序列化结构,绕开 core 的反射序列化(JsonParams):
|
||||
// - 切片字段统一为非 nil 空数组 []:避免 nil 被序列化成 null 触发 DMS 类型校验失败;
|
||||
// - 标量字符串用 omitempty:空串时不出现在 JSON 中,避免被 DMS 当成真实筛选条件。
|
||||
type getUserLoginLogBody struct {
|
||||
Uid string `json:"uid,omitempty"`
|
||||
EventTime []string `json:"event_time"`
|
||||
GameSign string `json:"game_sign,omitempty"`
|
||||
ServerGroupId []string `json:"server_group_id"`
|
||||
GameId string `json:"game_id,omitempty"`
|
||||
Os []string `json:"os"`
|
||||
OsTwo []string `json:"os_two"`
|
||||
Ip string `json:"ip,omitempty"`
|
||||
DeviceId string `json:"device_id,omitempty"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
// GetBodyReader 覆盖 JsonRequest 默认实现,使用自定义结构序列化 body。
|
||||
// 鉴权头(Authorization / x-debug)仍由 core 的 InitParam 按 Header 字段设置,不受影响。
|
||||
func (request *GetUserLoginLogRequest) GetBodyReader() io.Reader {
|
||||
body := getUserLoginLogBody{
|
||||
Uid: request.Uid,
|
||||
EventTime: emptyStrSlice(request.EventTime),
|
||||
GameSign: request.GameSign,
|
||||
ServerGroupId: emptyStrSlice(request.ServerGroupId),
|
||||
GameId: request.GameId,
|
||||
Os: emptyStrSlice(request.Os),
|
||||
OsTwo: emptyStrSlice(request.OsTwo),
|
||||
Ip: request.Ip,
|
||||
DeviceId: request.DeviceId,
|
||||
Page: request.Page,
|
||||
PageSize: request.PageSize,
|
||||
}
|
||||
b, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
return strings.NewReader("")
|
||||
}
|
||||
return bytes.NewReader(b)
|
||||
}
|
||||
|
||||
// GetUserLoginLogResponse 用户登录日志查询响应(返回不做处理,data 原样透出)
|
||||
type GetUserLoginLogResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
}
|
||||
|
||||
// CreateGetUserLoginLogRequest 创建用户登录日志查询请求
|
||||
// token 为 GetToken 返回的 data.token,直接放入 Authorization 头
|
||||
func CreateGetUserLoginLogRequest(token string, param GetUserLoginLogParam) *GetUserLoginLogRequest {
|
||||
req := &GetUserLoginLogRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Uid: param.Uid,
|
||||
EventTime: param.EventTime,
|
||||
GameSign: param.GameSign,
|
||||
ServerGroupId: param.ServerGroupId,
|
||||
GameId: param.GameId,
|
||||
Os: param.Os,
|
||||
OsTwo: param.OsTwo,
|
||||
Ip: param.Ip,
|
||||
DeviceId: param.DeviceId,
|
||||
Page: param.Page,
|
||||
PageSize: param.PageSize,
|
||||
Authorization: token,
|
||||
XDebug: param.XDebug,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/get_user_login_log")
|
||||
req.Method = requests.POST
|
||||
req.Scheme = requests.HTTPS
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateGetUserLoginLogResponse 创建用户登录日志查询响应
|
||||
func CreateGetUserLoginLogResponse() *GetUserLoginLogResponse {
|
||||
return &GetUserLoginLogResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
package big_data
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// GetUserLoginLogOsOptionsRequest 登录日志 OS 选项查询请求(无请求体,仅鉴权头)
|
||||
type GetUserLoginLogOsOptionsRequest struct {
|
||||
*requests.JsonRequest
|
||||
Authorization string `position:"Header" field:"Authorization"`
|
||||
XDebug string `position:"Header" field:"x-debug"`
|
||||
}
|
||||
|
||||
// GetUserLoginLogOsOptionsResponse 登录日志 OS 选项查询响应(返回不做处理,data 原样透出)
|
||||
type GetUserLoginLogOsOptionsResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
}
|
||||
|
||||
// CreateGetUserLoginLogOsOptionsRequest 创建登录日志 OS 选项查询请求
|
||||
// token 为 GetToken 返回的 data.token,直接放入 Authorization 头
|
||||
func CreateGetUserLoginLogOsOptionsRequest(token string) *GetUserLoginLogOsOptionsRequest {
|
||||
req := &GetUserLoginLogOsOptionsRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Authorization: token,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/get_user_login_log/os_options")
|
||||
req.Method = requests.POST
|
||||
req.Scheme = requests.HTTPS
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateGetUserLoginLogOsOptionsResponse 创建登录日志 OS 选项查询响应
|
||||
func CreateGetUserLoginLogOsOptionsResponse() *GetUserLoginLogOsOptionsResponse {
|
||||
return &GetUserLoginLogOsOptionsResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,192 +0,0 @@
|
||||
package big_data
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// GetUserProfileParam 用户筛选/圈选查询参数
|
||||
// 说明:金额类筛选用 *int64,未设置(nil)时不参与筛选;切片为空表示不限定该条件
|
||||
type GetUserProfileParam struct {
|
||||
UserName []string `json:"user_name"`
|
||||
UserName2 []string `json:"user_name2"`
|
||||
Uid []string `json:"uid"`
|
||||
RoleId []string `json:"role_id"`
|
||||
RoleName []string `json:"role_name"`
|
||||
RoleNameLike string `json:"role_name_like"`
|
||||
LabelId []int `json:"label_id"`
|
||||
WeworkTag []string `json:"wework_tag"`
|
||||
OrderId []string `json:"order_id"`
|
||||
TradeOrderId []string `json:"trade_order_id"`
|
||||
GameSign []string `json:"game_sign"`
|
||||
GameId []string `json:"game_id"`
|
||||
RegisterDate []string `json:"register_date"` // 区间 [开始, 结束]
|
||||
LastLoginDate []string `json:"last_login_date"` // 区间 [开始, 结束]
|
||||
LastPayDate []string `json:"last_pay_date"` // 区间 [开始, 结束]
|
||||
PayAmtAccMin *float64 `json:"pay_amt_acc_min"`
|
||||
PayAmtAccMax *float64 `json:"pay_amt_acc_max"`
|
||||
LastPayAmountMin *float64 `json:"last_pay_amount_min"`
|
||||
LastPayAmountMax *float64 `json:"last_pay_amount_max"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
|
||||
}
|
||||
|
||||
// GetUserProfileRequest 用户筛选/圈选查询请求
|
||||
type GetUserProfileRequest struct {
|
||||
*requests.JsonRequest
|
||||
UserName []string `position:"Json" field:"user_name"`
|
||||
UserName2 []string `position:"Json" field:"user_name2"`
|
||||
Uid []string `position:"Json" field:"uid"`
|
||||
RoleId []string `position:"Json" field:"role_id"`
|
||||
RoleName []string `position:"Json" field:"role_name"`
|
||||
RoleNameLike string `position:"Json" field:"role_name_like"`
|
||||
LabelId []int `position:"Json" field:"label_id"`
|
||||
WeworkTag []string `position:"Json" field:"wework_tag"`
|
||||
OrderId []string `position:"Json" field:"order_id"`
|
||||
TradeOrderId []string `position:"Json" field:"trade_order_id"`
|
||||
GameSign []string `position:"Json" field:"game_sign"`
|
||||
GameId []string `position:"Json" field:"game_id"`
|
||||
RegisterDate []string `position:"Json" field:"register_date"`
|
||||
LastLoginDate []string `position:"Json" field:"last_login_date"`
|
||||
LastPayDate []string `position:"Json" field:"last_pay_date"`
|
||||
PayAmtAccMin *float64 `position:"Json" field:"pay_amt_acc_min"`
|
||||
PayAmtAccMax *float64 `position:"Json" field:"pay_amt_acc_max"`
|
||||
LastPayAmountMin *float64 `position:"Json" field:"last_pay_amount_min"`
|
||||
LastPayAmountMax *float64 `position:"Json" field:"last_pay_amount_max"`
|
||||
Page int `position:"Json" field:"page"`
|
||||
PageSize int `position:"Json" field:"page_size"`
|
||||
Authorization string `position:"Header" field:"Authorization"`
|
||||
XDebug string `position:"Header" field:"x-debug"`
|
||||
}
|
||||
|
||||
// getUserProfileBody 自定义请求体序列化结构,绕开 core 的反射序列化(JsonParams):
|
||||
// - 金额字段 *float64 + omitempty:未设置(nil)时该字段不出现在 JSON 中,避免 0 被 DMS 当成真实筛选条件;
|
||||
// - 切片字段统一为非 nil 空数组 []:避免 nil 被序列化成 null 触发 DMS 类型校验失败。
|
||||
type getUserProfileBody struct {
|
||||
UserName []string `json:"user_name"`
|
||||
UserName2 []string `json:"user_name2"`
|
||||
Uid []string `json:"uid"`
|
||||
RoleId []string `json:"role_id"`
|
||||
RoleName []string `json:"role_name"`
|
||||
RoleNameLike string `json:"role_name_like,omitempty"`
|
||||
LabelId []int `json:"label_id"`
|
||||
WeworkTag []string `json:"wework_tag"`
|
||||
OrderId []string `json:"order_id"`
|
||||
TradeOrderId []string `json:"trade_order_id"`
|
||||
GameSign []string `json:"game_sign"`
|
||||
GameId []string `json:"game_id"`
|
||||
RegisterDate []string `json:"register_date"`
|
||||
LastLoginDate []string `json:"last_login_date"`
|
||||
LastPayDate []string `json:"last_pay_date"`
|
||||
PayAmtAccMin *float64 `json:"pay_amt_acc_min,omitempty"`
|
||||
PayAmtAccMax *float64 `json:"pay_amt_acc_max,omitempty"`
|
||||
LastPayAmountMin *float64 `json:"last_pay_amount_min,omitempty"`
|
||||
LastPayAmountMax *float64 `json:"last_pay_amount_max,omitempty"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
// GetBodyReader 覆盖 JsonRequest 默认实现,使用自定义结构序列化 body。
|
||||
// 鉴权头(Authorization / x-debug)仍由 core 的 InitParam 按 Header 字段设置,不受影响。
|
||||
func (request *GetUserProfileRequest) GetBodyReader() io.Reader {
|
||||
body := getUserProfileBody{
|
||||
UserName: emptyStrSlice(request.UserName),
|
||||
UserName2: emptyStrSlice(request.UserName2),
|
||||
Uid: emptyStrSlice(request.Uid),
|
||||
RoleId: emptyStrSlice(request.RoleId),
|
||||
RoleName: emptyStrSlice(request.RoleName),
|
||||
RoleNameLike: request.RoleNameLike,
|
||||
LabelId: emptyIntSlice(request.LabelId),
|
||||
WeworkTag: emptyStrSlice(request.WeworkTag),
|
||||
OrderId: emptyStrSlice(request.OrderId),
|
||||
TradeOrderId: emptyStrSlice(request.TradeOrderId),
|
||||
GameSign: emptyStrSlice(request.GameSign),
|
||||
GameId: emptyStrSlice(request.GameId),
|
||||
RegisterDate: emptyStrSlice(request.RegisterDate),
|
||||
LastLoginDate: emptyStrSlice(request.LastLoginDate),
|
||||
LastPayDate: emptyStrSlice(request.LastPayDate),
|
||||
PayAmtAccMin: request.PayAmtAccMin,
|
||||
PayAmtAccMax: request.PayAmtAccMax,
|
||||
LastPayAmountMin: request.LastPayAmountMin,
|
||||
LastPayAmountMax: request.LastPayAmountMax,
|
||||
Page: request.Page,
|
||||
PageSize: request.PageSize,
|
||||
}
|
||||
b, err := json.Marshal(body)
|
||||
if err != nil {
|
||||
return strings.NewReader("")
|
||||
}
|
||||
return bytes.NewReader(b)
|
||||
}
|
||||
|
||||
// emptyStrSlice 将 nil 切片转成非 nil 空切片,避免序列化成 JSON null
|
||||
func emptyStrSlice(s []string) []string {
|
||||
if s == nil {
|
||||
return []string{}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// emptyIntSlice 同 emptyStrSlice,针对 label_id 等 []int 字段
|
||||
func emptyIntSlice(s []int) []int {
|
||||
if s == nil {
|
||||
return []int{}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// GetUserProfileResponse 用户筛选/圈选查询响应(返回不做处理,data 原样透出)
|
||||
type GetUserProfileResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
}
|
||||
|
||||
// CreateGetUserProfileRequest 创建用户筛选/圈选查询请求
|
||||
// token 为 GetToken 返回的 data.token,直接放入 Authorization 头
|
||||
func CreateGetUserProfileRequest(token string, param GetUserProfileParam) *GetUserProfileRequest {
|
||||
req := &GetUserProfileRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
UserName: param.UserName,
|
||||
UserName2: param.UserName2,
|
||||
Uid: param.Uid,
|
||||
RoleId: param.RoleId,
|
||||
RoleName: param.RoleName,
|
||||
RoleNameLike: param.RoleNameLike,
|
||||
LabelId: param.LabelId,
|
||||
WeworkTag: param.WeworkTag,
|
||||
OrderId: param.OrderId,
|
||||
TradeOrderId: param.TradeOrderId,
|
||||
GameSign: param.GameSign,
|
||||
GameId: param.GameId,
|
||||
RegisterDate: param.RegisterDate,
|
||||
LastLoginDate: param.LastLoginDate,
|
||||
LastPayDate: param.LastPayDate,
|
||||
PayAmtAccMin: param.PayAmtAccMin,
|
||||
PayAmtAccMax: param.PayAmtAccMax,
|
||||
LastPayAmountMin: param.LastPayAmountMin,
|
||||
LastPayAmountMax: param.LastPayAmountMax,
|
||||
Page: param.Page,
|
||||
PageSize: param.PageSize,
|
||||
Authorization: token,
|
||||
XDebug: param.XDebug,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/get_user_profile")
|
||||
req.Method = requests.POST
|
||||
req.Scheme = requests.HTTPS
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateGetUserProfileResponse 创建用户筛选/圈选查询响应
|
||||
func CreateGetUserProfileResponse() *GetUserProfileResponse {
|
||||
return &GetUserProfileResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,56 +0,0 @@
|
||||
package big_data
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// GetTokenParam 获取 token 参数
|
||||
type GetTokenParam struct {
|
||||
AppKey string `json:"app_key"`
|
||||
AppSecret string `json:"app_secret"`
|
||||
ExpiresIn int64 `json:"expires_in"`
|
||||
XDebug string `json:"x_debug"` // 测试环境调试头,正式调用可留空
|
||||
}
|
||||
|
||||
// GetTokenRequest 获取 token 请求
|
||||
type GetTokenRequest struct {
|
||||
*requests.JsonRequest
|
||||
AppKey string `position:"Json" field:"app_key"`
|
||||
AppSecret string `position:"Json" field:"app_secret"`
|
||||
ExpiresIn int64 `position:"Json" field:"expires_in"`
|
||||
XDebug string `position:"Header" field:"x-debug"`
|
||||
}
|
||||
|
||||
// GetTokenResponse 获取 token 响应
|
||||
type GetTokenResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data struct {
|
||||
Token string `json:"token"`
|
||||
ExpiresIn int64 `json:"expires_in"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
// CreateGetTokenRequest 创建获取 token 请求
|
||||
func CreateGetTokenRequest(param GetTokenParam) *GetTokenRequest {
|
||||
req := &GetTokenRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
AppKey: param.AppKey,
|
||||
AppSecret: param.AppSecret,
|
||||
ExpiresIn: param.ExpiresIn,
|
||||
XDebug: param.XDebug,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/internal/v1/token")
|
||||
req.Method = requests.POST
|
||||
req.Scheme = requests.HTTPS
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateGetTokenResponse 创建获取 token 响应
|
||||
func CreateGetTokenResponse() *GetTokenResponse {
|
||||
return &GetTokenResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
@ -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横屏 --><!-- 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)
|
||||
}
|
||||
@ -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{},
|
||||
}
|
||||
}
|
||||
@ -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{},
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
@ -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{},
|
||||
}
|
||||
}
|
||||
@ -1,162 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "2025-06-10"
|
||||
)
|
||||
|
||||
var HOST = requests.Host{
|
||||
Default: "cs.api.gaore.com",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = new(Client)
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetFaq(req *GetFaqRequest) (resp *GetFaqResponse, err error) {
|
||||
resp = CreateGetFaqResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetUserInfo(req *GetUserInfoRequest) (resp *GetUserInfoResponse, err error) {
|
||||
resp = CreateGetUserInfoResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetCsUserRoleList(req *GetUserRoleListRequest) (resp *GetUserRoleListResponse, err error) {
|
||||
resp = CreateGetUserRoleListResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetUserServerList(req *GetUserServerListRequest) (resp *GetUserServerListResponse, err error) {
|
||||
resp = CreateGetUserServerListResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) SendSmsCode(req *SendSmsRequest) (resp *SendSmsResponse, err error) {
|
||||
resp = CreateSendSmsResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) Upload(req *UploadRequest) (resp *UploadResponse, err error) {
|
||||
// check file stream
|
||||
if req.FileStream == nil {
|
||||
err = errors.New("stream is empty")
|
||||
return
|
||||
}
|
||||
// 必须设置content
|
||||
req.SetContent(req.FileStream)
|
||||
// 考虑网络不佳的情况,提高超时时间
|
||||
req.SetReadTimeout(10 * time.Second)
|
||||
|
||||
resp = CreateUploadResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
func (client *Client) GetOrderTemplateDetail(req *OrderTemplateDetailReq) (resp *OrderTemplateDetailResp, err error) {
|
||||
resp = CreateOrderTemplateDetailResp()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetOrderFurtherPart(req *GetOrderFurtherPartRequest) (resp *GetOrderFurtherPartResponse, err error) {
|
||||
resp = CreateGetOrderFurtherPartResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) OrderUrgent(req *OrderUrgentRequest) (resp *OrderUrgentResponse, err error) {
|
||||
resp = CreateOrderUrgentResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) OrderUpdateHandle(req *OrderUpdateHandleRequest) (resp *OrderUpdateHandleResponse, err error) {
|
||||
resp = CreateOrderUpdateHandleResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
func (client *Client) OrderAppraise(req *OrderAppraiseRequest) (resp *OrderAppraiseResponse, err error) {
|
||||
resp = CreateOrderAppraiseResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
func (client *Client) OrderRestart(req *OrderRestartRequest) (resp *OrderRestartResponse, err error) {
|
||||
resp = CreateOrderRestartResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
func (client *Client) OrderSubmit(req *OrderSubmitRequest) (resp *OrderSubmitResponse, err error) {
|
||||
resp = CreateOrderSubmitResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) OrderFurtherPart(req *OrderFurtherPartRequest) (resp *OrderFurtherPartResponse, err error) {
|
||||
resp = CreateOrderFurtherPartResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
func (client *Client) OrderRecordList(req *GetWorkOrderRecordListRequest) (resp *GetWorkOrderRecordListResponse, err error) {
|
||||
resp = CreateGetWorkOrderRecordListResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
func (client *Client) OrderRecordDetail(req *GetWorkOrderRecordDetailReq) (resp *GetWorkOrderRecordDetailResp, err error) {
|
||||
resp = CreateGetWorkOrderRecordDetailResp()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetFaqDetail(req *GetFaqDetailRequest) (resp *GetFaqDetailResponse, err error) {
|
||||
resp = CreateGetFaqDetailResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetHotFaqList(req *GetHotFaqRequest) (resp *GetHotFaqResponse, err error) {
|
||||
resp = CreateGetHotFaqResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) ClearFaqListCache(req *ClearFaqListCacheRequest) (resp *ClearFaqListCacheResponse, err error) {
|
||||
resp = CreateClearFaqListCacheResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) ClearFaqDetailCache(req *ClearFaqDetailCacheRequest) (resp *ClearFaqDetailCacheResponse, err error) {
|
||||
resp = CreateClearFaqDetailCacheResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) ClearHotFaqCache(req *ClearHotFaqCacheRequest) (resp *ClearHotFaqCacheResponse, err error) {
|
||||
resp = CreateClearHotFaqCacheResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) GetLinkGameConfig(req *GetLinkGameConfigRequest) (resp *GetLinkGameConfigResponse, err error) {
|
||||
resp = CreateGetLinkGameConfigResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
@ -1,478 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
/**
|
||||
* 客服工单服务,单元测试
|
||||
*/
|
||||
|
||||
// 获取faq树状数据
|
||||
func TestGetFaq(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
|
||||
req := CreateGetFaqRequest()
|
||||
faq, err := client.GetFaq(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf(fmt.Sprintf("%#+v", faq))
|
||||
}
|
||||
|
||||
// 获取玩家基本信息
|
||||
func TestGetUserInfo(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetUserInfoRequest("ws45265737")
|
||||
info, err := client.GetUserInfo(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf(fmt.Sprintf("%v", info))
|
||||
}
|
||||
|
||||
// 获取玩家角色列表
|
||||
func TestGetUserRoleList(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetUserRoleListRequest(int64(63610626), int64(2850))
|
||||
info, err := client.GetCsUserRoleList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if info.Code != 0 {
|
||||
t.Error("获取玩家角色列表失败")
|
||||
fmt.Printf(fmt.Sprintf("%v", info))
|
||||
return
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", info))
|
||||
}
|
||||
|
||||
// 获取玩家区服列表
|
||||
func TestGetUserServerList(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetUserServerListRequest(int64(63610626), int64(2850))
|
||||
info, err := client.GetUserServerList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if info.Code != 0 {
|
||||
t.Error("获取玩家区服列表失败")
|
||||
fmt.Printf(fmt.Sprintf("%v", info))
|
||||
return
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", info))
|
||||
}
|
||||
|
||||
// 给玩家发送短信
|
||||
func TestSendSms(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateSendSmsRequest(SendSmsReq{
|
||||
Phone: "13725263463",
|
||||
})
|
||||
info, err := client.SendSmsCode(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if info.Code != 0 {
|
||||
t.Error("给玩家发送短信失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", info))
|
||||
}
|
||||
|
||||
// 工单图片上传
|
||||
func TestUpload(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
// 读取文件流
|
||||
file, err := os.ReadFile("test.png")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateUploadRequest()
|
||||
req.FileStream = file
|
||||
res, err := client.Upload(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("工单图片上传失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 工单模板查询
|
||||
func TestGetOrderTemplateDetail(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
templateId := int64(12)
|
||||
req := CreateOrderTemplateDetailReq(templateId)
|
||||
res, err := client.GetOrderTemplateDetail(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("工单模板查询失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 工单补充字段设置
|
||||
func TestGetOrderFurtherPart(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetOrderFurtherPartRequest(GetOrderFurtherPartParam{
|
||||
OrderNum: "20250605092301764049"})
|
||||
res, err := client.GetOrderFurtherPart(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("工单补充字段设置获取失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 用户催单
|
||||
func TestOrderUrgent(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateOrderUrgentRequest(OrderUrgentParam{
|
||||
OrderNum: "20250530173554491048"})
|
||||
res, err := client.OrderUrgent(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("用户催单失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 用户更新工单处理标识
|
||||
func TestOrderUpdateHandle(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateOrderUpdateHandleRequest(OrderUpdateHandleParam{
|
||||
IsHandle: 1,
|
||||
OrderNum: "20250530173554491048"})
|
||||
res, err := client.OrderUpdateHandle(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("用户催单失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 用户评价工单
|
||||
func TestOrderAppraise(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateOrderAppraiseRequest(OrderAppraiseParam{
|
||||
OrderNum: "20250530173554491048",
|
||||
Score: 5,
|
||||
})
|
||||
res, err := client.OrderAppraise(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("用户评价失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 工单重启
|
||||
func TestOrderRestart(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateOrderRestartRequest(OrderRestartParam{
|
||||
OrderNum: "20250530173554491048",
|
||||
SysRemarkContent: "模拟用户重启",
|
||||
SysRemarkPic: []string{},
|
||||
})
|
||||
res, err := client.OrderRestart(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("工单重启失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 提交工单
|
||||
func TestOrderSubmit(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateOrderSubmitRequest(OrderSubmitParam{
|
||||
SysGameId: 7874,
|
||||
SysUserName: "rz35990497",
|
||||
SysUid: 221016372,
|
||||
SysRoleId: "265500394",
|
||||
SysRoleName: "好玩的尼",
|
||||
SysServerName: "碧水连天",
|
||||
SysOrderTemplateCode: "findAccount",
|
||||
SysDetail: "测试go-common改动。",
|
||||
SysPhone: "13725263463",
|
||||
ApplyIp: "192.168.1.202",
|
||||
SysOrderParts: []OrderSubmitPart{
|
||||
{
|
||||
PartKey: "email",
|
||||
PartName: "联系邮箱",
|
||||
PartValue: "kingson2011@126.com",
|
||||
PicValue: nil,
|
||||
},
|
||||
{
|
||||
PartKey: "pay_pic",
|
||||
PartName: "充值凭证",
|
||||
PartValue: "",
|
||||
PicValue: []string{
|
||||
"uploads/068/068eefab055a96ae404db19b7a121898.jpeg",
|
||||
"uploads/908/90822cca4e87ed49acaf82050dd3ac09.jpeg",
|
||||
},
|
||||
},
|
||||
},
|
||||
SysSmsCode: "7204",
|
||||
})
|
||||
res, err := client.OrderSubmit(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("工单提交失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 用户工单补充资料
|
||||
func TestOrderFurtherPart(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateOrderFurtherPartRequest(OrderFurtherPartParam{
|
||||
OrderNum: "20250611160840208567",
|
||||
OrderParts: []OrderSubmitPart{
|
||||
{
|
||||
PartKey: "game_name",
|
||||
PartName: "游戏名称",
|
||||
PartValue: "镇魂街:最终章",
|
||||
},
|
||||
},
|
||||
})
|
||||
res, err := client.OrderFurtherPart(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("用户工单补充资料失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 工单列表查询
|
||||
func TestGetWorkOrderRecordList(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetWorkOrderRecordListRequest(GetWorkOrderRecordListParam{
|
||||
HandleStatus: "",
|
||||
UserName: "ws45265737",
|
||||
GameId: 7991,
|
||||
Page: 1,
|
||||
PageSize: 20,
|
||||
})
|
||||
res, err := client.OrderRecordList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("工单列表查询失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 工单详情查询
|
||||
func TestOrderRecordDetail(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetWorkOrderRecordDetailRequest(OrderDetailParam{
|
||||
OrderNum: "20250611160840208567",
|
||||
})
|
||||
res, err := client.OrderRecordDetail(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("工单详情查询失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 获取faq详情
|
||||
func TestGetFaqDetail(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetFaqDetailRequest(FaqDetailRequest{
|
||||
Id: int64(31),
|
||||
})
|
||||
res, err := client.GetFaqDetail(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 || res.Data.Id == 0 {
|
||||
t.Error("获取faq详情失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 获取热门faq
|
||||
func TestGetFaqHotList(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetHotFaqRequest()
|
||||
res, err := client.GetHotFaqList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 || len(res.Data) == 0 {
|
||||
t.Error("获取热门faq失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 清理faq列表缓存
|
||||
func TestClearFaqListCache(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateClearFaqListCacheRequest()
|
||||
res, err := client.ClearFaqListCache(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("清理faq列表缓存失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 清理faq详情缓存
|
||||
func TestClearFaqDetailCache(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateClearFaqDetailCacheRequest(FaqDetailRequest{
|
||||
Id: int64(30),
|
||||
})
|
||||
res, err := client.ClearFaqDetailCache(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("清理faq详情缓存失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 清理热门faq缓存
|
||||
func TestClearHotFaqCache(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateClearHotFaqCacheRequest()
|
||||
res, err := client.ClearHotFaqCache(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("清理热门faq缓存失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 获取人工客服链接,主体与游戏参数配置详情
|
||||
func TestGetLinkGameConfigDetail(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetLinkGameConfigRequest(LinkGameConfigRequest{
|
||||
Company: "JJW",
|
||||
})
|
||||
res, err := client.GetLinkGameConfig(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 || res.Data.SubjectSign == "" {
|
||||
t.Error("获取人工客服链接,主体与游戏参数配置详情失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res.Data))
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// 中旭人工客服链接,主体与游戏配置
|
||||
|
||||
type LinkGameConfig struct {
|
||||
SubjectSign string `json:"subject_sign"`
|
||||
SubjectName string `json:"subject_name"`
|
||||
LinkGameId int64 `json:"link_game_id"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
type GetLinkGameConfigRequest struct {
|
||||
*requests.JsonRequest
|
||||
Company string `position:"Json" field:"company"`
|
||||
}
|
||||
type GetLinkGameConfigResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data *LinkGameConfig `json:"data"`
|
||||
}
|
||||
type LinkGameConfigRequest struct {
|
||||
Company string `json:"company"`
|
||||
}
|
||||
|
||||
func CreateGetLinkGameConfigRequest(param LinkGameConfigRequest) (req *GetLinkGameConfigRequest) {
|
||||
req = &GetLinkGameConfigRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Company: param.Company,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/config/get_link_game_config")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetLinkGameConfigResponse() (response *GetLinkGameConfigResponse) {
|
||||
response = &GetLinkGameConfigResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,203 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// Faq 树状结构
|
||||
type Faq struct {
|
||||
Id int64 `json:"id"`
|
||||
ParentId int64 `json:"parent_id"`
|
||||
Title string `json:"title"`
|
||||
Answer string `json:"answer"`
|
||||
Type int64 `json:"type"`
|
||||
WorkOrderTemplateId int64 `json:"work_order_template_id"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
ProcessFlow string `json:"process_flow"`
|
||||
Children []*Faq `json:"children"`
|
||||
}
|
||||
|
||||
type GetFaqRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetFaqResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data Faq `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetFaqRequest() (req *GetFaqRequest) {
|
||||
req = &GetFaqRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/faq/list")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetFaqResponse() (response *GetFaqResponse) {
|
||||
response = &GetFaqResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// FaqDetail Faq详情
|
||||
type FaqDetail struct {
|
||||
Id int64 `json:"id"`
|
||||
ParentId int64 `json:"parent_id"`
|
||||
Title string `json:"title"`
|
||||
Answer string `json:"answer"`
|
||||
Type int64 `json:"type"`
|
||||
WorkOrderTemplateId int64 `json:"work_order_template_id"`
|
||||
ProcessFlow string `json:"process_flow"`
|
||||
WorkOrderTemplateCode string `json:"work_order_template_code"`
|
||||
}
|
||||
type GetFaqDetailRequest struct {
|
||||
*requests.JsonRequest
|
||||
Id int64 `position:"Json" field:"id"`
|
||||
}
|
||||
type GetFaqDetailResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data *FaqDetail `json:"data"`
|
||||
}
|
||||
type FaqDetailRequest struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
func CreateGetFaqDetailRequest(param FaqDetailRequest) (req *GetFaqDetailRequest) {
|
||||
req = &GetFaqDetailRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Id: param.Id,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/faq/detail")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetFaqDetailResponse() (response *GetFaqDetailResponse) {
|
||||
response = &GetFaqDetailResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 热门faq列表
|
||||
type HotFaq struct {
|
||||
Id int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
ParentId int64 `json:"parent_id"`
|
||||
ParentTitle string `json:"parent_title"`
|
||||
}
|
||||
type GetHotFaqRequest struct {
|
||||
*requests.JsonRequest
|
||||
}
|
||||
type GetHotFaqResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []HotFaq `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetHotFaqRequest() (req *GetHotFaqRequest) {
|
||||
req = &GetHotFaqRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/faq/hot_list")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetHotFaqResponse() (response *GetHotFaqResponse) {
|
||||
response = &GetHotFaqResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 清理faq树缓存
|
||||
type ClearFaqListCacheRequest struct {
|
||||
*requests.JsonRequest
|
||||
}
|
||||
type ClearFaqListCacheResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateClearFaqListCacheRequest() (req *ClearFaqListCacheRequest) {
|
||||
req = &ClearFaqListCacheRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/faq/clear_list_cache")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateClearFaqListCacheResponse() (response *ClearFaqListCacheResponse) {
|
||||
response = &ClearFaqListCacheResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 清理faq详情缓存
|
||||
type ClearFaqDetailCacheRequest struct {
|
||||
*requests.JsonRequest
|
||||
Id int64 `position:"Json" field:"id"`
|
||||
}
|
||||
type ClearFaqDetailCacheResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateClearFaqDetailCacheRequest(param FaqDetailRequest) (req *ClearFaqDetailCacheRequest) {
|
||||
req = &ClearFaqDetailCacheRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Id: param.Id,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/faq/clear_detail_cache")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateClearFaqDetailCacheResponse() (response *ClearFaqDetailCacheResponse) {
|
||||
response = &ClearFaqDetailCacheResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 清理热门faq缓存
|
||||
type ClearHotFaqCacheRequest struct {
|
||||
*requests.JsonRequest
|
||||
}
|
||||
type ClearHotFaqCacheResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateClearHotFaqCacheRequest() (req *ClearHotFaqCacheRequest) {
|
||||
req = &ClearHotFaqCacheRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/faq/clear_hot_list_cache")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateClearHotFaqCacheResponse() (response *ClearHotFaqCacheResponse) {
|
||||
response = &ClearHotFaqCacheResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,320 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
/**
|
||||
* 客服工单,相关方法
|
||||
*/
|
||||
|
||||
type UploadRequest struct {
|
||||
*requests.StreamRequest
|
||||
FileStream []byte
|
||||
}
|
||||
|
||||
type UploadResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
FileName string `json:"file_name"`
|
||||
FileUrl string `json:"file_url"`
|
||||
FilePath string `json:"file_path"`
|
||||
}
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
|
||||
func CreateUploadRequest() (req *UploadRequest) {
|
||||
req = &UploadRequest{
|
||||
StreamRequest: &requests.StreamRequest{},
|
||||
}
|
||||
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/upload_image")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateUploadResponse() (resp *UploadResponse) {
|
||||
return &UploadResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// 获取工单补充字段设置
|
||||
|
||||
// GetOrderFurtherPartParam 请求参数
|
||||
type GetOrderFurtherPartParam struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
}
|
||||
type GetOrderFurtherPartRequest struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
}
|
||||
type OrderFurtherPart struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
FurtherParts []*OrderPart `json:"further_parts"`
|
||||
}
|
||||
|
||||
type GetOrderFurtherPartResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Data OrderFurtherPart `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateGetOrderFurtherPartRequest(param GetOrderFurtherPartParam) (req *GetOrderFurtherPartRequest) {
|
||||
req = &GetOrderFurtherPartRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
OrderNum: param.OrderNum,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/get_order_further_part")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetOrderFurtherPartResponse() (resp *GetOrderFurtherPartResponse) {
|
||||
return &GetOrderFurtherPartResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// OrderUrgentParam 用户催单
|
||||
type OrderUrgentParam struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
}
|
||||
type OrderUrgentRequest struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
}
|
||||
type OrderUrgentResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateOrderUrgentRequest(param OrderUrgentParam) (req *OrderUrgentRequest) {
|
||||
req = &OrderUrgentRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
OrderNum: param.OrderNum,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_urgent")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateOrderUrgentResponse() (resp *OrderUrgentResponse) {
|
||||
return &OrderUrgentResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// OrderUpdateHandleParam 更新工单处理标识
|
||||
type OrderUpdateHandleParam struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
IsHandle int64 `json:"is_handle"`
|
||||
}
|
||||
type OrderUpdateHandleRequest struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
IsHandle int64 `position:"Json" field:"is_handle"`
|
||||
}
|
||||
type OrderUpdateHandleResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateOrderUpdateHandleRequest(param OrderUpdateHandleParam) (req *OrderUpdateHandleRequest) {
|
||||
req = &OrderUpdateHandleRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
OrderNum: param.OrderNum,
|
||||
IsHandle: param.IsHandle,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_handle")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateOrderUpdateHandleResponse() (resp *OrderUpdateHandleResponse) {
|
||||
return &OrderUpdateHandleResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// OrderAppraiseParam 用户评价工单
|
||||
type OrderAppraiseParam struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
Score int `json:"score"`
|
||||
}
|
||||
type OrderAppraiseRequest struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
Score int `position:"Json" field:"score"`
|
||||
}
|
||||
type OrderAppraiseResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateOrderAppraiseRequest(param OrderAppraiseParam) (req *OrderAppraiseRequest) {
|
||||
req = &OrderAppraiseRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
OrderNum: param.OrderNum,
|
||||
Score: param.Score,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_appraise")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateOrderAppraiseResponse() (resp *OrderAppraiseResponse) {
|
||||
return &OrderAppraiseResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// OrderRestartParam 用户重启工单
|
||||
type OrderRestartParam struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
SysRemarkContent string `json:"sys_remark_content"`
|
||||
SysRemarkPic []string `json:"sys_remark_pic"`
|
||||
UserName string `json:"user_name"`
|
||||
}
|
||||
type OrderRestartRequest struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
SysRemarkContent string `position:"Json" field:"sys_remark_content"`
|
||||
SysRemarkPic []string `position:"Json" field:"sys_remark_pic"`
|
||||
UserName string `position:"Json" field:"user_name"`
|
||||
}
|
||||
type OrderRestartResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateOrderRestartRequest(param OrderRestartParam) (req *OrderRestartRequest) {
|
||||
req = &OrderRestartRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
OrderNum: param.OrderNum,
|
||||
SysRemarkContent: param.SysRemarkContent,
|
||||
SysRemarkPic: param.SysRemarkPic,
|
||||
UserName: param.UserName,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_restart")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateOrderRestartResponse() (resp *OrderRestartResponse) {
|
||||
return &OrderRestartResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// OrderSubmitParam 工单提交
|
||||
type OrderSubmitParam struct {
|
||||
SysGameId int64 `json:"sys_game_id"`
|
||||
SysUserName string `json:"sys_user_name"`
|
||||
SysUid int64 `json:"sys_uid"`
|
||||
SysRoleId string `json:"sys_role_id"`
|
||||
SysRoleName string `json:"sys_role_name"`
|
||||
SysServerName string `json:"sys_server_name"`
|
||||
SysOrderTemplateCode string `json:"sys_order_template_code"`
|
||||
SysDetail string `json:"sys_detail"`
|
||||
SysPhone string `json:"sys_phone"`
|
||||
ApplyIp string `json:"apply_ip"`
|
||||
SysOrderParts []OrderSubmitPart `json:"sys_order_parts"`
|
||||
SysSmsCode string `json:"sys_sms_code"`
|
||||
}
|
||||
|
||||
type OrderSubmitPart struct {
|
||||
PartId int64 `json:"part_id"`
|
||||
PartKey string `json:"part_key"`
|
||||
PartName string `json:"part_name"`
|
||||
PartValue string `json:"part_value"`
|
||||
PartType int64 `json:"part_type"`
|
||||
PicValue []string `json:"pic_value"`
|
||||
}
|
||||
type OrderSubmitRequest struct {
|
||||
*requests.JsonRequest
|
||||
SysGameId int64 `position:"Json" field:"sys_game_id"`
|
||||
SysUserName string `position:"Json" field:"sys_user_name"`
|
||||
SysUid int64 `position:"Json" field:"sys_uid"`
|
||||
SysRoleId string `position:"Json" field:"sys_role_id"`
|
||||
SysRoleName string `position:"Json" field:"sys_role_name"`
|
||||
SysServerName string `position:"Json" field:"sys_server_name"`
|
||||
SysOrderTemplateCode string `position:"Json" field:"sys_order_template_code"`
|
||||
SysDetail string `position:"Json" field:"sys_detail"`
|
||||
SysPhone string `position:"Json" field:"sys_phone"`
|
||||
ApplyIp string `position:"Json" field:"apply_ip"`
|
||||
SysOrderParts []OrderSubmitPart `position:"Json" field:"sys_order_parts"`
|
||||
SysSmsCode string `position:"Json" field:"sys_sms_code"`
|
||||
}
|
||||
type OrderSubmitResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateOrderSubmitRequest(param OrderSubmitParam) (req *OrderSubmitRequest) {
|
||||
req = &OrderSubmitRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
SysGameId: param.SysGameId,
|
||||
SysUserName: param.SysUserName,
|
||||
SysUid: param.SysUid,
|
||||
SysRoleId: param.SysRoleId,
|
||||
SysRoleName: param.SysRoleName,
|
||||
SysServerName: param.SysServerName,
|
||||
SysOrderTemplateCode: param.SysOrderTemplateCode,
|
||||
SysDetail: param.SysDetail,
|
||||
SysPhone: param.SysPhone,
|
||||
ApplyIp: param.ApplyIp,
|
||||
SysOrderParts: param.SysOrderParts,
|
||||
SysSmsCode: param.SysSmsCode,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_submit")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateOrderSubmitResponse() (resp *OrderSubmitResponse) {
|
||||
return &OrderSubmitResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// OrderFurtherPartParam 工单补充资料
|
||||
type OrderFurtherPartParam struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
OrderParts []OrderSubmitPart `json:"order_parts"`
|
||||
UserName string `json:"user_name"`
|
||||
}
|
||||
type OrderFurtherPartRequest struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
OrderParts []OrderSubmitPart `position:"Json" field:"order_parts"`
|
||||
UserName string `position:"Json" field:"user_name"`
|
||||
}
|
||||
type OrderFurtherPartResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateOrderFurtherPartRequest(param OrderFurtherPartParam) (req *OrderFurtherPartRequest) {
|
||||
req = &OrderFurtherPartRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
OrderNum: param.OrderNum,
|
||||
OrderParts: param.OrderParts,
|
||||
UserName: param.UserName,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_further_data")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateOrderFurtherPartResponse() (resp *OrderFurtherPartResponse) {
|
||||
return &OrderFurtherPartResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,140 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// 获取客服工单列表
|
||||
|
||||
type GetWorkOrderRecordListParam struct {
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
Page int64 `position:"Json" field:"page"`
|
||||
PageSize int64 `position:"Json" field:"page_size"`
|
||||
UserName string `position:"Json" field:"user_name"`
|
||||
GameId int64 `position:"Json" field:"game_id"`
|
||||
HandleStatus string `position:"Json" field:"handle_status"`
|
||||
}
|
||||
type OrderRecord struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
WorkOrderTemplateFirstLevelName string `json:"work_order_template_first_level_name"`
|
||||
UserName string `json:"user_name"`
|
||||
GameId int64 `json:"game_id"`
|
||||
GameName string `json:"game_name"`
|
||||
RoleId string `json:"role_id"`
|
||||
RoleName string `json:"role_name"`
|
||||
ServerName string `json:"server_name"`
|
||||
Detail string `json:"detail"`
|
||||
ApplyTime string `json:"apply_time"`
|
||||
HandleStatus string `json:"handle_status"`
|
||||
HandleStatusName string `json:"handle_status_name"`
|
||||
IsUrgent int64 `json:"is_urgent"`
|
||||
IsAppraise int64 `json:"is_appraise"`
|
||||
FinishTime string `json:"finish_time"`
|
||||
OrderParts []*OrderSubmitPart `json:"order_parts"`
|
||||
Id int64 `json:"id"`
|
||||
WorkOrderTemplateFirstLevelId int64 `json:"work_order_template_first_level_id"`
|
||||
WorkOrderTemplateId int64 `json:"work_order_template_id"`
|
||||
WorkOrderTemplateName string `json:"work_order_template_name"`
|
||||
Uid int64 `json:"uid"`
|
||||
OrderStatus string `json:"order_status"`
|
||||
OrderStatusName string `json:"order_status_name"`
|
||||
}
|
||||
|
||||
// PageInfoResp 分页响应
|
||||
type PageInfoResp struct {
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
TotalNumber int `json:"total_number"`
|
||||
TotalPage int `json:"total_page"`
|
||||
}
|
||||
|
||||
type GetWorkOrderRecordListResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Data struct {
|
||||
Data []*OrderRecord `json:"data"`
|
||||
PageInfo *PageInfoResp `json:"page_info"`
|
||||
} `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
type GetWorkOrderRecordListRequest struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
Page int64 `position:"Json" field:"page"`
|
||||
PageSize int64 `position:"Json" field:"page_size"`
|
||||
UserName string `position:"Json" field:"user_name"`
|
||||
GameId int64 `position:"Json" field:"game_id"`
|
||||
HandleStatus string `position:"Json" field:"handle_status"`
|
||||
}
|
||||
|
||||
func CreateGetWorkOrderRecordListRequest(param GetWorkOrderRecordListParam) (req *GetWorkOrderRecordListRequest) {
|
||||
req = &GetWorkOrderRecordListRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
}
|
||||
req.OrderNum = param.OrderNum
|
||||
req.Page = param.Page
|
||||
req.PageSize = param.PageSize
|
||||
req.UserName = param.UserName
|
||||
req.GameId = param.GameId
|
||||
req.HandleStatus = param.HandleStatus
|
||||
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_record_list")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetWorkOrderRecordListResponse() (resp *GetWorkOrderRecordListResponse) {
|
||||
resp = &GetWorkOrderRecordListResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 工单详情
|
||||
|
||||
type OrderDetailParam struct {
|
||||
OrderNum string `json:"order_num"`
|
||||
}
|
||||
type OrderLog struct {
|
||||
Id int64 `json:"id"`
|
||||
ApplyCount int64 `json:"apply_count"`
|
||||
ActionType string `json:"action_type"`
|
||||
PlayerLinkType string `json:"player_link_type"`
|
||||
PlayerLinkTypeName string `json:"player_link_type_name"`
|
||||
Content []*OrderSubmitPart `json:"content"`
|
||||
PicContent []*OrderSubmitPart `json:"pic_content"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
type OrderDetail struct {
|
||||
OrderRecord *OrderRecord `json:"order_record"`
|
||||
OrderLogs []*OrderLog `json:"order_logs"`
|
||||
}
|
||||
type GetWorkOrderRecordDetailResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Data OrderDetail `json:"data"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
type GetWorkOrderRecordDetailReq struct {
|
||||
*requests.JsonRequest
|
||||
OrderNum string `position:"Json" field:"order_num"`
|
||||
}
|
||||
|
||||
func CreateGetWorkOrderRecordDetailRequest(param OrderDetailParam) (req *GetWorkOrderRecordDetailReq) {
|
||||
req = &GetWorkOrderRecordDetailReq{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
}
|
||||
req.OrderNum = param.OrderNum
|
||||
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order/order_record_detail")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetWorkOrderRecordDetailResp() (resp *GetWorkOrderRecordDetailResp) {
|
||||
resp = &GetWorkOrderRecordDetailResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,55 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// OrderTemplate 工单模板
|
||||
type OrderTemplate struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
UniqueCode string `json:"unique_code"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
TemplateParts []*OrderPart `json:"template_parts"`
|
||||
}
|
||||
|
||||
// OrderPart 工单字段
|
||||
type OrderPart struct {
|
||||
Id int64 `json:"id"`
|
||||
PartName string `json:"part_name"`
|
||||
PartKey string `json:"part_key"`
|
||||
PartType int64 `json:"part_type"`
|
||||
IsRequire int64 `json:"is_require"`
|
||||
TipsContent string `json:"tips_content"`
|
||||
MaxNum int64 `json:"max_num"`
|
||||
}
|
||||
|
||||
type OrderTemplateDetailReq struct {
|
||||
*requests.JsonRequest
|
||||
Id int64 `position:"Json" field:"id"`
|
||||
}
|
||||
type OrderTemplateDetailResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data OrderTemplate `json:"data"`
|
||||
}
|
||||
|
||||
func CreateOrderTemplateDetailReq(templateId int64) (req *OrderTemplateDetailReq) {
|
||||
req = &OrderTemplateDetailReq{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Id: templateId,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/work_order_template/detail")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateOrderTemplateDetailResp() (response *OrderTemplateDetailResp) {
|
||||
response = &OrderTemplateDetailResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
@ -1,157 +0,0 @@
|
||||
package cs
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
/**
|
||||
* 获取玩家(用户)相关信息
|
||||
*/
|
||||
|
||||
// UserInfo 用户信息
|
||||
type UserInfo struct {
|
||||
UserName string `json:"user_name"`
|
||||
Uid int64 `json:"uid"`
|
||||
Telephone string `json:"telephone"`
|
||||
}
|
||||
|
||||
type GetUserInfoRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserInfoResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data UserInfo `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetUserInfoRequest(userName string) (req *GetUserInfoRequest) {
|
||||
req = &GetUserInfoRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/user/info")
|
||||
|
||||
req.FormParams = map[string]string{
|
||||
"user_name": userName,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserInfoResponse() (response *GetUserInfoResponse) {
|
||||
response = &GetUserInfoResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UserRoleInfo 玩家角色信息
|
||||
type UserRoleInfo struct {
|
||||
Uid int64 `json:"uid"`
|
||||
RoleName string `json:"role_name"`
|
||||
RoleId string `json:"role_id"`
|
||||
}
|
||||
|
||||
type GetUserRoleListRequest struct {
|
||||
*requests.JsonRequest
|
||||
}
|
||||
|
||||
type GetUserRoleListResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []UserRoleInfo `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetUserRoleListRequest(uId int64, gameId int64) (req *GetUserRoleListRequest) {
|
||||
req = &GetUserRoleListRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/user/role_list")
|
||||
|
||||
req.JsonParams["uid"] = uId
|
||||
req.JsonParams["game_id"] = gameId
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetUserRoleListResponse() (response *GetUserRoleListResponse) {
|
||||
response = &GetUserRoleListResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UserServerInfo 玩家区服信息
|
||||
type UserServerInfo struct {
|
||||
ServerName string `json:"server_name"`
|
||||
}
|
||||
type GetUserServerListRequest struct {
|
||||
*requests.JsonRequest
|
||||
}
|
||||
type GetUserServerListResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []UserServerInfo `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetUserServerListRequest(uId int64, gameId int64) (req *GetUserServerListRequest) {
|
||||
req = &GetUserServerListRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/user/server_list")
|
||||
|
||||
req.JsonParams["uid"] = uId
|
||||
req.JsonParams["game_id"] = gameId
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateGetUserServerListResponse() (response *GetUserServerListResponse) {
|
||||
response = &GetUserServerListResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type SendSmsReq struct {
|
||||
Phone string `json:"phone"`
|
||||
}
|
||||
|
||||
// SendSmsResp 发送短信返回
|
||||
type SendSmsResp struct {
|
||||
// 短信发送时间戳,工单模块 有效期5分钟
|
||||
SendCodeTime int64 `json:"send_code_time"`
|
||||
}
|
||||
|
||||
type SendSmsRequest struct {
|
||||
*requests.JsonRequest
|
||||
Phone string `position:"Json" field:"phone"`
|
||||
}
|
||||
type SendSmsResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data SendSmsResp `json:"data"`
|
||||
}
|
||||
|
||||
func CreateSendSmsRequest(param SendSmsReq) (req *SendSmsRequest) {
|
||||
req = &SendSmsRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Phone: param.Phone,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/user/send_sms")
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateSendSmsResponse() (response *SendSmsResponse) {
|
||||
response = &SendSmsResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,133 +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 GetAnchorUserReq struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
AnchorType int64 `position:"Body" field:"type"`
|
||||
Columns string `position:"Body" field:"columns"`
|
||||
}
|
||||
|
||||
type GetAnchorUserResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data AnchorUser `json:"data"`
|
||||
}
|
||||
|
||||
type AnchorUser struct {
|
||||
Id int64 `json:"id"`
|
||||
UserName string `json:"user_name"`
|
||||
JoinTime int64 `json:"join_time"`
|
||||
Remark string `json:"remark"`
|
||||
AutoAudit int64 `json:"auto_audit"`
|
||||
VirtualWithdraw int64 `json:"virtual_withdraw"`
|
||||
Status int64 `json:"status"`
|
||||
Level int64 `json:"level"`
|
||||
ZhuanshengLv int64 `json:"zhuansheng_lv"`
|
||||
MoneyId int64 `json:"money_id"`
|
||||
PayEntryStatus int64 `json:"pay_entry_status"`
|
||||
IssueMoneyMax float64 `json:"issue_money_max"`
|
||||
RealMoneyProportion float64 `json:"real_money_proportion"`
|
||||
DayIssueMoneyLimit float64 `json:"day_issue_money_limit"`
|
||||
IssueRegTimeLimit int64 `json:"issue_reg_time_limit"`
|
||||
IssueRoleCreateTimeLimit int64 `json:"issue_role_create_time_limit"`
|
||||
AnchorType int64 `json:"type"`
|
||||
GameIds string `json:"game_ids"`
|
||||
AgentIds string `json:"agent_ids"`
|
||||
DayWithdrawLimit float64 `json:"day_withdraw_limit"`
|
||||
BankCompany string `json:"bank_company"`
|
||||
BankAccount string `json:"bank_account"`
|
||||
BankCardName string `json:"bank_card_name"`
|
||||
PayPassword string `json:"pay_password"`
|
||||
IssueConfigIds string `json:"issue_config_ids"`
|
||||
BigMoneyProportion int64 `json:"big_money_proportion"`
|
||||
BigMoneyRangeMin int64 `json:"big_money_range_min"`
|
||||
BigMoneyRangeMax int64 `json:"big_money_range_max"`
|
||||
}
|
||||
|
||||
func CreateGetAnchorUserReq(UserName string, AnchorType int64, Columns string) *GetAnchorUserReq {
|
||||
req := &GetAnchorUserReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.UserName = UserName
|
||||
req.AnchorType = AnchorType
|
||||
req.Columns = Columns
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/activity/getAnchorUser")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetAnchorUserResp() *GetAnchorUserResp {
|
||||
return &GetAnchorUserResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
type GetRoleReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int64 `position:"Body" field:"game_id"`
|
||||
UserId string `position:"Body" field:"user_id"`
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
RegTime int64 `position:"Body" field:"reg_time"`
|
||||
RoleId string `position:"Body" field:"role_id"`
|
||||
ServerId int64 `position:"Body" field:"server_id"`
|
||||
UseCache int64 `position:"Body" field:"use_cache"`
|
||||
NoVirtual int64 `position:"Body" field:"no_virtual"`
|
||||
}
|
||||
|
||||
type RoleItem struct {
|
||||
RoleId string `json:"roleId"`
|
||||
Name string `json:"name"`
|
||||
Server int64 `json:"server"`
|
||||
ServerName string `json:"serverName"`
|
||||
Level int64 `json:"level"`
|
||||
VipLevel int64 `json:"vipLevel"`
|
||||
CreateTime int64 `json:"createTime"`
|
||||
RoleLevelUpdateTime int64 `json:"roleLevelUpdateTime"`
|
||||
Power int64 `json:"power"`
|
||||
Profession string `json:"profession"`
|
||||
Gold int64 `json:"gold"`
|
||||
CouponCount any `json:"couponCount"`
|
||||
CouponActCount any `json:"couponActCount"`
|
||||
ZhuanshengLv int64 `json:"zhuansheng_lv"`
|
||||
ZhuanshengName string `json:"zhuanshengName"`
|
||||
Points int64 `json:"points"`
|
||||
MiniCustomsPass any `json:"miniCustomsPass"`
|
||||
CardIds string `json:"cardIds"`
|
||||
DayData any `json:"dayData"`
|
||||
RoleExtData any `json:"roleExtData"`
|
||||
}
|
||||
|
||||
type RoleInfo struct {
|
||||
RoleItem
|
||||
FromCache int64 `json:"from_cache"`
|
||||
}
|
||||
|
||||
type GetRoleResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
RoleInfo RoleInfo `json:"role_info"`
|
||||
RoleListInfo []RoleItem `json:"role_list_info"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetRoleReq(param *GetRoleReq) *GetRoleReq {
|
||||
if param == nil {
|
||||
param = &GetRoleReq{}
|
||||
}
|
||||
param.RpcRequest = &requests.RpcRequest{}
|
||||
param.InitWithApiInfo(HOST, VERSION, "/api/activity/getRole")
|
||||
param.Method = requests.POST
|
||||
return param
|
||||
}
|
||||
|
||||
func CreateGetRoleResp() *GetRoleResp {
|
||||
return &GetRoleResp{BaseResponse: &responses.BaseResponse{}}
|
||||
}
|
||||
@ -1,55 +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 GetActivityVipUserNewWhitelistReq struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name" default:""`
|
||||
}
|
||||
|
||||
type GetActivityVipUserNewBlacklistReq struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name" default:""`
|
||||
}
|
||||
|
||||
type ActivityVipUserNewInfo struct {
|
||||
Id int64 `json:"id"`
|
||||
UserName string `json:"user_name"`
|
||||
UserType int `json:"user_type"`
|
||||
}
|
||||
|
||||
type GetActivityVipUserNewResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data *ActivityVipUserNewInfo `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetActivityVipUserNewWhitelistReq(userName string) *GetActivityVipUserNewWhitelistReq {
|
||||
req := &GetActivityVipUserNewWhitelistReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.UserName = userName
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/login/getActivityVipUserNewWhitelist")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetActivityVipUserNewBlacklistReq(userName string) *GetActivityVipUserNewBlacklistReq {
|
||||
req := &GetActivityVipUserNewBlacklistReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.UserName = userName
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/login/getActivityVipUserNewBlacklist")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetActivityVipUserNewResp() *GetActivityVipUserNewResp {
|
||||
return &GetActivityVipUserNewResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
}
|
||||
@ -1,214 +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 = "2025-05-28"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
// GetGameInfo 获取游戏信息
|
||||
func (c *Client) GetGameInfo(req *GetGameInfoReq) (resp *GetGameInfoResp, err error) {
|
||||
resp = CreateGetGameInfoByIdResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) GetChannelInfo(req *ChannelInfoReq) (resp *ChannelInfoResp, err error) {
|
||||
resp = CreateChannelInfoResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) GetLoginInfoById(req *GetLoginInfoByIdReq) (resp *GetLoginInfoByIdResp, err error) {
|
||||
resp = CreateGetLoginInfoByIdResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetActivityVipUserNewWhitelist 获取活动 VIP 白名单用户
|
||||
func (c *Client) GetActivityVipUserNewWhitelist(req *GetActivityVipUserNewWhitelistReq) (resp *GetActivityVipUserNewResp, err error) {
|
||||
resp = CreateGetActivityVipUserNewResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetActivityVipUserNewBlacklist 获取活动 VIP 黑名单用户
|
||||
func (c *Client) GetActivityVipUserNewBlacklist(req *GetActivityVipUserNewBlacklistReq) (resp *GetActivityVipUserNewResp, err error) {
|
||||
resp = CreateGetActivityVipUserNewResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) GetProtocolByGameId(req *GetProtocolByGameIdRep) (resp *GetProtocolByGameIdResp, err error) {
|
||||
resp = CreateGetProtocolByGameIdResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameSimpleList 获取子游戏简单列表
|
||||
func (c *Client) GetGameSimpleList(req *GetGameSimpleListReq) (resp *GetGameSimpleListResp, err error) {
|
||||
resp = CreateGetGameSimpleListResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameServerV2 获取游戏服务器列表v2
|
||||
func (c *Client) GetGameServerV2(req *GetServerV2Request) (resp *GetServerV2Response, err error) {
|
||||
resp = CreateGetServerV2Response()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameCompany 获取单个根游戏信息
|
||||
func (c *Client) GetGameCompany(req *GetGameCompanyReq) (resp *GetGameCompanyResp, err error) {
|
||||
resp = CreateGetGameCompanyResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetIsBlockOutIos 获取iOS切支付规则
|
||||
func (c *Client) GetIsBlockOutIos(req *IsBlockOutIosReq) (resp *IsBlockOutIosResp, err error) {
|
||||
resp = CreateIsBlockOutIosResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) GetGameVersion(req *GetGameVersionReq) (resp *GetGameVersionResp, err error) {
|
||||
resp = CreateGetGameVersionResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetConfig 获取游戏全局配置
|
||||
func (c *Client) GetConfig(req *GetConfigReq) (resp *GetConfigResp, err error) {
|
||||
resp = CreateGetConfigResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetRealAuthBlackList 获取实名黑名单
|
||||
func (c *Client) GetRealAuthBlackList(req *GetRealAuthBlackListReq) (resp *GetRealAuthBlackListResp, err error) {
|
||||
resp = CreateGetRealAuthBlackListResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameRealAuthInfo 获取实名参数
|
||||
func (c *Client) GetGameRealAuthInfo(req *GetGameRealAuthInfoReq) (resp *GetGameRealAuthInfoResp, err error) {
|
||||
resp = CreateGetGameRealAuthInfoResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetProtocolByCompany 根据主体获取用户协议
|
||||
func (c *Client) GetProtocolByCompany(req *GetProtocolByCompanyRep) (resp *GetProtocolByCompanyResp, err error) {
|
||||
resp = CreateGetProtocolByCompanyResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// KickUser 踢人
|
||||
func (c *Client) KickUser(req *KickUserReq) (resp *KickUserResp, err error) {
|
||||
resp = CreateKickUserResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetLoginBg 获取登录背景图
|
||||
func (c *Client) GetLoginBg(req *GetLoginBgReq) (resp *GetLoginBgResp, err error) {
|
||||
resp = CreateGetLoginBgResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetLabelListByCate
|
||||
// 通过分类获取标签列表
|
||||
func (c *Client) GetLabelListByCate(req *GetLabelListByCateRep) (response *GetLabelListByCateResp, err error) {
|
||||
response = CreateGetLabelListByCateResp()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameClientInfo
|
||||
// 获取游戏版本信息
|
||||
func (c *Client) GetGameClientInfo(gameId, status int64) (response *ClientInfoResp, err error) {
|
||||
clientInfoReq := CreateClientInfoReq(status, gameId)
|
||||
response = CreateClientInfoResp()
|
||||
err = c.DoAction(clientInfoReq, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameRoleName
|
||||
// 获取游戏角色信息
|
||||
func (c *Client) GetGameRoleName(req *GetGameRoleNameReq) (response *GetGameRoleNameResp, err error) {
|
||||
response = CreateGetGameRoleNameResp()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetAnchorUser
|
||||
// 获取主播信息接口
|
||||
func (c *Client) GetAnchorUser(req *GetAnchorUserReq) (resp *GetAnchorUserResp, err error) {
|
||||
resp = CreateGetAnchorUserResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetSdkTheme 获取sdk主题
|
||||
func (c *Client) GetSdkTheme(req *GetSdkThemeReq) (response *GetSdkThemeResp, err error) {
|
||||
response = CreateGetSdkThemeResp()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetGameListExtInfo 获取游戏扩展信息
|
||||
func (c *Client) GetGameListExtInfo(req *GetGameListExtInfoReq) (response *GetGameListExtInfoResp, err error) {
|
||||
response = CreateGetGameListExtInfoResp()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// MakeOrder 预下单(线下支付)
|
||||
func (c *Client) MakeOrder(req *MakeOrderReq) (response *MakeOrderResp, err error) {
|
||||
response = CreateMakeOrderResp()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetRole 获取游戏角色信息
|
||||
func (c *Client) GetRole(req *GetRoleReq) (response *GetRoleResp, err error) {
|
||||
response = CreateGetRoleResp()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetPaySwitchUser 微信小游戏切支付名单中转查询(按 user_name + game_id 读 db_center 名单,返回 status + risk_level)
|
||||
func (c *Client) GetPaySwitchUser(req *GetPaySwitchUserReq) (resp *GetPaySwitchUserResp, err error) {
|
||||
resp = CreateGetPaySwitchUserResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
@ -1,435 +0,0 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func TestGetGameInfo(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
resp, err := client.GetGameInfo(CreateGetGameInfoByIdReq(797, 1))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(resp.Code, resp.Msg, resp.Data.GameHomeShortImage)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
func TestLoginInfoById(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
req := CreateGetLoginInfoByIdReq(7349, "1.0.0")
|
||||
info, err := client.GetLoginInfoById(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(info)
|
||||
}
|
||||
|
||||
func TestGetProtocolByGameId(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
req := CreateGetProtocolByGameIdRep()
|
||||
req.GameId = 8088
|
||||
req.GameVersion = "1.1.0"
|
||||
req.Type = 1
|
||||
info, err := client.GetProtocolByGameId(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(info)
|
||||
}
|
||||
|
||||
func TestGetGameSimpleList(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
req := CreateGetGameSimpleListReq("8071,8062", "")
|
||||
info, err := client.GetGameSimpleList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(info)
|
||||
}
|
||||
|
||||
func TestGetGameServerV2(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateGetServerV2Request("n2", "", "")
|
||||
info, err := client.GetGameServerV2(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(info)
|
||||
}
|
||||
|
||||
func TestGetGameCompany(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateGetGameCompanyReq("ascq")
|
||||
gameCompany, err := client.GetGameCompany(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(gameCompany)
|
||||
fmt.Println(gameCompany.Data.System)
|
||||
}
|
||||
|
||||
func TestIsBlockOutIos(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
isBlockOutIosReq := CreateIsBlockOutIosReq("ec63860282", 4570, "116.26.129.38", "", 0, 0)
|
||||
isBlockOutIos, err := client.GetIsBlockOutIos(isBlockOutIosReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
||||
// 获取游戏全局配置
|
||||
func TestGetConfig(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getConfigReq := CreateGetConfigReq("overlord_act_config")
|
||||
isBlockOutIos, err := client.GetConfig(getConfigReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
||||
// 获取实名黑名单
|
||||
func TestGetRealAuthBlackList(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getRealAuthBlackListReq := CreateGetRealAuthBlackListReq()
|
||||
isBlockOutIos, err := client.GetRealAuthBlackList(getRealAuthBlackListReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
||||
// 获取游戏实名参数
|
||||
func TestGetGameRealAuthInfo(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getGameRealAuthInfoReq := CreateGetGameRealAuthInfoReq(7081)
|
||||
isBlockOutIos, err := client.GetGameRealAuthInfo(getGameRealAuthInfoReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(isBlockOutIos)
|
||||
}
|
||||
|
||||
func TestGetGameVersion(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateGetGameVersionReq(8071, "1.0.6")
|
||||
resp, err := client.GetGameVersion(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(resp)
|
||||
}
|
||||
|
||||
func TestClient_GetProtocolByCompany(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateGetProtocolByCompanyRep()
|
||||
req.Company = "GR"
|
||||
req.Type = 0
|
||||
resp, err := client.GetProtocolByCompany(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(resp.Code, resp.Msg, resp.Data.Content)
|
||||
}
|
||||
|
||||
// 测试踢人
|
||||
func TestKickUser(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
} // CreateKickUserReq
|
||||
getRealAuthBlackListReq := CreateKickUserReq(8677, "wzcqtest", "8676", time.Now().Unix())
|
||||
kickUserResp, err := client.KickUser(getRealAuthBlackListReq)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(kickUserResp)
|
||||
}
|
||||
|
||||
// 测试获取h5登录背景图
|
||||
func TestGetLoginBg(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
getLoginBgResp, err := client.GetLoginBg(CreateGetLoginBgReq(6086))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(getLoginBgResp)
|
||||
}
|
||||
|
||||
func TestGetGameClientInfo(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
return
|
||||
}
|
||||
resp, err := client.GetGameClientInfo(8961, 4)
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
return
|
||||
}
|
||||
_ = resp
|
||||
}
|
||||
|
||||
func TestGetAnchorUser(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateGetAnchorUserReq("vd22543241", 2, "*")
|
||||
getAnchorUser, err := client.GetAnchorUser(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(getAnchorUser)
|
||||
fmt.Println(getAnchorUser.Data.UserName)
|
||||
fmt.Println(getAnchorUser.Data.Id)
|
||||
}
|
||||
|
||||
func TestGetSdkTheme(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateGetSdkThemeReq(1058, "1.2.0")
|
||||
sdkTheme, err := client.GetSdkTheme(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(sdkTheme.Status, sdkTheme.Code, sdkTheme.Msg)
|
||||
fmt.Println(sdkTheme.Data)
|
||||
}
|
||||
|
||||
func TestGetGameListExtInfo(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateGetGameListExtInfoReq(7680)
|
||||
gameListExtInfo, err := client.GetGameListExtInfo(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(gameListExtInfo.Status, gameListExtInfo.Code, gameListExtInfo.Msg)
|
||||
fmt.Printf("%+v\n", gameListExtInfo.Data)
|
||||
}
|
||||
|
||||
func TestGetActivityVipUserNewWhitelist(t *testing.T) {
|
||||
req := CreateGetActivityVipUserNewWhitelistReq("lmw888")
|
||||
if err := requests.InitParam(req); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if req.GetMethod() != requests.POST || req.GetActionName() != "/api/login/getActivityVipUserNewWhitelist" {
|
||||
t.Errorf("whitelist req: method=%s path=%s", req.GetMethod(), req.GetActionName())
|
||||
return
|
||||
}
|
||||
if req.GetFormParams()["user_name"] != "lmw888" {
|
||||
t.Errorf("whitelist user_name: %q", req.GetFormParams()["user_name"])
|
||||
return
|
||||
}
|
||||
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
resp, err := client.GetActivityVipUserNewWhitelist(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if resp == nil {
|
||||
t.Errorf("whitelist response is nil")
|
||||
return
|
||||
}
|
||||
if resp.Code != 1 || resp.Msg != "获取成功" || resp.Data == nil || resp.Data.UserType != 1 {
|
||||
t.Errorf("whitelist response: code=%d msg=%s data=%+v", resp.Code, resp.Msg, resp.Data)
|
||||
fmt.Printf("%#+v\n", resp)
|
||||
return
|
||||
}
|
||||
fmt.Printf("%#+v\n", resp)
|
||||
if resp.Data != nil {
|
||||
fmt.Printf("%#+v\n", *resp.Data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetActivityVipUserNewBlacklist(t *testing.T) {
|
||||
req := CreateGetActivityVipUserNewBlacklistReq("lmw777")
|
||||
if err := requests.InitParam(req); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if req.GetMethod() != requests.POST || req.GetActionName() != "/api/login/getActivityVipUserNewBlacklist" {
|
||||
t.Errorf("blacklist req: method=%s path=%s", req.GetMethod(), req.GetActionName())
|
||||
return
|
||||
}
|
||||
if req.GetFormParams()["user_name"] != "lmw777" {
|
||||
t.Errorf("blacklist user_name: %q", req.GetFormParams()["user_name"])
|
||||
return
|
||||
}
|
||||
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
resp, err := client.GetActivityVipUserNewBlacklist(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if resp == nil {
|
||||
t.Errorf("blacklist response is nil")
|
||||
return
|
||||
}
|
||||
if resp.Code != 1 || resp.Msg != "获取成功" || resp.Data == nil || resp.Data.UserType != 2 {
|
||||
t.Errorf("blacklist response: code=%d msg=%s data=%+v", resp.Code, resp.Msg, resp.Data)
|
||||
fmt.Printf("%#+v\n", resp)
|
||||
return
|
||||
}
|
||||
fmt.Printf("%#+v\n", resp)
|
||||
if resp.Data != nil {
|
||||
fmt.Printf("%#+v\n", *resp.Data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateMakeOrderReq(t *testing.T) {
|
||||
req := CreateMakeOrderReq(MakeOrderParam{
|
||||
Username: "rz35990497",
|
||||
Gid: 7874,
|
||||
Sid: "2918",
|
||||
RealSid: "",
|
||||
RoleId: "587102307",
|
||||
RoleName: "繁华之泰坦",
|
||||
Money: 630,
|
||||
ServerName: "碧水连天",
|
||||
ProductName: "630",
|
||||
DwId: 1008,
|
||||
})
|
||||
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
resp, err := client.MakeOrder(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(resp.Data)
|
||||
}
|
||||
|
||||
func TestGetRole(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
//game_id=9175&server_id=0&user_id=247058227&user_name=yg90938415&no_virtual=1
|
||||
//game_id=3706&no_virtual=1®_time=0&server_id=0&use_cache=0&user_id=253403109&user_name=nl16840512
|
||||
req := CreateGetRoleReq(&GetRoleReq{
|
||||
ServerId: 10358,
|
||||
GameId: 8049,
|
||||
UserId: "135837010",
|
||||
UserName: "qy13815523",
|
||||
NoVirtual: 1,
|
||||
})
|
||||
resp, err := client.GetRole(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
fmt.Printf("%+v", resp)
|
||||
}
|
||||
@ -1,664 +0,0 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"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/utils"
|
||||
)
|
||||
|
||||
const gameKey = "gaoreapi"
|
||||
|
||||
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{},
|
||||
}
|
||||
}
|
||||
|
||||
type GetGameInfoReq struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetGameInfoResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GameInfoData `json:"data"`
|
||||
}
|
||||
|
||||
type GetGameInfoReqData struct {
|
||||
GameId int
|
||||
NoCache int
|
||||
}
|
||||
|
||||
type GameInfoData struct {
|
||||
AcceptRelatedGame int `json:"accept_related_game"`
|
||||
ActCodeState int `json:"act_code_state"`
|
||||
AgentSign string `json:"agent_sign"`
|
||||
AppId string `json:"app_id"`
|
||||
AppName string `json:"app_name"`
|
||||
Autologin int `json:"autologin"`
|
||||
BName string `json:"b_name"`
|
||||
BackResult int `json:"back_result"`
|
||||
BusinessPurpose int `json:"business_purpose"`
|
||||
ChannelShow int `json:"channel_show"`
|
||||
ClientType int `json:"client_type"`
|
||||
Company string `json:"company"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
CreatedRealname string `json:"created_realname"`
|
||||
CreatedUsername string `json:"created_username"`
|
||||
DisableBack int `json:"disable_back"`
|
||||
DisablePay int `json:"disable_pay"`
|
||||
DisableRegister int `json:"disable_register"`
|
||||
DisableRelatedBack int `json:"disable_related_back"`
|
||||
DisableUnrelatedLogin int `json:"disable_unrelated_login"`
|
||||
Discount int `json:"discount"`
|
||||
Divide int `json:"divide"`
|
||||
DownloadDomain string `json:"download_domain"`
|
||||
DownloadId string `json:"download_id"`
|
||||
ExchangeRate int `json:"exchange_rate"`
|
||||
ExtData string `json:"ext_data"`
|
||||
Fcmathod int `json:"fcmathod"`
|
||||
FirstLetter string `json:"first_letter"`
|
||||
FlashAuthId string `json:"flash_auth_id"`
|
||||
FlashAuthKey string `json:"flash_auth_key"`
|
||||
FlashAuthLogo string `json:"flash_auth_logo"`
|
||||
FlashAuthName string `json:"flash_auth_name"`
|
||||
FlashAuthStatus int `json:"flash_auth_status"`
|
||||
FlashPassId string `json:"flash_pass_id"`
|
||||
FlashPassKey string `json:"flash_pass_key"`
|
||||
GameByname string `json:"game_byname"`
|
||||
GameIconImg string `json:"game_icon_img"`
|
||||
GameImage string `json:"game_image"`
|
||||
GameHomeImage string `json:"game_home_image"`
|
||||
GameHomeShortImage string `json:"game_home_short_image"`
|
||||
GameSign string `json:"game_sign"`
|
||||
GameTsUrl string `json:"game_ts_url"`
|
||||
GameVersion string `json:"game_version"`
|
||||
GameZsUrl string `json:"game_zs_url"`
|
||||
GetRoleUrl string `json:"get_role_url"`
|
||||
HideRedButton int `json:"hide_red_button"`
|
||||
Icon string `json:"icon"`
|
||||
Icp string `json:"icp"`
|
||||
IcpUrl string `json:"icp_url"`
|
||||
Id int `json:"id"`
|
||||
IsAugment int `json:"is_augment"`
|
||||
IsOpen int `json:"is_open"`
|
||||
IsSync int `json:"is_sync"`
|
||||
MarketName string `json:"market_name"`
|
||||
MediaAbbr string `json:"media_abbr"`
|
||||
MobileLoginState int `json:"mobile_login_state"`
|
||||
MobileRegState int `json:"mobile_reg_state"`
|
||||
Name string `json:"name"`
|
||||
ObjectiveId int `json:"objective_id"`
|
||||
OpenGame int `json:"open_game"`
|
||||
Os int `json:"os"`
|
||||
OsTwo int `json:"os_two"`
|
||||
Owner int `json:"owner"`
|
||||
PackageNameId int `json:"package_name_id"`
|
||||
PayUrl string `json:"pay_url"`
|
||||
PlatId int `json:"plat_id"`
|
||||
Platform int `json:"platform"`
|
||||
ProtocolPreState int `json:"protocol_pre_state"`
|
||||
Rank int `json:"rank"`
|
||||
RegisterProtocolState int `json:"register_protocol_state"`
|
||||
RelateGame string `json:"relate_game"`
|
||||
ReleaseState int `json:"release_state"`
|
||||
Remark string `json:"remark"`
|
||||
RequestDomain string `json:"request_domain"`
|
||||
ResultCode string `json:"result_code"`
|
||||
ScreenType int `json:"screen_type"`
|
||||
ServerGroupId int `json:"server_group_id"`
|
||||
ServerSign int `json:"server_sign"`
|
||||
SimId int `json:"sim_id"`
|
||||
SpareRequestDomain string `json:"spare_request_domain"`
|
||||
TwOs int `json:"tw_os"`
|
||||
TwPlatId int `json:"tw_plat_id"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
UpdatedRealname string `json:"updated_realname"`
|
||||
UpdatedUsername string `json:"updated_username"`
|
||||
IsAuth int `json:"is_auth"`
|
||||
BindPhoneTip int `json:"bind_phone_tip"` // 是否开启绑定手机号 1是 2否
|
||||
}
|
||||
|
||||
func CreateGetGameInfoByIdReq(gameId, noCache int) *GetGameInfoReq {
|
||||
req := &GetGameInfoReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, fmt.Sprintf("/api/game/getGameById/%d?no_cache=%d", gameId, noCache))
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetGameInfoByIdResp() *GetGameInfoResp {
|
||||
return &GetGameInfoResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
type GetGameSimpleListReq struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetGameSimpleListResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data map[string]GameSimple `json:"data"`
|
||||
}
|
||||
|
||||
type GameSimple struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
GameSign string `json:"game_sign"`
|
||||
}
|
||||
|
||||
// CreateGetGameSimpleListReq
|
||||
// gids 子游戏字符串,多个子游戏id用英文逗号分割
|
||||
// game_signs 根游戏标识字符串,多个标识用英文逗号分割
|
||||
func CreateGetGameSimpleListReq(gameIds string, gameSigns string) *GetGameSimpleListReq {
|
||||
req := &GetGameSimpleListReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getSimpleList")
|
||||
tmpParams := make(map[string]string)
|
||||
if gameIds != "" {
|
||||
tmpParams["gids"] = gameIds
|
||||
}
|
||||
if gameSigns != "" {
|
||||
tmpParams["game_signs"] = gameSigns
|
||||
}
|
||||
req.FormParams = tmpParams
|
||||
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetGameSimpleListResp() *GetGameSimpleListResp {
|
||||
return &GetGameSimpleListResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GameCompany
|
||||
// ==== 获取根游戏信息
|
||||
type GameCompany struct {
|
||||
Id int `json:"id"`
|
||||
GameSign string `json:"game_sign"`
|
||||
Name string `json:"name"`
|
||||
GameName string `json:"game_name"`
|
||||
ContractName string `json:"contract_name"`
|
||||
PayKey string `json:"pay_key"`
|
||||
LoginKey string `json:"login_key"`
|
||||
LoginUrlH5 string `json:"login_url_h5"`
|
||||
LoginUrlIos string `json:"login_url_ios"`
|
||||
LoginUrlAndroid string `json:"login_url_android"`
|
||||
PayUrl string `json:"pay_url"`
|
||||
Ext string `json:"ext"`
|
||||
Status int `json:"status"`
|
||||
Company string `json:"company"`
|
||||
System string `json:"system"`
|
||||
Sync int `json:"sync"`
|
||||
Type int `json:"type"`
|
||||
GameProductId int `json:"game_product_id"`
|
||||
}
|
||||
type GetGameCompanyReq struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
type GetGameCompanyResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GameCompany `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetGameCompanyReq(gameSign string) *GetGameCompanyReq {
|
||||
req := &GetGameCompanyReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameCompanyBySign")
|
||||
req.FormParams = map[string]string{
|
||||
"gameSign": gameSign,
|
||||
}
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
func CreateGetGameCompanyResp() *GetGameCompanyResp {
|
||||
return &GetGameCompanyResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// ==== 获取游戏客户端版本配置
|
||||
|
||||
type GameVersion struct {
|
||||
ID int `json:"id"`
|
||||
GameID int `json:"game_id"`
|
||||
GameVersion string `json:"version"`
|
||||
GameURL string `json:"url"`
|
||||
PayCallbackURL string `json:"pay_callback_url"`
|
||||
DomainURL string `json:"domain_url"`
|
||||
Status int `json:"status"`
|
||||
H5Version int `json:"h5_version"`
|
||||
H5Status int `json:"h5_status"`
|
||||
IsH5Logout int `json:"is_h5_logout"`
|
||||
HideWindow int `json:"hidewindow"`
|
||||
PayInfo PayInfo `json:"pay_display_info"`
|
||||
IsYsdk int `json:"is_ysdk"`
|
||||
CheckVerified int `json:"check_verified"`
|
||||
Company string `json:"company"`
|
||||
CompanyKf string `json:"company_kf"`
|
||||
CompanyProto string `json:"company_proto"`
|
||||
CompanySms string `json:"company_sms"`
|
||||
KfStatus int `json:"kf_status"`
|
||||
PopupTime int `json:"popup_time"`
|
||||
ExtData map[string]any `json:"ext_data"`
|
||||
VersionStatus int `json:"version_status"`
|
||||
VersionTime int `json:"version_time"`
|
||||
RequestDomain string `json:"request_domain"`
|
||||
SpareRequestDomain string `json:"spare_request_domain"`
|
||||
OtherRequestDomain string `json:"other_request_domain"`
|
||||
}
|
||||
|
||||
type GetGameVersionReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int `position:"Body" field:"game_id"`
|
||||
GameVersion string `position:"Body" field:"game_version"`
|
||||
}
|
||||
|
||||
type GetGameVersionResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GameVersion `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetGameVersionReq(gameId int, gameVersion string) *GetGameVersionReq {
|
||||
req := &GetGameVersionReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.GameId = gameId
|
||||
req.GameVersion = gameVersion
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameVersion")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetGameVersionResp() *GetGameVersionResp {
|
||||
return &GetGameVersionResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GetConfigReq
|
||||
// 游戏全局配置
|
||||
type GetConfigReq struct {
|
||||
*requests.RpcRequest
|
||||
Key string `position:"Query" field:"key" default:"-" `
|
||||
}
|
||||
|
||||
type GetConfigRespData struct {
|
||||
Id int `json:"id"`
|
||||
Key string `json:"key"`
|
||||
ExtData string `json:"ext_data"`
|
||||
}
|
||||
type GetConfigResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GetConfigRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetConfigReq(key string) *GetConfigReq {
|
||||
req := &GetConfigReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.Key = key
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getConfig")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetConfigResp() *GetConfigResp {
|
||||
return &GetConfigResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GetRealAuthBlackListReq
|
||||
// 获取实名黑名单
|
||||
type GetRealAuthBlackListReq struct {
|
||||
*requests.RpcRequest
|
||||
Key string `position:"Query" field:"key" default:"-" `
|
||||
}
|
||||
|
||||
type GetRealAuthBlackListRespDataItem struct {
|
||||
Id int `json:"id"`
|
||||
TrueName string `json:"true_name"`
|
||||
IdCard string `json:"id_card"`
|
||||
Remark string `json:"remark"`
|
||||
CreateBy string `json:"create_by"`
|
||||
UpdateBy string `json:"update_by"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
type GetRealAuthBlackListResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []GetRealAuthBlackListRespDataItem `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetRealAuthBlackListReq() *GetRealAuthBlackListReq {
|
||||
req := &GetRealAuthBlackListReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getRealAuthBlackList")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetRealAuthBlackListResp() *GetRealAuthBlackListResp {
|
||||
return &GetRealAuthBlackListResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GetGameRealAuthInfoReq
|
||||
// 获取实名参数
|
||||
type GetGameRealAuthInfoReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int64 `position:"Body" field:"game_id" default:"-" `
|
||||
}
|
||||
|
||||
type GetGameRealAuthInfoRespData struct {
|
||||
GroupName string `json:"group_name"`
|
||||
GroupDescription int `json:"group_description"`
|
||||
VerifiedTime string `json:"verified_time"`
|
||||
AreaProvince string `json:"area_province"`
|
||||
VersionInfo string `json:"version_info"`
|
||||
IsReal int `json:"is_real"`
|
||||
IsDirect int `json:"is_direct"`
|
||||
AuthChannel string `json:"auth_channel"`
|
||||
StandbyAuthChannel string `json:"standby_auth_channel"`
|
||||
ProtectTime int `json:"protect_time"`
|
||||
GovIoReport int `json:"gov_io_report"`
|
||||
MinorBan int `json:"minor_ban"`
|
||||
}
|
||||
|
||||
type GetGameRealAuthInfoResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GetGameRealAuthInfoRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetGameRealAuthInfoReq(gameId int64) *GetGameRealAuthInfoReq {
|
||||
req := &GetGameRealAuthInfoReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
GameId: gameId,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/login/getGameRealAuthInfo")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetGameRealAuthInfoResp() *GetGameRealAuthInfoResp {
|
||||
return &GetGameRealAuthInfoResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// KickUserReq
|
||||
// 踢人下线
|
||||
type KickUserReq struct {
|
||||
*requests.RpcRequest
|
||||
Uid int64 `position:"Body" field:"uid" default:"-" `
|
||||
GameSign string `position:"Body" field:"game_sign" default:"-" `
|
||||
ServerSign string `position:"Body" field:"server_sign" default:"-" `
|
||||
Time int64 `position:"Body" field:"time" default:"-" `
|
||||
}
|
||||
|
||||
type KickUserRespDataCallCpInfo struct {
|
||||
Url string `json:"url"`
|
||||
RequestParam map[string]any `json:"request_param"`
|
||||
Response map[string]any `json:"response"`
|
||||
}
|
||||
|
||||
type KickUserRespData struct {
|
||||
CallCpInfo KickUserRespDataCallCpInfo `json:"call_cp_info"`
|
||||
}
|
||||
|
||||
type KickUserResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data KickUserRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateKickUserReq(uid int64, gameSign string, serverSign string, time int64) *KickUserReq {
|
||||
req := &KickUserReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
Uid: uid,
|
||||
GameSign: gameSign,
|
||||
ServerSign: serverSign,
|
||||
Time: time,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/kickUser")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateKickUserResp() *KickUserResp {
|
||||
return &KickUserResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// GetLoginBgReq
|
||||
// h5登录背景图
|
||||
type GetLoginBgReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int64 `position:"Body" field:"game_id" default:"-" `
|
||||
}
|
||||
|
||||
type GetLoginBgRespData struct {
|
||||
LoginBg string `json:"login_bg"`
|
||||
}
|
||||
|
||||
type GetLoginBgResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GetLoginBgRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetLoginBgReq(gameId int64) *GetLoginBgReq {
|
||||
req := &GetLoginBgReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
GameId: gameId,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getLoginBg")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetLoginBgResp() *GetLoginBgResp {
|
||||
return &GetLoginBgResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
type GetGameRoleNameReq struct {
|
||||
*requests.RpcRequest
|
||||
AppId int64 `position:"Body" field:"appid"`
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
ServerId int64 `position:"Body" field:"server_id"`
|
||||
UserId int64 `position:"Body" field:"user_id"`
|
||||
Time int64 `position:"Body" field:"time"`
|
||||
Sign string `position:"Body" field:"sign"`
|
||||
Os int64 `position:"Body" field:"os"`
|
||||
}
|
||||
|
||||
type GetGameRoleNameResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
UserInfo []Role `json:"userinfo"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type Role struct {
|
||||
RoleId string `json:"roleId"`
|
||||
Name string `json:"name"`
|
||||
Server int64 `json:"server"`
|
||||
ServerName string `json:"serverName"`
|
||||
Level int64 `json:"level"`
|
||||
VipLevel int64 `json:"vipLevel"`
|
||||
CreateTime int64 `json:"createTime"`
|
||||
RoleLevelUpdateTime int64 `json:"roleLevelUpdateTime"`
|
||||
Power int64 `json:"power"`
|
||||
Profession string `json:"profession"`
|
||||
ZhuanshengLv int64 `json:"zhuansheng_lv"`
|
||||
ZhuanshengName string `json:"zhuanshengName"`
|
||||
Gold int64 `json:"gold"`
|
||||
LoginDays int64 `json:"loginDays"`
|
||||
PlayTime int64 `json:"playTime"`
|
||||
DayData struct {
|
||||
DailyCheckPoint int64 `json:"dailyCheckPoint"`
|
||||
OnlineTime int64 `json:"onlineTime"`
|
||||
Liveness int64 `json:"liveness"`
|
||||
}
|
||||
}
|
||||
|
||||
func CreateGetGameRoleNameReq(gameId, sid, uid, os int64, nameName string) *GetGameRoleNameReq {
|
||||
ts := time.Now().Unix()
|
||||
req := &GetGameRoleNameReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
AppId: gameId,
|
||||
UserName: nameName,
|
||||
ServerId: sid,
|
||||
UserId: uid,
|
||||
Time: ts,
|
||||
Sign: utils.Md5(fmt.Sprintf("%d%d%s", gameId, ts, gameKey)),
|
||||
Os: os,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameRoleName")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetGameRoleNameResp() *GetGameRoleNameResp {
|
||||
return &GetGameRoleNameResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
type GetSdkThemeReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int64 `position:"Query" field:"game_id" default:"-" `
|
||||
GameVersion string `position:"Query" field:"game_version" default:"-" `
|
||||
}
|
||||
|
||||
type GetSdkThemeResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data map[string]any `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetSdkThemeReq(gameId int64, gameVersion string) *GetSdkThemeReq {
|
||||
req := &GetSdkThemeReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
GameId: gameId,
|
||||
GameVersion: gameVersion,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getSdkTheme")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetSdkThemeResp() *GetSdkThemeResp {
|
||||
return &GetSdkThemeResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
type GetGameListExtInfoReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int64 `position:"Query" field:"game_id" default:"-" `
|
||||
}
|
||||
|
||||
type ExtInfo struct {
|
||||
GameId int64 `json:"game_id"`
|
||||
GetRoleUrl string `json:"get_role_url"`
|
||||
OfflinePayUrl string `json:"offline_pay_url"`
|
||||
DistributionPlatformParam string `json:"distribution_platform_param"`
|
||||
Material string `json:"material"`
|
||||
CpWithdrawCallPro string `json:"cp_withdraw_call_pro"`
|
||||
CpWithdrawCallTest string `json:"cp_withdraw_call_test"`
|
||||
}
|
||||
|
||||
type GetGameListExtInfoResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data ExtInfo `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetGameListExtInfoReq(gameId int64) *GetGameListExtInfoReq {
|
||||
req := &GetGameListExtInfoReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
GameId: gameId,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameListExtInfo")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetGameListExtInfoResp() *GetGameListExtInfoResp {
|
||||
return &GetGameListExtInfoResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
package game
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type ClientInfoReq struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type ClientInfoResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []ClientInfoDataItem `json:"data"`
|
||||
}
|
||||
|
||||
type ClientInfoDataItem struct {
|
||||
Id int `json:"id"`
|
||||
GameName string `json:"game_name"`
|
||||
Status int `json:"status"`
|
||||
Version string `json:"version"`
|
||||
GameId int `json:"game_id"`
|
||||
RequestDomain string `json:"request_domain"`
|
||||
SpareRequestDomain string `json:"spare_request_domain"`
|
||||
OtherRequestDomain string `json:"other_request_domain"`
|
||||
}
|
||||
|
||||
func CreateClientInfoReq(status, gameId int64) *ClientInfoReq {
|
||||
req := &ClientInfoReq{
|
||||
&requests.RpcRequest{},
|
||||
}
|
||||
|
||||
req.InitWithApiInfo(HOST, VERSION, fmt.Sprintf("/api/game/getGameClientInfo?game_id=%d&status=%d", gameId, status))
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateClientInfoResp() *ClientInfoResp {
|
||||
return &ClientInfoResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,107 +0,0 @@
|
||||
package game
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
var (
|
||||
gameServerKey = "gaoreapi"
|
||||
)
|
||||
|
||||
// GetGameServerSign 子游戏区服信息,特有验签
|
||||
func GetGameServerSign(gameId int) (ts int64, sign string) {
|
||||
ts = time.Now().Unix()
|
||||
hash := md5.New()
|
||||
hash.Write([]byte(fmt.Sprintf("%v%v%v", gameId, ts, gameServerKey)))
|
||||
hashBytes := hash.Sum(nil)
|
||||
sign = hex.EncodeToString(hashBytes)
|
||||
return
|
||||
}
|
||||
|
||||
type GetServerIdRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetServerIdResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data map[string]string `json:"data"`
|
||||
}
|
||||
|
||||
// CreateGetServerIdRequest
|
||||
// Deprecated 方法已废弃,不要用
|
||||
func CreateGetServerIdRequest(gameId int) (req *GetServerIdRequest) {
|
||||
req = &GetServerIdRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getServerId")
|
||||
// 获取时间戳、签名
|
||||
ts, sign := GetGameServerSign(gameId)
|
||||
|
||||
req.FormParams = map[string]string{
|
||||
"appid": fmt.Sprintf("%v", gameId),
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateGetServerIdResponse
|
||||
// Deprecated 方法已废弃,不要用
|
||||
func CreateGetServerIdResponse() (response *GetServerIdResponse) {
|
||||
response = &GetServerIdResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// --------------游戏区服v2列表查询----------
|
||||
|
||||
// GetServerV2Request 请求结构体
|
||||
type GetServerV2Request struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetServerV2Response struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []GameServerV2 `json:"data"`
|
||||
}
|
||||
|
||||
type GameServerV2 struct {
|
||||
ServerId int `json:"server_id"`
|
||||
Name string `json:"name"`
|
||||
GameSign string `json:"game_sign"`
|
||||
ServerSign int `json:"server_sign"`
|
||||
}
|
||||
|
||||
func CreateGetServerV2Request(gameSign string, serverSigns string, types string) (req *GetServerV2Request) {
|
||||
req = &GetServerV2Request{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/game/getServerV2")
|
||||
|
||||
req.FormParams = map[string]string{
|
||||
"game_sign": gameSign,
|
||||
"server_signs": serverSigns,
|
||||
"types": types,
|
||||
}
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetServerV2Response() (response *GetServerV2Response) {
|
||||
response = &GetServerV2Response{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,47 +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 GetLabelListByCateRep struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetLabelListByCateResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
List []Label `json:"list"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type Label struct {
|
||||
Id int `json:"id"`
|
||||
CateId int `json:"cate_id"`
|
||||
LabelName string `json:"label_name"`
|
||||
Status int `json:"status"`
|
||||
RelateUserNum int `json:"relate_user_num"`
|
||||
CreateBy string `json:"create_by"`
|
||||
UpdateBy string `json:"update_by"`
|
||||
}
|
||||
|
||||
func CreateGetLabelListByCateRep(cateIds string) *GetLabelListByCateRep {
|
||||
req := &GetLabelListByCateRep{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/label/getLabelListByCate")
|
||||
req.FormParams = map[string]string{
|
||||
"cate_ids": cateIds,
|
||||
}
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetLabelListByCateResp() *GetLabelListByCateResp {
|
||||
return &GetLabelListByCateResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,73 +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 GetLoginInfoByIdReq struct {
|
||||
*requests.RpcRequest
|
||||
GameId int `position:"Body" field:"game_id"`
|
||||
GameVersion string `position:"Body" field:"game_version"`
|
||||
Uid int `position:"Body" field:"uid"`
|
||||
UserName string `position:"Body" field:"uname"`
|
||||
}
|
||||
|
||||
type PayInfo struct {
|
||||
HiddenAlipay int `json:"hide_alipay"`
|
||||
HiddenWx int `json:"hide_wx"`
|
||||
HiddenUnionPay int `json:"hide_union_pay"`
|
||||
}
|
||||
|
||||
type GameVersionInfo struct {
|
||||
AppName string `json:"app_name"`
|
||||
AppID string `json:"app_id"`
|
||||
LoginURL string `json:"login_url"`
|
||||
PayURL string `json:"pay_url"`
|
||||
GameURL string `json:"game_url"`
|
||||
PayCallbackURL string `json:"pay_callback_url"`
|
||||
IsH5Logout int `json:"is_h5_logout"`
|
||||
HideWindow int `json:"hidewindow"`
|
||||
GameVersion string `json:"version"`
|
||||
GameSign string `json:"game_sign"`
|
||||
GameSignName string `json:"game_sign_name"`
|
||||
GameSignID int `json:"game_sign_id"`
|
||||
IsYsdk int `json:"is_ysdk"`
|
||||
Company string `json:"company"`
|
||||
CompanyKf string `json:"company_kf"`
|
||||
CompanyProto string `json:"company_proto"`
|
||||
CompanySms string `json:"company_sms"`
|
||||
KfStatus int `json:"kf_status"`
|
||||
PopupTime int `json:"popup_time"`
|
||||
GameId int `json:"game_id"`
|
||||
ScreenType int `json:"screen_type"`
|
||||
GameSwitch int `json:"game_switch"` // 根据上下文,0 或 1 的整数表示布尔值
|
||||
ExtData map[string]any `json:"ext_data"`
|
||||
OsName string `json:"os_name"`
|
||||
PayInfo PayInfo `json:"pay_info"`
|
||||
}
|
||||
|
||||
type GetLoginInfoByIdResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GameVersionInfo `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetLoginInfoByIdReq(gameId int, gameVersion string) *GetLoginInfoByIdReq {
|
||||
req := &GetLoginInfoByIdReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.GameId = gameId
|
||||
req.GameVersion = gameVersion
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/login/getInfoById")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetLoginInfoByIdResp() *GetLoginInfoByIdResp {
|
||||
resp := &GetLoginInfoByIdResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@ -1,67 +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 GetProtocolByGameIdRep struct {
|
||||
*requests.RpcRequest
|
||||
GameId int `position:"Query" field:"game_id"`
|
||||
GameVersion string `position:"Query" field:"game_version"`
|
||||
Type int `position:"Query" field:"type"`
|
||||
}
|
||||
|
||||
type GetProtocolByGameIdResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
Content string `json:"content"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetProtocolByGameIdRep() *GetProtocolByGameIdRep {
|
||||
req := &GetProtocolByGameIdRep{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/news/getProtocolByGameId")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetProtocolByGameIdResp() *GetProtocolByGameIdResp {
|
||||
return &GetProtocolByGameIdResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
type GetProtocolByCompanyRep struct {
|
||||
*requests.RpcRequest
|
||||
Company string `position:"Query" field:"company"`
|
||||
Type int `position:"Query" field:"type"`
|
||||
}
|
||||
|
||||
type GetProtocolByCompanyResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
Content string `json:"content"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetProtocolByCompanyRep() *GetProtocolByCompanyRep {
|
||||
req := &GetProtocolByCompanyRep{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/news/getProtocolByCompany")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetProtocolByCompanyResp() *GetProtocolByCompanyResp {
|
||||
return &GetProtocolByCompanyResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,124 +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"
|
||||
)
|
||||
|
||||
// IsBlockOutIosReq
|
||||
// 获取切支付规则
|
||||
type IsBlockOutIosReq struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
GameId int64 `position:"Body" field:"appid"`
|
||||
Ip string `position:"Body" field:"ip"`
|
||||
Imei string `position:"Body" field:"imei"`
|
||||
LoginDays int64 `position:"Body" field:"login_days"`
|
||||
PlayTime int64 `position:"Body" field:"play_time"`
|
||||
}
|
||||
|
||||
type IsBlockOutIosRespData struct {
|
||||
PayInChannel bool `json:"pay_in_channel"`
|
||||
PayInChannelMatchedRule []int64 `json:"pay_in_channel_matched_rule"`
|
||||
DoDisplayIos bool `json:"do_display_ios"`
|
||||
DoDisplayIosMatchedRule []int64 `json:"do_display_ios_matched_rule"`
|
||||
DoDisplayWebsite bool `json:"do_display_website"`
|
||||
DoDisplayWebsiteMatchedRule []int64 `json:"do_display_website_matched_rule"`
|
||||
DoDisplayWebsiteWechatInfo string `json:"do_display_website_wechat_info"`
|
||||
DoWebOrderPay bool `json:"do_web_order_pay"`
|
||||
DoWebOrderPayMatchedRule []int64 `json:"do_web_order_pay_matched_rule"`
|
||||
DoWebOrderPayWechatInfo string `json:"do_web_order_pay_wechat_info"`
|
||||
}
|
||||
|
||||
type IsBlockOutIosResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data IsBlockOutIosRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateIsBlockOutIosReq(userName string, gameId int64, ip string, imei string, loginDays, playTime int64) *IsBlockOutIosReq {
|
||||
req := &IsBlockOutIosReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.UserName = userName
|
||||
req.GameId = gameId
|
||||
req.Ip = ip
|
||||
req.Imei = imei
|
||||
req.LoginDays = loginDays
|
||||
req.PlayTime = playTime
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/pay/isBlockOutIos")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateIsBlockOutIosResp() *IsBlockOutIosResp {
|
||||
resp := &IsBlockOutIosResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return resp
|
||||
}
|
||||
|
||||
// MakeOrderReq 预下单请求
|
||||
type MakeOrderReq struct {
|
||||
*requests.RpcRequest
|
||||
Username string `position:"Body" field:"username"`
|
||||
Gid int64 `position:"Body" field:"gid"`
|
||||
Sid string `position:"Body" field:"sid"`
|
||||
RealSid string `position:"Body" field:"real_sid"`
|
||||
RoleId string `position:"Body" field:"role_id"`
|
||||
RoleName string `position:"Body" field:"role_name"`
|
||||
Money int `position:"Body" field:"money"`
|
||||
ServerName string `position:"Body" field:"server_name"`
|
||||
ProductName string `position:"Body" field:"product_name"`
|
||||
DwId int64 `position:"Body" field:"dw_id"`
|
||||
}
|
||||
|
||||
type MakeOrderRespData struct {
|
||||
OrderID string `json:"orderID"`
|
||||
}
|
||||
|
||||
type MakeOrderResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data MakeOrderRespData `json:"data"`
|
||||
}
|
||||
|
||||
type MakeOrderParam struct {
|
||||
Username string
|
||||
Gid int64
|
||||
Sid string
|
||||
RealSid string
|
||||
RoleId string
|
||||
RoleName string
|
||||
Money int
|
||||
ServerName string
|
||||
ProductName string
|
||||
DwId int64
|
||||
}
|
||||
|
||||
func CreateMakeOrderReq(param MakeOrderParam) *MakeOrderReq {
|
||||
req := &MakeOrderReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
Username: param.Username,
|
||||
Gid: param.Gid,
|
||||
Sid: param.Sid,
|
||||
RealSid: param.RealSid,
|
||||
RoleId: param.RoleId,
|
||||
RoleName: param.RoleName,
|
||||
Money: param.Money,
|
||||
ServerName: param.ServerName,
|
||||
ProductName: param.ProductName,
|
||||
DwId: param.DwId,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/pay/makeOrder")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateMakeOrderResp() *MakeOrderResp {
|
||||
return &MakeOrderResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,45 +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"
|
||||
)
|
||||
|
||||
// GetPaySwitchUserReq
|
||||
// 微信小游戏切支付名单中转查询请求(按 user_name + game_id 读 db_center.wd_pay_switch_user)
|
||||
type GetPaySwitchUserReq struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name"` // 账号
|
||||
GameId int64 `position:"Body" field:"game_id"` // 子游戏ID
|
||||
}
|
||||
|
||||
// GetPaySwitchUserRespData 中转返回的名单状态
|
||||
type GetPaySwitchUserRespData struct {
|
||||
Status int64 `json:"status"` // 切支付开关 1开启 0关闭
|
||||
RiskLevel int64 `json:"risk_level"` // 风险档位 1高 2中 3低;0未设置/关闭
|
||||
}
|
||||
|
||||
type GetPaySwitchUserResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data GetPaySwitchUserRespData `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetPaySwitchUserReq(userName string, gameId int64) *GetPaySwitchUserReq {
|
||||
req := &GetPaySwitchUserReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.UserName = userName
|
||||
req.GameId = gameId
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/pay/switchUser")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetPaySwitchUserResp() *GetPaySwitchUserResp {
|
||||
resp := &GetPaySwitchUserResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return resp
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
package ip
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "2025-06-24"
|
||||
)
|
||||
|
||||
var HOST = requests.Host{
|
||||
Default: "ip",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = new(Client)
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) CreateGetIpRequest(req *IpRequest) (resp *IpResponse, err error) {
|
||||
resp = CreateIpResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (client *Client) CreateGetIpsRequest(req *IpsRequest) (resp *IpsResponse, err error) {
|
||||
resp = CreateIpsResponse()
|
||||
err = client.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package ip
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// 测试获取单个ip地区信息
|
||||
func TestGetIp(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateIpRequest(IpParam{
|
||||
Ip: "114.234.202.136",
|
||||
})
|
||||
res, doErr := client.CreateGetIpRequest(req)
|
||||
if doErr != nil {
|
||||
panic(doErr)
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("查询多个ip失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
|
||||
// 测试获取多个ip地区信息
|
||||
func TestGetIps(t *testing.T) {
|
||||
client, newErr := NewClient()
|
||||
if newErr != nil {
|
||||
panic(newErr)
|
||||
}
|
||||
req := CreateIpsRequest(IpsParam{
|
||||
Ips: []string{
|
||||
"2001:ee0:5208:e600:4c51:3189:28a4:b668",
|
||||
"114.234.202.136",
|
||||
},
|
||||
})
|
||||
res, err := client.CreateGetIpsRequest(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res.Code != 0 {
|
||||
t.Error("查询多个ip失败")
|
||||
}
|
||||
fmt.Printf(fmt.Sprintf("%v", res))
|
||||
}
|
||||
@ -1,100 +0,0 @@
|
||||
package ip
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type IpInfo struct {
|
||||
Ip string `json:"ip"`
|
||||
City string `json:"city"`
|
||||
Province string `json:"province"`
|
||||
Country string `json:"country"`
|
||||
Isp string `json:"isp"`
|
||||
Owner string `json:"owner"`
|
||||
Continent string `json:"continent"`
|
||||
Accuracy string `json:"accuracy"`
|
||||
Adcode string `json:"adcode"`
|
||||
Areacode string `json:"areacode"`
|
||||
Asnumber string `json:"asnumber"`
|
||||
Radius string `json:"radius"`
|
||||
Latwgs string `json:"latwgs"`
|
||||
Lngwgs string `json:"lngwgs"`
|
||||
Source string `json:"source"`
|
||||
Timezone string `json:"timezone"`
|
||||
Zipcode string `json:"zipcode"`
|
||||
District string `json:"district"`
|
||||
}
|
||||
|
||||
// IpsParam
|
||||
// 单个ip请求参数
|
||||
type IpParam struct {
|
||||
Ip string `json:"ip"`
|
||||
}
|
||||
type IpRequest struct {
|
||||
*requests.JsonRequest
|
||||
Ip string `position:"Json" field:"ip"`
|
||||
}
|
||||
|
||||
// IpResponse
|
||||
// 单个ip返回参数
|
||||
type IpResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data IpInfo `json:"data"`
|
||||
}
|
||||
|
||||
// CreateIpRequest
|
||||
// 同时支持ipv4、ipv6格式查询
|
||||
func CreateIpRequest(param IpParam) (req *IpRequest) {
|
||||
req = &IpRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Ip: param.Ip,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/getIp")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateIpResponse() (resp *IpResponse) {
|
||||
resp = &IpResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 多个ip请求参数
|
||||
type IpsParam struct {
|
||||
Ips []string `json:"ips"`
|
||||
}
|
||||
type IpsRequest struct {
|
||||
*requests.JsonRequest
|
||||
Ips []string `position:"Json" field:"ips"`
|
||||
}
|
||||
|
||||
// IpsResponse
|
||||
// 多个ip返回参数
|
||||
type IpsResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data map[string]IpInfo `json:"data"`
|
||||
}
|
||||
|
||||
// CreateIpsRequest
|
||||
// 同时支持ipv4、ipv6格式查询
|
||||
func CreateIpsRequest(param IpsParam) (req *IpsRequest) {
|
||||
req = &IpsRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
Ips: param.Ips,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/v1/getIps")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
func CreateIpsResponse() (resp *IpsResponse) {
|
||||
resp = &IpsResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package mkt
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
@ -19,11 +18,5 @@ func TestSubjectList(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
marshal, err := json.Marshal(list.Data)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println(string(marshal))
|
||||
fmt.Println(list.Status, list.Code, list.Msg, list.Data)
|
||||
}
|
||||
|
||||
@ -26,16 +26,13 @@ type SubjectListResponse struct {
|
||||
}
|
||||
|
||||
type Data struct {
|
||||
Id int `json:"id"` // 主体ID
|
||||
Abbr string `json:"abbr"` // 公司简称
|
||||
AbbrSign string `json:"abbr_sign"` // 公司英文简写
|
||||
Name string `json:"name"` // 公司名全称
|
||||
State int `json:"state"` // 状态:0 使用中,1 已停用
|
||||
System string `json:"system"` // 结算体系
|
||||
Type int `json:"type"` // 主体类型:0 自有,1 其他
|
||||
Record string `json:"record"` // 备案/许可证号
|
||||
Uscc string `json:"uscc"` // 统一社会信用代码
|
||||
Drawer string `json:"drawer"` // 开票人
|
||||
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 公司列表请求
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
package mkt2
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "2026-02-03"
|
||||
)
|
||||
|
||||
var HOST = requests.Host{
|
||||
Default: "mkt2-api",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = new(Client)
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) MaterialTaskNotify(request *MaterialTaskNotifyRequest) (response *MaterialTaskNotifyResponse, err error) {
|
||||
response = CreateMaterialTaskNotifyResponse()
|
||||
err = c.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package mkt2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestClient_MaterialTaskNotify 测试素材处理任务通知
|
||||
func TestClient_MaterialTaskNotify(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error("NewClient error:", err)
|
||||
return
|
||||
}
|
||||
request := CreateMaterialTaskNotifyRequest(MaterialTaskNotifyParam{
|
||||
TaskType: "resource_to_vdb",
|
||||
TaskId: 223,
|
||||
FileInfo: FileInfo{
|
||||
Md5: "2fcf1306458f2321bccbb0e2ee8a712b",
|
||||
Duration: 0,
|
||||
Size: 14745,
|
||||
Width: 480,
|
||||
Height: 392,
|
||||
Bitrate: 0,
|
||||
Format: "jpg",
|
||||
},
|
||||
})
|
||||
response, err := client.MaterialTaskNotify(request)
|
||||
if err != nil {
|
||||
t.Error("MaterialTaskNotify error:", err)
|
||||
return
|
||||
}
|
||||
t.Log("response:", response)
|
||||
fmt.Println("")
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
package mkt2
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type MaterialTaskNotifyParam struct {
|
||||
TaskType string `json:"task_type"`
|
||||
TaskId int64 `json:"task_id"`
|
||||
FileInfo FileInfo `json:"file_info"`
|
||||
}
|
||||
|
||||
// MaterialTaskNotifyRequest 媒资任务通知请求
|
||||
type MaterialTaskNotifyRequest struct {
|
||||
*requests.JsonRequest
|
||||
TaskType string `position:"Json" field:"task_type"`
|
||||
TaskId int64 `position:"Json" field:"task_id"`
|
||||
FileInfo FileInfo `position:"Json" field:"file_info"`
|
||||
}
|
||||
|
||||
// FileInfo 文件信息
|
||||
type FileInfo struct {
|
||||
Md5 string `json:"md5"`
|
||||
Duration float64 `json:"duration"`
|
||||
Size int64 `json:"size"`
|
||||
Width int64 `json:"width"`
|
||||
Height int64 `json:"height"`
|
||||
Bitrate int64 `json:"bitrate"`
|
||||
Format string `json:"format"`
|
||||
}
|
||||
|
||||
type MaterialTaskNotifyResponse struct {
|
||||
*responses.BaseResponse
|
||||
StatusCode int `json:"status_code"`
|
||||
StatusMsg string `json:"status_msg"`
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
|
||||
func CreateMaterialTaskNotifyRequest(param MaterialTaskNotifyParam) (req *MaterialTaskNotifyRequest) {
|
||||
req = &MaterialTaskNotifyRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
TaskType: param.TaskType,
|
||||
TaskId: param.TaskId,
|
||||
FileInfo: param.FileInfo,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/cooperation/creativesMaterial/materialTaskNotify")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateMaterialTaskNotifyResponse() (response *MaterialTaskNotifyResponse) {
|
||||
response = &MaterialTaskNotifyResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
package msdk
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
const VERSION = "2024-06-25"
|
||||
|
||||
var HOST = requests.Host{
|
||||
Default: "msdk.api.gaore.com",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = &Client{}
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
// GetIdfa 获取设备归因信息
|
||||
func (c *Client) GetIdfa(req *GetIdfaReq) (resp *GetIdfaResp, err error) {
|
||||
resp = &GetIdfaResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
if req.Imei == "" && req.Idfa != "" {
|
||||
req.Imei = req.Idfa
|
||||
}
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserAttr 获取用户归因信息
|
||||
func (c *Client) GetUserAttr(req *GetUserAttrReq) (resp *GetUserAttrResp, err error) {
|
||||
resp = &GetUserAttrResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
// GetImei 用户注册归因
|
||||
func (c *Client) GetImei(req *GetImeiReq) (resp *GetImeiResp, err error) {
|
||||
resp = &GetImeiResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) SetImei(req *SetImeiReq) (resp *SetImeiResp, err error) {
|
||||
resp = &SetImeiResp{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
@ -1,149 +0,0 @@
|
||||
package msdk
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestClient_GetUserAttr(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateGetUserAttrReq("ql83649336", "xxhbbxxl")
|
||||
resp, err := client.GetUserAttr(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(resp)
|
||||
}
|
||||
|
||||
func TestGetIdfa(t *testing.T) {
|
||||
header := &requests.RefererHeader{
|
||||
Referer: "https://www.gaore.com",
|
||||
TraceId: utils.MakeTraceId(),
|
||||
}
|
||||
_ = header
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
client.SetRefererHeader(header)
|
||||
req := CreateGetIdfaReq()
|
||||
req.ChannelId = 1
|
||||
req.GameId = 3706
|
||||
req.Ip = "112.23.230.210"
|
||||
req.Imei = "00000000-0000-0000-0000-000000000000"
|
||||
req.LongId = "daff65f07c7cf84862f4217773e3d613"
|
||||
req.SdkVersion = "1.7.2"
|
||||
req.Os = "ios"
|
||||
req.GameOs = 2
|
||||
req.GameSubOs = 0
|
||||
req.Ua = "Mozilla/5.0 (iPad; CPU OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
|
||||
req.GameSign = "hlhj"
|
||||
req.PkgAgentId = "100"
|
||||
req.PkgSiteId = "1001"
|
||||
req.Network = "Wifi"
|
||||
req.Idfv = "53F2A5F7-B1D4-4716-9775-07727C29BC7A"
|
||||
req.ScreenResolution = "2360*1640"
|
||||
req.System = "15.6.1"
|
||||
req.ProcessorModel = "iPad13,16"
|
||||
req.BaseBand = ""
|
||||
req.Model = "iPad13,16"
|
||||
req.Battery = "74"
|
||||
req.Oaid = ""
|
||||
req.AdInfo = ""
|
||||
req.WxPlatform = ""
|
||||
req.AdDevice = "{\"bootTimeInSec\":\"1745364499\",\"countryCode\":\"CN\",\"language\":\"zh-Hans-CN\",\"deviceName\":\"1b9018182a49e16ba85bb095f224867c\",\"systemVersion\":\"15.6.1\",\"machine\":\"iPad13,16\",\"carrierInfo\":\"unknown\",\"memory\":\"8000356352\",\"disk\":\"255983177728\",\"sysFileTime\":\"1663537105.729985\",\"model\":\"J407AP\",\"timeZone\":\"28800\",\"mntId\":\"A058368B97B0D073829608AAC13FFA64D9BEFD0FE3E14EDB106F2BABD6DF94B1C2BFC7509CBB683EE5B22D91A19FF67A@/dev/disk0s1s1\",\"deviceInitTime\":\"1663537056.906820124\"}"
|
||||
resp, err := client.GetIdfa(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(resp)
|
||||
}
|
||||
|
||||
func TestGetImei(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateGetImeiReq()
|
||||
req.Uid = 218047048
|
||||
req.UserName = "ct939725671"
|
||||
req.GameId = 8050
|
||||
req.GameSign = "mrwld"
|
||||
req.RegTime = 1750939725
|
||||
req.Imei = "of5wO5sKWep0OFPt9rWQf6xNJVPg"
|
||||
req.ChannelId = 1
|
||||
req.AgentId = 100
|
||||
req.SiteId = 1001
|
||||
req.Ip = "1864204063"
|
||||
req.Idfa = "of5wO5sKWep0OFPt9rWQf6xNJVPg"
|
||||
req.Logined = 1
|
||||
req.MatchType = 1
|
||||
req.GameAwemeId = ""
|
||||
req.ComeBackUser = 0
|
||||
req.FanCode = ""
|
||||
req.Network = ""
|
||||
req.Idfv = ""
|
||||
req.ScreenResolution = ""
|
||||
req.System = ""
|
||||
req.Electric = ""
|
||||
req.ProcessorModel = ""
|
||||
req.BaseBand = ""
|
||||
req.Model = ""
|
||||
req.Battery = ""
|
||||
req.Oaid = ""
|
||||
req.AdInfo = ""
|
||||
req.AdDevice = ""
|
||||
req.Ua = "WebSdk GaoreGame/1.3.1"
|
||||
req.WxPlatform = ""
|
||||
resp, err := client.GetImei(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Log(resp)
|
||||
}
|
||||
|
||||
func TestSetImei(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateSetImeiReq()
|
||||
// 基础字段赋值
|
||||
req.UserName = "15179405888"
|
||||
req.GameId = 6062
|
||||
req.GameSign = "hlhj"
|
||||
req.ChannelId = 1 // mtype
|
||||
req.MatchType = 2
|
||||
req.Imei = "96d9acdd57535c92-null"
|
||||
req.Idfa = "96d9acdd57535c92-null"
|
||||
req.Network = "4G"
|
||||
req.Idfv = ""
|
||||
req.ScreenResolution = "2132x1080"
|
||||
req.System = "11"
|
||||
req.ProcessorModel = ""
|
||||
req.BaseBand = ""
|
||||
req.Model = "PCDM10"
|
||||
req.Battery = "45"
|
||||
req.Oaid = "B9258E43A5084B43B72D94580C830898343a97328d6fd210b9e23859b1d5e83d_gaore_"
|
||||
req.AdInfo = ""
|
||||
req.AdDevice = ""
|
||||
req.Ua = "Mozilla/5.0 (Linux; Android 11; PCDM10 Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36; SHGR GaoreGame/2.3.5"
|
||||
req.WxPlatform = ""
|
||||
|
||||
resp, err := client.SetImei(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(resp)
|
||||
}
|
||||
@ -1,218 +0,0 @@
|
||||
package msdk
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"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/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
const msdkKey = "msdk@gaore.com#!!"
|
||||
|
||||
type GetIdfaReq struct {
|
||||
*requests.RpcRequest
|
||||
ChannelId int `position:"Query" field:"mtype"`
|
||||
GameId int `position:"Query" field:"game_id"`
|
||||
GameSign string `position:"Query" field:"game_sign"`
|
||||
Ip string `position:"Query" field:"ip"`
|
||||
Imei string `position:"Query" field:"imei"`
|
||||
Idfa string `position:"Query" field:"idfa"`
|
||||
Idfv string `position:"Query" field:"idfv"`
|
||||
LongId string `position:"Query" field:"long_id"`
|
||||
SdkVersion string `position:"Query" field:"version"`
|
||||
Os string `position:"Query" field:"os"`
|
||||
GameOs int `position:"Query" field:"game_os"`
|
||||
GameSubOs int `position:"Query" field:"game_sub_os"`
|
||||
UserName string `position:"Query" field:"user_name"`
|
||||
Ua string `position:"Query" field:"ua"`
|
||||
LiveCode string `position:"Query" field:"live_code"`
|
||||
AdDevice string `position:"Query" field:"ad_device"`
|
||||
PkgAgentId string `position:"Query" field:"pkg_agent_id"`
|
||||
PkgSiteId string `position:"Query" field:"pkg_site_id"`
|
||||
Network string `position:"Query" field:"network"`
|
||||
ScreenResolution string `position:"Query" field:"screen_resolution"`
|
||||
System string `position:"Query" field:"system"`
|
||||
Electric string `position:"Query" field:"electric"`
|
||||
ProcessorModel string `position:"Query" field:"processor_model"`
|
||||
BaseBand string `position:"Query" field:"baseband"`
|
||||
Model string `position:"Query" field:"model"`
|
||||
Battery string `position:"Query" field:"battery"`
|
||||
Oaid string `position:"Query" field:"oaid"`
|
||||
AdInfo string `position:"Query" field:"adinfo"`
|
||||
WxPlatform string `position:"Query" field:"wx_platform"`
|
||||
}
|
||||
|
||||
type GetIdfaResp struct {
|
||||
*responses.BaseResponse
|
||||
GameId int `json:"game_id"`
|
||||
AgentId int `json:"agent_id"`
|
||||
SiteId int `json:"site_id"`
|
||||
GameAwemeId string `json:"game_aweme_id"`
|
||||
LongId string `json:"long_id"`
|
||||
DeviceId string `json:"device_id"`
|
||||
Exists bool `json:"exists"`
|
||||
FromAd bool `json:"from_ad"`
|
||||
MatchType int `json:"match_type"`
|
||||
ClickId string `json:"click_id,omitempty"` // 非必要字段,使用 omitempty 忽略空值
|
||||
MatchTrace string `json:"match_trace,omitempty"` // 非必要字段
|
||||
RegTime int64 `json:"reg_time"`
|
||||
}
|
||||
|
||||
func CreateGetIdfaReq() *GetIdfaReq {
|
||||
req := &GetIdfaReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/getidfa.php")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
type GetUserAttrReq struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Query" field:"user_name"`
|
||||
GameSign string `position:"Query" field:"game_sign"`
|
||||
Ts int64 `position:"Query" field:"ts"`
|
||||
Sign string `position:"Query" field:"sign"`
|
||||
}
|
||||
|
||||
type GetUserAttrResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
Uid int `json:"uid"`
|
||||
UserName string `json:"user_name"`
|
||||
RegTime int `json:"reg_time"` // 假设注册时间是时间戳
|
||||
GameID int `json:"game_id"`
|
||||
RegIP string `json:"reg_ip"`
|
||||
AgentId int `json:"agent_id"`
|
||||
SiteId int `json:"site_id"`
|
||||
Imei string `json:"imei"`
|
||||
Oaid string `json:"oaid"`
|
||||
LongId string `json:"long_id"`
|
||||
PromotionId string `json:"promotion_id"`
|
||||
Mid3 string `json:"mid3"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetUserAttrReq(userName, gameSign string) *GetUserAttrReq {
|
||||
req := &GetUserAttrReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.UserName = userName
|
||||
req.GameSign = gameSign
|
||||
req.Ts = time.Now().Unix()
|
||||
req.Sign = utils.Md5(fmt.Sprintf("%d%s", req.Ts, msdkKey))
|
||||
req.InitWithApiInfo(HOST, VERSION, "/getUserAttr.php")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
type GetImeiReq struct {
|
||||
*requests.RpcRequest
|
||||
Uid int `position:"Query" field:"uid"`
|
||||
UserName string `position:"Query" field:"user_name"`
|
||||
GameId int `position:"Query" field:"game_id"`
|
||||
GameSign string `position:"Query" field:"game_sign"`
|
||||
RegTime int64 `position:"Query" field:"reg_time"`
|
||||
Imei string `position:"Query" field:"imei"`
|
||||
ChannelId int `position:"Query" field:"mtype"`
|
||||
AgentId int `position:"Query" field:"agent_id"`
|
||||
SiteId int `position:"Query" field:"site_id"`
|
||||
Ip string `position:"Query" field:"ip"`
|
||||
UserIp string `position:"Query" field:"user_ip"`
|
||||
Idfa string `position:"Query" field:"idfa"`
|
||||
Logined int `position:"Query" field:"logined"`
|
||||
MatchType int `position:"Query" field:"match_type"`
|
||||
GameAwemeId string `position:"Query" field:"game_aweme_id"`
|
||||
ComeBackUser int `position:"Query" field:"come_back_user"` //回流用户标识 1=>回流用户
|
||||
LpReg int `position:"Query" field:"lp_reg"` // 落地页注册用户标识
|
||||
FanCode string `position:"Query" field:"fan_code"` // 粉丝码
|
||||
Network string `position:"Query" field:"network"`
|
||||
Idfv string `position:"Query" field:"idfv"`
|
||||
ScreenResolution string `position:"Query" field:"screen_resolution"`
|
||||
System string `position:"Query" field:"system"`
|
||||
Electric string `position:"Query" field:"electric"`
|
||||
ProcessorModel string `position:"Query" field:"processor_model"`
|
||||
BaseBand string `position:"Query" field:"baseband"`
|
||||
Model string `position:"Query" field:"model"`
|
||||
Battery string `position:"Query" field:"battery"`
|
||||
Oaid string `position:"Query" field:"oaid"`
|
||||
AdInfo string `position:"Query" field:"adinfo"`
|
||||
AdDevice string `position:"Query" field:"ad_device"`
|
||||
Ua string `position:"Query" field:"ua"`
|
||||
WxPlatform string `position:"Query" field:"wx_platform"`
|
||||
}
|
||||
|
||||
type GetImeiResp struct {
|
||||
*responses.BaseResponse
|
||||
Uid string `json:"uid"`
|
||||
UserName string `json:"user_name"`
|
||||
Openid string `json:"openid"`
|
||||
ChannelId string `json:"mtype"`
|
||||
Logined int `json:"logined"`
|
||||
GameId string `json:"game_id"`
|
||||
GameSign string `json:"game_sign"`
|
||||
MatchType int `json:"match_type"`
|
||||
RegTime int64 `json:"reg_time"` // 原始时间戳字符串
|
||||
Imei string `json:"imei"`
|
||||
Oaid string `json:"oaid"`
|
||||
Idfa string `json:"idfa"`
|
||||
Ip int64 `json:"ip"`
|
||||
UserIp string `json:"user_ip"`
|
||||
Ua string `json:"ua"`
|
||||
Media string `json:"media"`
|
||||
AgentId int `json:"agent_id"`
|
||||
SiteId int `json:"site_id"`
|
||||
AdInfo string `json:"adinfo"`
|
||||
GameAwemeId string `json:"game_aweme_id"`
|
||||
}
|
||||
|
||||
func CreateGetImeiReq() *GetImeiReq {
|
||||
req := &GetImeiReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/getimei.php")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
type SetImeiReq struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Query" field:"user_name"`
|
||||
GameId int `position:"Query" field:"game_id"`
|
||||
Imei string `position:"Query" field:"imei"`
|
||||
Idfa string `position:"Query" field:"idfa"`
|
||||
GameSign string `position:"Query" field:"game_sign"`
|
||||
ChannelId int `position:"Query" field:"mtype"`
|
||||
MatchType int `position:"Query" field:"match_type"`
|
||||
Network string `position:"Query" field:"network"`
|
||||
Idfv string `position:"Query" field:"idfv"`
|
||||
ScreenResolution string `position:"Query" field:"screen_resolution"`
|
||||
System string `position:"Query" field:"system"` // 可能为系统版本号字符串
|
||||
ProcessorModel string `position:"Query" field:"processor_model"`
|
||||
BaseBand string `position:"Query" field:"baseband"`
|
||||
Model string `position:"Query" field:"model"`
|
||||
Battery string `position:"Query" field:"battery"`
|
||||
Oaid string `position:"Query" field:"oaid"`
|
||||
AdInfo string `position:"Query" field:"adinfo"`
|
||||
AdDevice string `position:"Query" field:"ad_device"`
|
||||
Ua string `position:"Query" field:"ua"`
|
||||
WxPlatform string `position:"Query" field:"wx_platform"`
|
||||
}
|
||||
|
||||
type SetImeiResp struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateSetImeiReq() *SetImeiReq {
|
||||
req := &SetImeiReq{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/setimei.php")
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
@ -3,12 +3,11 @@ package oss
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
"time"
|
||||
)
|
||||
|
||||
type GetApkVersionRequest struct {
|
||||
*requests.JsonRequest
|
||||
Filepath string `position:"Json" field:"filepath"`
|
||||
Filepath string `position:"Body" field:"filepath"`
|
||||
}
|
||||
|
||||
type GetApkVersionResponse struct {
|
||||
@ -16,10 +15,8 @@ type GetApkVersionResponse struct {
|
||||
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"`
|
||||
VersionCode string `json:"versionCode"`
|
||||
VersionName string `json:"versionName"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
@ -29,7 +26,6 @@ func CreateGetApkVersionRequest() (req *GetApkVersionRequest) {
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/apk/version")
|
||||
req.Method = requests.POST
|
||||
req.SetReadTimeout(30 * time.Second)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ func NewClientWithSts() {
|
||||
}
|
||||
|
||||
func (c *Client) PutOss(req *PutOssRequest) (resp *PutOssResponse, err error) {
|
||||
if req.Bucket == "" {
|
||||
if req.BucketName == "" {
|
||||
err = errors.New("bucket name is empty")
|
||||
return
|
||||
}
|
||||
|
||||
@ -8,8 +8,7 @@ import (
|
||||
|
||||
func TestUpload_Put(t *testing.T) {
|
||||
req := CreatePutOssRequest()
|
||||
req.Bucket = "image"
|
||||
//req.Bucket = "web"
|
||||
req.BucketName = "image"
|
||||
file, err := os.ReadFile("test.jpg")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
@ -27,7 +26,7 @@ func TestUpload_Put(t *testing.T) {
|
||||
|
||||
func TestUpload_Del(t *testing.T) {
|
||||
req := CreateDelOssRequest()
|
||||
req.Bucket = "image"
|
||||
req.BucketName = "image"
|
||||
req.MediaUrl = "https://image.89yoo.com/uploads/549/549e887460a72333c361661683023018.jpeg"
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
@ -44,16 +43,10 @@ func TestUpload_Del(t *testing.T) {
|
||||
|
||||
func TestCreateInitMultipartUpload(t *testing.T) {
|
||||
req := CreateInitMultipartUploadRequest()
|
||||
|
||||
extInfo := map[string]any{"game_byname": "tech_test_tencent"}
|
||||
bExtInfo, _ := json.Marshal(extInfo)
|
||||
|
||||
req.UploadType = "package"
|
||||
req.Filepath = "test.jpg"
|
||||
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)
|
||||
@ -73,7 +66,7 @@ func TestCreateInitMultipartUpload(t *testing.T) {
|
||||
|
||||
func TestClient_GetApkVersion(t *testing.T) {
|
||||
req := CreateGetApkVersionRequest()
|
||||
req.Filepath = "uploads/files/package/1f57ac9693f0593fc9073f366b1c1936.zip"
|
||||
req.Filepath = "36c55c4c3a2f4c79e3917b989d580496.zip"
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@ -15,12 +15,10 @@ const (
|
||||
|
||||
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"`
|
||||
Filepath string `position:"Body" field:"filepath"`
|
||||
TargetType string `position:"Body" field:"target_type"`
|
||||
TargetName string `position:"Body" field:"target_name"`
|
||||
FileHash string `position:"Body" field:"file_hash"`
|
||||
}
|
||||
|
||||
type InitMultipartUploadResponse struct {
|
||||
@ -52,7 +50,7 @@ func CreateInitMultipartUploadRequest() (req *InitMultipartUploadRequest) {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ import (
|
||||
|
||||
type DelOssRequest struct {
|
||||
*requests.JsonRequest
|
||||
Bucket string `position:"Json" field:"bucket" default:"image"`
|
||||
MediaUrl string `position:"Json" field:"url" default:"-"`
|
||||
BucketName string `position:"Body" field:"bucket_name" default:"image"`
|
||||
MediaUrl string `position:"Body" field:"url" default:"-"`
|
||||
}
|
||||
|
||||
type DelOssResponse struct {
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
|
||||
type PutOssRequest struct {
|
||||
*requests.StreamRequest
|
||||
Bucket string `position:"Query" field:"bucket" default:"image"`
|
||||
BucketName string `position:"Query" field:"bucket_name" default:"image"`
|
||||
FileStream []byte
|
||||
}
|
||||
|
||||
@ -16,8 +16,7 @@ type PutOssResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
Url string `json:"url"`
|
||||
SavePath string `json:"save_path"`
|
||||
Url string `json:"url"`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,155 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "2025-05-28"
|
||||
// 对称加密密钥
|
||||
appKey = "#gr*%com#"
|
||||
)
|
||||
|
||||
var HOST requests.Host = requests.Host{
|
||||
Default: "passport.gaore.com",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = new(Client)
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserList
|
||||
// 获取用户列表
|
||||
func (c *Client) GetUserList(req *GetUserListRequest) (response *GetUserListResponse, err error) {
|
||||
response = CreateGetUserListResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserRoleList
|
||||
// 获取用户角色列表
|
||||
func (c *Client) GetUserRoleList(req *GetUserRoleListRequest) (response *GetUserRoleListResponse, err error) {
|
||||
response = CreateGetUserRoleListResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// EditCard
|
||||
// 新增或修改实名信息
|
||||
func (c *Client) EditCard(req EditCardRequestParam) (response string, err error) {
|
||||
editCardRequest := CreateEditCardRequest(req)
|
||||
createEditCardResponse := CreateEditCardResponse()
|
||||
err = c.DoAction(editCardRequest, createEditCardResponse)
|
||||
if err != nil && strings.Contains(err.Error(), "json Unmarshal:") {
|
||||
return createEditCardResponse.GetHttpContentString(), nil
|
||||
} else if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return createEditCardResponse.GetHttpContentString(), nil
|
||||
}
|
||||
|
||||
// DelUserAuth
|
||||
// 清除用户实名信息(清空分表 true_name/id_card,删除 user_real_auth 记录),成功返回 "ok"
|
||||
func (c *Client) DelUserAuth(param DelUserAuthRequestParam) (response string, err error) {
|
||||
delUserAuthRequest := CreateDelUserAuthRequest(param)
|
||||
delUserAuthResponse := CreateDelUserAuthResponse()
|
||||
err = c.DoAction(delUserAuthRequest, delUserAuthResponse)
|
||||
if err != nil && strings.Contains(err.Error(), "json Unmarshal:") {
|
||||
return delUserAuthResponse.GetHttpContentString(), nil
|
||||
} else if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return delUserAuthResponse.GetHttpContentString(), nil
|
||||
}
|
||||
|
||||
// EditPhone
|
||||
// 修改/清除用户手机号(phone 传空字符串即清除),成功返回 "ok"
|
||||
func (c *Client) EditPhone(param EditPhoneRequestParam) (response string, err error) {
|
||||
editPhoneRequest := CreateEditPhoneRequest(param)
|
||||
editPhoneResponse := CreateEditPhoneResponse()
|
||||
err = c.DoAction(editPhoneRequest, editPhoneResponse)
|
||||
if err != nil && strings.Contains(err.Error(), "json Unmarshal:") {
|
||||
return editPhoneResponse.GetHttpContentString(), nil
|
||||
} else if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return editPhoneResponse.GetHttpContentString(), nil
|
||||
}
|
||||
|
||||
// EditPassword
|
||||
// 修改/清除用户手机号(phone 传空字符串即清除),成功返回 "ok"
|
||||
func (c *Client) EditPassword(param EditPasswordRequestParam) (response string, err error) {
|
||||
editPasswordRequest := CreateEditPasswordRequest(param)
|
||||
editPasswordResponse := CreateEditPasswordResponse()
|
||||
err = c.DoAction(editPasswordRequest, editPasswordResponse)
|
||||
if err != nil && strings.Contains(err.Error(), "json Unmarshal:") {
|
||||
return editPasswordResponse.GetHttpContentString(), nil
|
||||
} else if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return editPasswordResponse.GetHttpContentString(), nil
|
||||
}
|
||||
|
||||
// GetUserGameSign
|
||||
// 获取用户登录过的游戏大类
|
||||
func (c *Client) GetUserGameSign(req *GetUserGameSignRequest) (response *GetUserGameSignResponse, err error) {
|
||||
response = CreateGetUserGameSignResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// ChangePassword
|
||||
// 用户修改密码
|
||||
func (c *Client) ChangePassword(req *ChangePasswordRequest) (response *ChangePasswordResponse, err error) {
|
||||
response = CreateChangePasswordResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateUserState
|
||||
// 修改用户状态
|
||||
func (c *Client) UpdateUserState(req *UpdateUserStateRequest) (response *UpdateUserStateResponse, err error) {
|
||||
response = CreateUpdateUserStateResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserLabels
|
||||
// 获取用户标签
|
||||
func (c *Client) GetUserLabels(req *GetUserLabelsRequest) (response *GetUserLabelsResponse, err error) {
|
||||
response = CreateGetUserLabelsResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserRegInfo
|
||||
// 获取用户注册信息
|
||||
func (c *Client) GetUserRegInfo(req *GetUserRegInfoRequest) (response *GetUserRegInfoResponse, err error) {
|
||||
response = CreateGetUserRegInfoResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserId 通过用户名查询 uid
|
||||
func (c *Client) GetUserId(req *GetUserIdRequest) (response *GetUserIdResponse, err error) {
|
||||
response = CreateGetUserIdResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserLogin
|
||||
// 获取用户登陆信息
|
||||
func (c *Client) GetUserLogin(req *GetUserLoginRequest) (response *GetUserLoginResponse, err error) {
|
||||
response = CreateGetUserLoginResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
@ -1,297 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
// 单元测试
|
||||
|
||||
func TestGetUserList(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateGetUserListRequest("ws45265737")
|
||||
resp, err := client.GetUserList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Logf("resp code:%+v", resp.Code)
|
||||
t.Logf("resp data:%+v", resp.Data)
|
||||
}
|
||||
|
||||
func TestGetUserRoleList(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// 不限定角色
|
||||
//req := CreateGetUserRoleListRequest(221016372, 7874, 0, "")
|
||||
// 限定角色
|
||||
req := CreateGetUserRoleListRequest(221016372, 7874, 265500390, "勇闯关东")
|
||||
resp, err := client.GetUserRoleList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Logf("resp code:%+v", resp.Code)
|
||||
t.Logf("resp data:%+v", resp.Data)
|
||||
}
|
||||
|
||||
func TestGetUserRoleList2(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// 不限定角色
|
||||
//req := CreateGetUserRoleListRequest(221016372, 7874, 0, "")
|
||||
// 限定角色
|
||||
req := CreateGetUserRoleListRequest2(GetUserRoleListParam{
|
||||
Uid: 0,
|
||||
Username: "rz35990497",
|
||||
GameIds: "7866,7873,7874,7875,7934",
|
||||
RoleId: 0,
|
||||
RoleServer: "",
|
||||
})
|
||||
resp, err := client.GetUserRoleList(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Logf("resp code:%+v", resp.Code)
|
||||
t.Logf("resp data:%+v", resp.Data)
|
||||
}
|
||||
|
||||
func TestEditCard(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
editCardRequest := EditCardRequestParam{
|
||||
Uid: 32455414,
|
||||
GameId: 5010,
|
||||
Imei: "11111111",
|
||||
IsReal: 0,
|
||||
DirectStatus: 1,
|
||||
AuthChannel: "gjfcm_wzcq",
|
||||
DirectExtData: "测试测试测试",
|
||||
Pi: "",
|
||||
Ip: "",
|
||||
Ipv6: "",
|
||||
UserName: "asfasfd",
|
||||
RealName: "这艘啊",
|
||||
IdCard: "33032419950123532X",
|
||||
Mandatory: "3123123123",
|
||||
}
|
||||
editCardResponse, err := client.EditCard(editCardRequest)
|
||||
t.Logf("%v", editCardResponse)
|
||||
|
||||
}
|
||||
|
||||
// 测试获取用户登录过的游戏大类
|
||||
func TestGetUserGameSign(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateGetUserGameSignRequest("oo70683572", "", "")
|
||||
resp, err := client.GetUserGameSign(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
t.Logf("resp code:%+v", resp.Code)
|
||||
t.Logf("resp data:%+v", resp.Data)
|
||||
}
|
||||
|
||||
// 测试用户修改密码
|
||||
func TestChangePassword(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateChangePasswordRequest("rz35990497", "7654321")
|
||||
|
||||
resp, err := client.ChangePassword(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// 记录文本结果
|
||||
t.Logf("resp code:%+v, msg:%s", resp.Code, resp.Msg)
|
||||
}
|
||||
|
||||
// 测试修改用户状态
|
||||
func TestUpdateUserState(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req := CreateUpdateUserStateRequest("masterpan", 0, 2)
|
||||
resp, err := client.UpdateUserState(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
// 记录文本结果
|
||||
t.Logf("resp code:%+v, msg:%s", resp.Code, resp.Msg)
|
||||
}
|
||||
|
||||
// 测试获取用户注册信息
|
||||
func TestGetUserRegInfo(t *testing.T) {
|
||||
req := CreateGetUserRegInfoRequest("xc21225964")
|
||||
if err := requests.InitParam(req); err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if req.GetMethod() != requests.POST || req.GetActionName() != "/remote_login.php" {
|
||||
t.Errorf("get user reg info req: method=%s path=%s", req.GetMethod(), req.GetActionName())
|
||||
return
|
||||
}
|
||||
if req.GetFormParams()["act"] != "info" {
|
||||
t.Errorf("unexpected act param: %q", req.GetFormParams()["act"])
|
||||
return
|
||||
}
|
||||
if req.GetFormParams()["do"] != "get_user_reg_info" {
|
||||
t.Errorf("unexpected do param: %q", req.GetFormParams()["do"])
|
||||
return
|
||||
}
|
||||
if req.GetFormParams()["user_name"] != "xc21225964" {
|
||||
t.Errorf("unexpected user_name param: %q", req.GetFormParams()["user_name"])
|
||||
return
|
||||
}
|
||||
if req.GetFormParams()["time"] == "" || req.GetFormParams()["sign"] == "" {
|
||||
t.Errorf("unexpected sign params: time=%q sign=%q", req.GetFormParams()["time"], req.GetFormParams()["sign"])
|
||||
return
|
||||
}
|
||||
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
resp, err := client.GetUserRegInfo(req)
|
||||
if err != nil {
|
||||
if resp != nil {
|
||||
fmt.Printf("%s\n", resp.GetHttpContentString())
|
||||
fmt.Printf("%#+v\n", resp)
|
||||
}
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if resp == nil {
|
||||
t.Errorf("get user reg info response is nil")
|
||||
return
|
||||
}
|
||||
if resp.Code != 1 || resp.Msg != "获取成功" || resp.Data.RegTime <= 0 {
|
||||
t.Errorf("get user reg info response: code=%d msg=%s data=%+v", resp.Code, resp.Msg, resp.Data)
|
||||
fmt.Printf("%#+v\n", resp)
|
||||
return
|
||||
}
|
||||
fmt.Printf("%#+v\n", resp)
|
||||
fmt.Printf("%#+v\n", resp.Data)
|
||||
}
|
||||
|
||||
// 测试通过用户名查询 uid
|
||||
func TestGetUserId(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateGetUserIdRequest("qy13815523")
|
||||
resp, err := client.GetUserId(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
data, err := resp.GetData()
|
||||
if err != nil {
|
||||
t.Errorf("解析返回数据失败: %v, raw: %s", err, resp.GetHttpContentString())
|
||||
return
|
||||
}
|
||||
fmt.Printf("raw: %s\n", resp.GetHttpContentString())
|
||||
fmt.Printf("data: %+v\n", data)
|
||||
}
|
||||
|
||||
// 测试清除用户实名信息(演示调用方式)
|
||||
// 注意:该接口会真实清除账号实名(清空分表 true_name/id_card 并删除 user_real_auth 记录),
|
||||
// 仅可对测试账号执行,切勿对真实玩家账号运行。
|
||||
func TestDelUserAuth(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
// 调用方式:传入待清除实名的玩家账号
|
||||
param := DelUserAuthRequestParam{
|
||||
UserName: "pv23669710", // 占位测试账号
|
||||
}
|
||||
res, err := client.DelUserAuth(param)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
// 远端返回纯文本,"ok" 表示清除成功
|
||||
t.Logf("del user auth result: %s", res)
|
||||
}
|
||||
|
||||
// 测试修改/清除用户手机号(演示调用方式)
|
||||
// 注意:phone 传空字符串即清除手机号,会真实修改账号数据,仅可对测试账号执行。
|
||||
func TestEditPhone(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
// 调用方式:phone 传空串清除手机号,传具体号码则修改为该号码
|
||||
param := EditPhoneRequestParam{
|
||||
UserName: "18271216432", // 占位测试账号
|
||||
Phone: "",
|
||||
}
|
||||
res, err := client.EditPhone(param)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
// 远端返回纯文本,"ok" 表示成功
|
||||
t.Logf("edit phone result: %s", res)
|
||||
}
|
||||
|
||||
// 测试获取用户登陆信息
|
||||
func TestGetUserLogin(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := CreateGetUserLoginRequest("gr28063399")
|
||||
resp, err := client.GetUserLogin(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("raw: %s\n", resp.GetHttpContentString())
|
||||
fmt.Printf("data: %+v\n, %d", resp.Data, len(resp.Data))
|
||||
}
|
||||
|
||||
// 测试修改密码
|
||||
func TestEditPassword(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
req := EditPasswordRequestParam{
|
||||
UserName: "huangqzcs",
|
||||
Newpwd: "123456789",
|
||||
}
|
||||
resp, err := client.EditPassword(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
t.Logf("edit phone result: %s", resp)
|
||||
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
// GetUserIdRequest 通过用户名查询 uid
|
||||
type GetUserIdRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
// GetUserIdResponse 返回 {"uid": "user_name", ...} 格式的 map
|
||||
type GetUserIdResponse struct {
|
||||
*responses.BaseResponse
|
||||
}
|
||||
|
||||
// GetData 解析返回的 map,key 为 uid,value 为 user_name
|
||||
func (r *GetUserIdResponse) GetData() (map[string]string, error) {
|
||||
result := make(map[string]string)
|
||||
err := json.Unmarshal(r.GetHttpContentBytes(), &result)
|
||||
return result, err
|
||||
}
|
||||
|
||||
// CreateGetUserIdRequest 构造请求,user_name 支持逗号分隔多个
|
||||
func CreateGetUserIdRequest(userName string) *GetUserIdRequest {
|
||||
req := &GetUserIdRequest{RpcRequest: &requests.RpcRequest{}}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/get_userid.php")
|
||||
if !strings.Contains(userName, ",") {
|
||||
userName = fmt.Sprintf("%v,%v", userName, userName)
|
||||
}
|
||||
req.QueryParams = map[string]string{
|
||||
"user_name": userName,
|
||||
"type": "1",
|
||||
}
|
||||
req.Method = requests.GET
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateGetUserIdResponse() *GetUserIdResponse {
|
||||
return &GetUserIdResponse{BaseResponse: &responses.BaseResponse{}}
|
||||
}
|
||||
@ -1,43 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type ChangePasswordRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
func CreateChangePasswordRequest(userName string, newPwd string) (req *ChangePasswordRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &ChangePasswordRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "getpwd",
|
||||
"do": "passwd",
|
||||
"username": userName,
|
||||
"newpwd": newPwd,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
"format": "json",
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateChangePasswordResponse() (response *ChangePasswordResponse) {
|
||||
response = &ChangePasswordResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ChangePasswordResponse struct {
|
||||
*responses.BaseResponse
|
||||
}
|
||||
@ -1,51 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cast"
|
||||
_ "github.com/spf13/cast"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type UpdateUserStateRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type UpdateUserStateResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
State int `json:"state"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
// CreateUpdateUserStateRequest 获取用户登录过的游戏大类
|
||||
func CreateUpdateUserStateRequest(userName string, uid, state int) (req *UpdateUserStateRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &UpdateUserStateRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "update",
|
||||
"do": "update_user_state",
|
||||
"user_name": userName,
|
||||
"uid": cast.ToString(uid),
|
||||
"state": cast.ToString(state),
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateUpdateUserStateResponse() (response *UpdateUserStateResponse) {
|
||||
response = &UpdateUserStateResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type GetUserRegInfoRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserRegInfoResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
RegTime int64 `json:"reg_time"`
|
||||
GameId int64 `json:"game_id"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
// CreateGetUserRegInfoRequest 获取用户注册信息
|
||||
func CreateGetUserRegInfoRequest(userName string) (req *GetUserRegInfoRequest) {
|
||||
ts, sign := GetSign()
|
||||
req = &GetUserRegInfoRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "info",
|
||||
"do": "get_user_reg_info",
|
||||
"user_name": userName,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserRegInfoResponse() (response *GetUserRegInfoResponse) {
|
||||
response = &GetUserRegInfoResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,333 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type GetUserListRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserListResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []UserInfo `json:"data"`
|
||||
}
|
||||
|
||||
type UserInfo struct {
|
||||
Id string `json:"id"`
|
||||
Uid string `json:"uid"`
|
||||
BbsUid string `json:"bbs_uid"`
|
||||
UserName string `json:"user_name"`
|
||||
UserPwd string `json:"user_pwd"`
|
||||
Email string `json:"email"`
|
||||
Integral string `json:"integral"`
|
||||
NickName string `json:"nick_name"`
|
||||
TrueName string `json:"true_name"`
|
||||
Sex string `json:"sex"`
|
||||
IdType string `json:"id_type"`
|
||||
IdCard string `json:"id_card"`
|
||||
Birthday string `json:"birthday"`
|
||||
Telephone string `json:"telephone"`
|
||||
Mobile string `json:"mobile"`
|
||||
Address string `json:"address"`
|
||||
Zipcode int64 `json:"zipcode"`
|
||||
Level string `json:"level"`
|
||||
Qq string `json:"qq"`
|
||||
Msn string `json:"msn"`
|
||||
Question string `json:"question"`
|
||||
Answer string `json:"answer"`
|
||||
HeadPic string `json:"head_pic"`
|
||||
Defendboss string `json:"defendboss"`
|
||||
RegTime int64 `json:"reg_time"`
|
||||
RegIp string `json:"reg_ip"`
|
||||
LoginIp string `json:"login_ip"`
|
||||
LoginTime string `json:"login_time"`
|
||||
State string `json:"state"`
|
||||
}
|
||||
|
||||
// CreateGetUserListRequest 获取玩家用户列表
|
||||
func CreateGetUserListRequest(userName string) (req *GetUserListRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &GetUserListRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "info",
|
||||
"do": "get_user_list",
|
||||
"user_names": userName,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserListResponse() (response *GetUserListResponse) {
|
||||
response = &GetUserListResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type GetUserRoleListRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserRoleListResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []UserRoleInfo `json:"data"`
|
||||
}
|
||||
|
||||
type UserRoleInfo struct {
|
||||
Uid string `json:"uid"` // uid
|
||||
GameId string `json:"game_id"` // 子游戏id
|
||||
RoleId string `json:"role_id"` // 角色id
|
||||
RoleName string `json:"role_name"` // 角色名
|
||||
RoleServer string `json:"role_server"` // 角色服务器名
|
||||
AddTime string `json:"add_time"` // 创建时间戳
|
||||
UpdateTime string `json:"update_time"` // 更新时间戳
|
||||
}
|
||||
|
||||
type GetUserRoleListParam struct {
|
||||
Uid int
|
||||
Username string
|
||||
GameId int
|
||||
RoleId int
|
||||
RoleServer string
|
||||
GameIds string
|
||||
}
|
||||
|
||||
// GetSign 封装一个方法,获取当天时间戳和api签名
|
||||
func GetSign() (ts int64, sign string) {
|
||||
ts = time.Now().Unix()
|
||||
hash := md5.New()
|
||||
hash.Write([]byte(fmt.Sprintf("%v%v", ts, appKey)))
|
||||
hashBytes := hash.Sum(nil)
|
||||
sign = hex.EncodeToString(hashBytes)
|
||||
return
|
||||
}
|
||||
|
||||
// CreateGetUserRoleListRequest2 获取玩家角色列表
|
||||
func CreateGetUserRoleListRequest2(param GetUserRoleListParam) (req *GetUserRoleListRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &GetUserRoleListRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "info",
|
||||
"do": "user_role",
|
||||
"method": "get",
|
||||
"uid": fmt.Sprintf("%d", param.Uid),
|
||||
"game_id": fmt.Sprintf("%d", param.GameId),
|
||||
"game_ids": fmt.Sprintf("%v", param.GameIds),
|
||||
"role_id": fmt.Sprintf("%d", param.RoleId),
|
||||
"role_server": param.RoleServer,
|
||||
"username": param.Username,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
// CreateGetUserRoleListRequest 获取玩家角色列表
|
||||
func CreateGetUserRoleListRequest(uid int, gameId int, roleId int, roleServer string) (req *GetUserRoleListRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &GetUserRoleListRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "info",
|
||||
"do": "user_role",
|
||||
"method": "get",
|
||||
"uid": fmt.Sprintf("%d", uid),
|
||||
"game_id": fmt.Sprintf("%d", gameId),
|
||||
"role_id": fmt.Sprintf("%d", roleId),
|
||||
"role_server": roleServer,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserRoleListResponse() (response *GetUserRoleListResponse) {
|
||||
response = &GetUserRoleListResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type GetUserGameSignRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserGameSignResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
List []UserGameSign `json:"list"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type UserGameSign struct {
|
||||
Id string `json:"id"`
|
||||
AgentId string `json:"agent_id"`
|
||||
SiteId string `json:"site_id"`
|
||||
Uid string `json:"uid"`
|
||||
UserName string `json:"user_name"`
|
||||
GameId string `json:"game_id"`
|
||||
GameSign string `json:"game_sign"`
|
||||
Oaid string `json:"oaid"`
|
||||
Imei string `json:"imei"`
|
||||
Imei2 string `json:"imei2"`
|
||||
Ua string `json:"ua"`
|
||||
FirstLoginIp string `json:"first_login_ip"`
|
||||
FirstLoginTime string `json:"first_login_time"`
|
||||
LastLoginIp string `json:"last_login_ip"`
|
||||
LastLoginTime string `json:"last_login_time"`
|
||||
}
|
||||
|
||||
// CreateGetUserGameSignRequest 获取用户登录过的游戏大类
|
||||
func CreateGetUserGameSignRequest(userName, gameSign, orderBy string) (req *GetUserGameSignRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &GetUserGameSignRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "info",
|
||||
"do": "get_user_game_sign",
|
||||
"username": userName,
|
||||
"game_sign": gameSign,
|
||||
"order_by": orderBy,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserGameSignResponse() (response *GetUserGameSignResponse) {
|
||||
response = &GetUserGameSignResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type GetUserLabelsRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserLabelsResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data []UserLabel `json:"data"`
|
||||
}
|
||||
|
||||
type UserLabel struct {
|
||||
LabelId int64 `json:"label_id"`
|
||||
UserName string `json:"user_name"`
|
||||
}
|
||||
|
||||
// CreateGetUserLabelsRequest 获取用户标签
|
||||
func CreateGetUserLabelsRequest(userNames, labelIds string) (req *GetUserLabelsRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &GetUserLabelsRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "info",
|
||||
"do": "get_user_labels",
|
||||
"user_names": userNames,
|
||||
"label_ids": labelIds,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserLabelsResponse() (response *GetUserLabelsResponse) {
|
||||
response = &GetUserLabelsResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type GetUserLoginRequest struct {
|
||||
*requests.RpcRequest
|
||||
}
|
||||
|
||||
type GetUserLoginResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data map[string]UserLogin `json:"data"`
|
||||
}
|
||||
|
||||
type UserLogin struct {
|
||||
Uid int64 `json:"uid"`
|
||||
UserName string `json:"user_name"`
|
||||
GameId int64 `json:"game_id"`
|
||||
Imei string `json:"imei"`
|
||||
Imei2 string `json:"imei2"`
|
||||
LastLoginTime int64 `json:"last_login_time"`
|
||||
LastLoginIp string `json:"last_login_ip"`
|
||||
AgentId int64 `json:"agent_id"`
|
||||
SiteId int64 `json:"site_id"`
|
||||
FirstLoginTime int64 `json:"first_login_time"`
|
||||
}
|
||||
|
||||
// CreateGetUserLoginRequest 获取用户登陆信息
|
||||
func CreateGetUserLoginRequest(userNames string) (req *GetUserLoginRequest) {
|
||||
ts, sign := GetSign()
|
||||
|
||||
req = &GetUserLoginRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
|
||||
req.FormParams = map[string]string{
|
||||
"act": "info",
|
||||
"do": "get_user_login",
|
||||
"user_names": userNames,
|
||||
"time": fmt.Sprintf("%v", ts),
|
||||
"sign": sign,
|
||||
}
|
||||
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserLoginResponse() (response *GetUserLoginResponse) {
|
||||
response = &GetUserLoginResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,228 +0,0 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"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/utils"
|
||||
)
|
||||
|
||||
const weeDongKey = "aVCxX2B3yswpxCMjaaSUHFXAzLYyuGhW"
|
||||
|
||||
func weeDongGetSign(ts int64) string {
|
||||
return utils.Md5(utils.Md5(fmt.Sprintf("%d", ts)+weeDongKey) + weeDongKey)
|
||||
}
|
||||
|
||||
type EditCardRequestParam struct {
|
||||
Uid int64 `position:"Body" field:"uid"`
|
||||
GameId int64 `position:"Body" field:"game_id"`
|
||||
Imei string `position:"Body" field:"imei"`
|
||||
IsReal int64 `position:"Body" field:"is_real"`
|
||||
IsDirect int64 `position:"Body" field:"is_direct"`
|
||||
DirectStatus int64 `position:"Body" field:"direct_status"`
|
||||
AuthChannel string `position:"Body" field:"auth_channel"`
|
||||
DirectExtData string `position:"Body" field:"direct_ext_data"`
|
||||
Pi string `position:"Body" field:"pi"`
|
||||
Ip string `position:"Body" field:"ip"`
|
||||
Ipv6 string `position:"Body" field:"ipv6"`
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
RealName string `position:"Body" field:"truename"`
|
||||
IdCard string `position:"Body" field:"idcard"`
|
||||
Mandatory string `position:"Body" field:"mandatory"`
|
||||
}
|
||||
|
||||
type EditCardResponse struct {
|
||||
*responses.BaseResponse
|
||||
}
|
||||
|
||||
type EditCardRequest struct {
|
||||
*requests.RpcRequest
|
||||
Uid int64 `position:"Body" field:"uid"`
|
||||
GameId int64 `position:"Body" field:"game_id"`
|
||||
Imei string `position:"Body" field:"imei"`
|
||||
IsReal int64 `position:"Body" field:"is_real"`
|
||||
IsDirect int64 `position:"Body" field:"is_direct"`
|
||||
DirectStatus int64 `position:"Body" field:"direct_status"`
|
||||
AuthChannel string `position:"Body" field:"auth_channel"`
|
||||
DirectExtData string `position:"Body" field:"direct_ext_data"`
|
||||
Pi string `position:"Body" field:"pi"`
|
||||
Ip string `position:"Body" field:"ip"`
|
||||
Ipv6 string `position:"Body" field:"ipv6"`
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
RealName string `position:"Body" field:"truename"`
|
||||
IdCard string `position:"Body" field:"idcard"`
|
||||
Mandatory string `position:"Body" field:"mandatory"`
|
||||
Action string `position:"Body" field:"action"`
|
||||
Flag string `position:"Body" field:"flag"`
|
||||
Time string `position:"Body" field:"time"`
|
||||
}
|
||||
|
||||
// CreateEditCardRequest 记录实名结果接口
|
||||
func CreateEditCardRequest(param EditCardRequestParam) (req *EditCardRequest) {
|
||||
ts := time.Now().Unix()
|
||||
sign := weeDongGetSign(ts)
|
||||
|
||||
req = &EditCardRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
Action: "edit_card",
|
||||
Flag: sign,
|
||||
Time: fmt.Sprintf("%v", ts),
|
||||
IsDirect: param.IsDirect,
|
||||
Uid: param.Uid,
|
||||
GameId: param.GameId,
|
||||
Imei: param.Imei,
|
||||
IsReal: param.IsReal,
|
||||
DirectStatus: param.DirectStatus,
|
||||
AuthChannel: param.AuthChannel,
|
||||
DirectExtData: param.DirectExtData,
|
||||
Pi: param.Pi,
|
||||
Ip: param.Ip,
|
||||
Ipv6: param.Ipv6,
|
||||
UserName: param.UserName,
|
||||
RealName: param.RealName,
|
||||
IdCard: param.IdCard,
|
||||
Mandatory: param.Mandatory,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/weedong.php")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateEditCardResponse() (response *EditCardResponse) {
|
||||
response = &EditCardResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type DelUserAuthRequestParam struct {
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
}
|
||||
|
||||
type DelUserAuthResponse struct {
|
||||
*responses.BaseResponse
|
||||
}
|
||||
|
||||
type DelUserAuthRequest struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
Action string `position:"Body" field:"action"`
|
||||
Flag string `position:"Body" field:"flag"`
|
||||
Time string `position:"Body" field:"time"`
|
||||
}
|
||||
|
||||
// CreateDelUserAuthRequest 清除用户实名信息接口
|
||||
// 远端会清空分表 user_X 的 true_name、id_card,并删除 user_real_auth 整条记录,只需传 user_name
|
||||
func CreateDelUserAuthRequest(param DelUserAuthRequestParam) (req *DelUserAuthRequest) {
|
||||
ts := time.Now().Unix()
|
||||
sign := weeDongGetSign(ts)
|
||||
|
||||
req = &DelUserAuthRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
Action: "del_user_auth",
|
||||
Flag: sign,
|
||||
Time: fmt.Sprintf("%v", ts),
|
||||
UserName: param.UserName,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/weedong.php")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateDelUserAuthResponse() (response *DelUserAuthResponse) {
|
||||
response = &DelUserAuthResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type EditPhoneRequestParam struct {
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
Phone string `position:"Body" field:"phone"`
|
||||
}
|
||||
|
||||
type EditPhoneResponse struct {
|
||||
*responses.BaseResponse
|
||||
}
|
||||
|
||||
type EditPhoneRequest struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
Phone string `position:"Body" field:"phone"`
|
||||
Action string `position:"Body" field:"action"`
|
||||
Flag string `position:"Body" field:"flag"`
|
||||
Time string `position:"Body" field:"time"`
|
||||
}
|
||||
|
||||
// CreateEditPhoneRequest 修改/清除用户手机号接口
|
||||
// 远端将分表 user_X 的 telephone 更新为传入的 phone(传空字符串即清除手机号)
|
||||
func CreateEditPhoneRequest(param EditPhoneRequestParam) (req *EditPhoneRequest) {
|
||||
ts := time.Now().Unix()
|
||||
sign := weeDongGetSign(ts)
|
||||
|
||||
req = &EditPhoneRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
Action: "edit_phone",
|
||||
Flag: sign,
|
||||
Time: fmt.Sprintf("%v", ts),
|
||||
UserName: param.UserName,
|
||||
Phone: param.Phone,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/weedong.php")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateEditPhoneResponse() (response *EditPhoneResponse) {
|
||||
response = &EditPhoneResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// EditPasswordRequestParam
|
||||
// 修改密码相关
|
||||
type EditPasswordRequestParam struct {
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
Newpwd string `position:"Body" field:"newpwd"`
|
||||
}
|
||||
|
||||
type EditPasswordResponse struct {
|
||||
*responses.BaseResponse
|
||||
}
|
||||
|
||||
type EditPasswordRequest struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
Newpwd string `position:"Body" field:"newpwd"`
|
||||
Action string `position:"Body" field:"action"`
|
||||
Flag string `position:"Body" field:"flag"`
|
||||
Time string `position:"Body" field:"time"`
|
||||
}
|
||||
|
||||
// CreateEditPasswordRequest 修改用户密码
|
||||
func CreateEditPasswordRequest(param EditPasswordRequestParam) (req *EditPasswordRequest) {
|
||||
ts := time.Now().Unix()
|
||||
sign := weeDongGetSign(ts)
|
||||
|
||||
req = &EditPasswordRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
Action: "edit_pwd",
|
||||
Flag: sign,
|
||||
Time: fmt.Sprintf("%v", ts),
|
||||
UserName: param.UserName,
|
||||
Newpwd: utils.Md5(param.Newpwd),
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/weedong.php")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateEditPasswordResponse() (response *EditPasswordResponse) {
|
||||
response = &EditPasswordResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -6,15 +6,15 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "2025-11-17"
|
||||
VERSION = "2024-06-03"
|
||||
)
|
||||
|
||||
var HOST requests.Host = requests.Host{
|
||||
Default: "pay.api.gaore.com",
|
||||
Default: "pay.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.RELEASE: "pay.gaore.com",
|
||||
requests.PRE: "pay.gaore.com",
|
||||
requests.TEST: "pay.gaore.com",
|
||||
}
|
||||
return a[s]
|
||||
@ -49,84 +49,8 @@ func (c *Client) ComplaintUpload(req *ComplaintUploadRequest) (response *Complai
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) MerchantConfigDebug(req *merchantConfigDebugRequest) (response *merchantConfigDebugResponse, err error) {
|
||||
response = CreateMerchantConfigDebugResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetOrderState
|
||||
// 获取订单状态
|
||||
func (c *Client) GetOrderState(req *GetOrderStateRequest) (response *GetOrderStateResponse, err error) {
|
||||
response = CreateGetOrderStateResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetVipInfo
|
||||
// 获取会员信息
|
||||
func (c *Client) GetVipInfo(req *GetVipInfoRequest) (response *GetVipInfoResponse, err error) {
|
||||
response = CreateGetVipInfoResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserScoreLog
|
||||
// 获取用户成长值流水信息
|
||||
func (c *Client) GetUserScoreLog(req *GetUserScoreLogRequest) (response *GetUserScoreLogResponse, err error) {
|
||||
response = CreateGetUserScoreLogResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserPay
|
||||
// 获取用户总充值
|
||||
func (c *Client) GetUserPay(req *GetUserPayRequest) (response *GetUserPayResponse, err error) {
|
||||
response = CreateGetUserPayResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetTotal
|
||||
// 获取用户充值汇总
|
||||
func (c *Client) GetTotal(req *GetTotalRequest) (response *GetTotalResponse, err error) {
|
||||
response = CreateGetTotalResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// GetUserVoucher
|
||||
// 获取用户代金券
|
||||
func (c *Client) GetUserVoucher(req *GetUserVoucherRequest) (response *GetUserVoucherResponse, err error) {
|
||||
response = CreateGetUserVoucherResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// ManualReplenish 手动补单
|
||||
func (c *Client) ManualReplenish(req *ManualReplenishRequest) (response *ManualReplenishResponse, err error) {
|
||||
response = CreateManualReplenishResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// InvoiceRequest 申请开发票
|
||||
func (c *Client) InvoiceRequest(req *InvoiceRequestRequest) (response *InvoiceRequestResponse, err error) {
|
||||
response = CreateInvoiceRequestResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// InvoicePass 允许申请发票
|
||||
func (c *Client) InvoicePass(req *InvoicePassRequest) (response *InvoicePassResponse, err error) {
|
||||
response = CreateInvoicePassResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
// InvoiceRefus 拒绝开发票
|
||||
func (c *Client) InvoiceRefus(req *InvoiceRefusRequest) (response *InvoiceRefusResponse, err error) {
|
||||
response = CreateInvoiceRefusResponse()
|
||||
func (c *Client) ComplaintNotifyUrl(req *ComplaintNotifyUrlRequest) (response *ComplaintNotifyUrlResponse, err error) {
|
||||
response = CreateComplaintNotifyUrlResponse()
|
||||
err = c.DoAction(req, response)
|
||||
return
|
||||
}
|
||||
|
||||
@ -1,63 +1,28 @@
|
||||
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())
|
||||
}
|
||||
c, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
func TestGetOrderState(t *testing.T) {
|
||||
getOrderStateRequest := CreateGetOrderStateRequest("202112060000193551730")
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
getOrderStateResponse, err := client.GetOrderState(getOrderStateRequest)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(getOrderStateResponse.GetHttpContentString())
|
||||
}
|
||||
req := CreateComplaintNotifyUrlRequest()
|
||||
|
||||
func TestManualReplenish(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
req.MchId = "3503"
|
||||
req.NotifyUrl = "https://pay.uu89.com/api/complaint/wxNotify/3503"
|
||||
req.Type = 1
|
||||
|
||||
resp, err := c.ComplaintNotifyUrl(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
log.Fatalln(err)
|
||||
}
|
||||
req := CreateManualReplenishRequest(ManualReplenishParam{
|
||||
GameId: 100,
|
||||
Money: 98,
|
||||
OrderId: "202112060000193551730",
|
||||
UserName: "testuser",
|
||||
PayChannel: 1,
|
||||
PayChannelType: 0,
|
||||
})
|
||||
resp, err := client.ManualReplenish(req)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
t.Log(resp.GetHttpContentString())
|
||||
fmt.Println(resp.GetHttpContentString())
|
||||
fmt.Println(resp.GetHttpHeaders())
|
||||
}
|
||||
|
||||
@ -9,8 +9,6 @@ type ComplaintCompleteRequest struct {
|
||||
*requests.RpcRequest
|
||||
MchId string `position:"Body" field:"mch_id" default:"" `
|
||||
ComplaintId string `position:"Body" field:"complaint_id" default:"" `
|
||||
ExtData string `position:"Body" field:"ext_data" default:"" `
|
||||
PayType int `position:"Body" field:"pay_type" default:"" `
|
||||
}
|
||||
|
||||
type ComplaintCompleteResponse struct {
|
||||
|
||||
35
services/pay/complaint_notify_url.go
Normal file
35
services/pay/complaint_notify_url.go
Normal file
@ -0,0 +1,35 @@
|
||||
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
|
||||
}
|
||||
@ -11,7 +11,6 @@ type ComplaintReplyRequest struct {
|
||||
ComplaintId string `position:"Body" field:"complaint_id" default:"" `
|
||||
Content string `position:"Body" field:"content" default:"" `
|
||||
Images string `position:"Body" field:"images" default:"" `
|
||||
PayType int `position:"Body" field:"pay_type" default:"" `
|
||||
}
|
||||
|
||||
type ComplaintReplyResponse struct {
|
||||
|
||||
@ -10,7 +10,6 @@ type ComplaintUploadRequest struct {
|
||||
MchId string `position:"Body" field:"mch_id" default:"" `
|
||||
ImageUrl string `position:"Body" field:"image_url" default:"" `
|
||||
ComplaintId string `position:"Body" field:"complaint_id" default:" " `
|
||||
PayType int `position:"Body" field:"pay_type" default:"" `
|
||||
}
|
||||
|
||||
type ComplaintUploadResponse struct {
|
||||
|
||||
@ -1,44 +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 GetOrderStateRequest struct {
|
||||
*requests.RpcRequest
|
||||
OrderId string `position:"Body" field:"orderid" default:"" `
|
||||
}
|
||||
|
||||
type GetOrderStateResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
Orderid string `json:"orderid"` // 订单号
|
||||
Succ string `json:"succ"` // 是否成功
|
||||
Money string `json:"money"` // 支付金额
|
||||
UserName string `json:"user_name"` // 用户名
|
||||
BNum string `json:"b_num"`
|
||||
GameId string `json:"game_id"` // 游戏id
|
||||
PayDate string `json:"pay_date"` // 付费日期
|
||||
SyncDate string `json:"sync_date"` // 回调时间
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetOrderStateRequest(orderId string) (req *GetOrderStateRequest) {
|
||||
req = &GetOrderStateRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
OrderId: orderId,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/user/getOrderState")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetOrderStateResponse() (response *GetOrderStateResponse) {
|
||||
response = &GetOrderStateResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,42 +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 GetTotalRequest struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name" default:"" `
|
||||
Appid int64 `position:"Body" field:"appid"`
|
||||
}
|
||||
|
||||
type GetTotalResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
UserName string `json:"user_name"`
|
||||
TotalPaid float64 `json:"total_paid"`
|
||||
TotalTimes int64 `json:"total_times"`
|
||||
MaxPaid float64 `json:"max_paid"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetTotalRequest(userName string, appid int64) (req *GetTotalRequest) {
|
||||
req = &GetTotalRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
UserName: userName,
|
||||
Appid: appid,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/user/getTotal")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetTotalResponse() (response *GetTotalResponse) {
|
||||
response = &GetTotalResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,39 +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 GetUserPayRequest struct {
|
||||
*requests.RpcRequest
|
||||
Uids string `position:"Body" field:"uids"`
|
||||
Type int64 `position:"Body" field:"type"`
|
||||
GameIds string `position:"Body" field:"game_ids" `
|
||||
}
|
||||
|
||||
type GetUserPayResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data map[int64]float64 `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetUserPayRequest(uids, gameIds string, t int64) (req *GetUserPayRequest) {
|
||||
req = &GetUserPayRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
Uids: uids,
|
||||
Type: t,
|
||||
GameIds: gameIds,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/user/getUserPay")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserPayResponse() (response *GetUserPayResponse) {
|
||||
response = &GetUserPayResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,58 +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 GetUserScoreLogRequest struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name" default:"" `
|
||||
MaxId int `position:"Body" field:"max_id" `
|
||||
Limit int `position:"Body" field:"limit"`
|
||||
Status int `position:"Body" field:"status"`
|
||||
StartTime string `position:"Body" field:"start_time"`
|
||||
}
|
||||
|
||||
type UserScoreLog struct {
|
||||
Id int `json:"id"`
|
||||
UserName string `json:"user_name"` // 用户名
|
||||
Status int `json:"status"`
|
||||
Type int `json:"type"`
|
||||
Orderid string `json:"orderid"`
|
||||
Amount float64 `json:"amount"`
|
||||
Score float64 `json:"score"`
|
||||
SyncDate string `json:"sync_date"`
|
||||
CompleteDate string `json:"complete_date"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
}
|
||||
|
||||
type GetUserScoreLogResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
List []UserScoreLog `json:"list"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetUserScoreLogRequest(userName, startTime string, maxId, status, Limit int) (req *GetUserScoreLogRequest) {
|
||||
req = &GetUserScoreLogRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
UserName: userName,
|
||||
MaxId: maxId,
|
||||
Limit: Limit,
|
||||
Status: status,
|
||||
StartTime: startTime,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/user/getUserScoreLog")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserScoreLogResponse() (response *GetUserScoreLogResponse) {
|
||||
response = &GetUserScoreLogResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,51 +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 GetUserVoucherRequest struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
PayMoney string `position:"Body" field:"pay_money"`
|
||||
GameId int64 `position:"Body" field:"game_id" `
|
||||
}
|
||||
|
||||
type GetUserVoucherResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
List []Voucher `json:"list"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
type Voucher struct {
|
||||
Code string `json:"code"`
|
||||
Threshold float64 `json:"threshold"`
|
||||
Discount float64 `json:"discount"`
|
||||
Type int `json:"type"`
|
||||
Status int `json:"status"`
|
||||
Number int `json:"number"`
|
||||
Deadline string `json:"deadline"`
|
||||
}
|
||||
|
||||
func CreateGetUserVoucherRequest(userName string, gameId int64, payMoney string) (req *GetUserVoucherRequest) {
|
||||
req = &GetUserVoucherRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
UserName: userName,
|
||||
GameId: gameId,
|
||||
PayMoney: payMoney,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/user/getUserVoucher")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetUserVoucherResponse() (response *GetUserVoucherResponse) {
|
||||
response = &GetUserVoucherResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,42 +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 GetVipInfoRequest struct {
|
||||
*requests.RpcRequest
|
||||
UserName string `position:"Body" field:"user_name" default:"" `
|
||||
}
|
||||
|
||||
type GetVipInfoResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Data struct {
|
||||
UserName string `json:"user_name"` // 用户名
|
||||
Score float64 `json:"score"`
|
||||
Level int `json:"level"`
|
||||
AttainDate string `json:"attain_date"`
|
||||
ExpiryDate string `json:"expiry_date"`
|
||||
IsWindows int `json:"is_windows"`
|
||||
} `json:"data"`
|
||||
}
|
||||
|
||||
func CreateGetVipInfoRequest(userName string) (req *GetVipInfoRequest) {
|
||||
req = &GetVipInfoRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
UserName: userName,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/user/getVipInfo")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateGetVipInfoResponse() (response *GetVipInfoResponse) {
|
||||
response = &GetVipInfoResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -1,158 +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"
|
||||
)
|
||||
|
||||
// InvoiceRequestOrder 发票申请订单信息
|
||||
type InvoiceRequestOrder struct {
|
||||
Id string `json:"id"`
|
||||
Company string `json:"company"`
|
||||
TaxNo string `json:"tax_no"`
|
||||
Drawer string `json:"drawer"`
|
||||
}
|
||||
|
||||
// InvoiceRequestParam 申请开发票参数
|
||||
type InvoiceRequestParam struct {
|
||||
UserName string `json:"user_name"`
|
||||
BuyerName string `json:"buyer_name"`
|
||||
Email string `json:"email"`
|
||||
Phone string `json:"phone"`
|
||||
RequestName string `json:"request_name"`
|
||||
From string `json:"from"`
|
||||
BatchFilter string `json:"batch_filter"` // 批量开票圈选条件快照(JSON),单个开票留空
|
||||
MergeBySubject int64 `json:"merge_by_subject"` // 是否同主体合并开票 0否 1是;申请单创建时锁定,审核时按此分组
|
||||
Orders []InvoiceRequestOrder `json:"orders"`
|
||||
}
|
||||
|
||||
// InvoiceRequestRequest 申请开发票请求
|
||||
type InvoiceRequestRequest struct {
|
||||
*requests.JsonRequest
|
||||
UserName string `position:"Json" field:"user_name"`
|
||||
BuyerName string `position:"Json" field:"buyer_name"`
|
||||
Email string `position:"Json" field:"email"`
|
||||
Phone string `position:"Json" field:"phone"`
|
||||
RequestName string `position:"Json" field:"request_name"`
|
||||
From string `position:"Json" field:"from"`
|
||||
BatchFilter string `position:"Json" field:"batch_filter"`
|
||||
MergeBySubject int64 `position:"Json" field:"merge_by_subject"`
|
||||
Orders []InvoiceRequestOrder `position:"Json" field:"orders"`
|
||||
}
|
||||
|
||||
// InvoiceRequestResponse 申请开发票响应
|
||||
type InvoiceRequestResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
// CreateInvoiceRequestRequest 创建申请开发票请求
|
||||
func CreateInvoiceRequestRequest(param InvoiceRequestParam) *InvoiceRequestRequest {
|
||||
req := &InvoiceRequestRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
UserName: param.UserName,
|
||||
BuyerName: param.BuyerName,
|
||||
Email: param.Email,
|
||||
Phone: param.Phone,
|
||||
RequestName: param.RequestName,
|
||||
From: param.From,
|
||||
BatchFilter: param.BatchFilter,
|
||||
MergeBySubject: param.MergeBySubject,
|
||||
Orders: param.Orders,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/invoice/request")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateInvoiceRequestResponse 创建申请开发票响应
|
||||
func CreateInvoiceRequestResponse() *InvoiceRequestResponse {
|
||||
return &InvoiceRequestResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// InvoicePassParam 允许申请发票参数
|
||||
type InvoicePassParam struct {
|
||||
InvoiceRequestId int64 `json:"invoice_request_id"`
|
||||
ReviewUserName string `json:"review_user_name"`
|
||||
ReviewRemark string `json:"review_remark"`
|
||||
}
|
||||
|
||||
// InvoicePassRequest 允许申请发票请求
|
||||
type InvoicePassRequest struct {
|
||||
*requests.JsonRequest
|
||||
InvoiceRequestId int64 `position:"Json" field:"invoice_request_id"`
|
||||
ReviewUserName string `position:"Json" field:"review_user_name"`
|
||||
ReviewRemark string `position:"Json" field:"review_remark"`
|
||||
}
|
||||
|
||||
// InvoicePassResponse 允许申请发票响应
|
||||
type InvoicePassResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
// CreateInvoicePassRequest 创建允许申请发票请求
|
||||
func CreateInvoicePassRequest(param InvoicePassParam) *InvoicePassRequest {
|
||||
req := &InvoicePassRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
InvoiceRequestId: param.InvoiceRequestId,
|
||||
ReviewUserName: param.ReviewUserName,
|
||||
ReviewRemark: param.ReviewRemark,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/invoice/pass")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateInvoicePassResponse 创建允许申请发票响应
|
||||
func CreateInvoicePassResponse() *InvoicePassResponse {
|
||||
return &InvoicePassResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
|
||||
// InvoiceRefusParam 拒绝开发票参数
|
||||
type InvoiceRefusParam struct {
|
||||
InvoiceRequestId int64 `json:"invoice_request_id"`
|
||||
ReviewUserName string `json:"review_user_name"`
|
||||
RefusRemark string `json:"refus_remark"`
|
||||
}
|
||||
|
||||
// InvoiceRefusRequest 拒绝开发票请求
|
||||
type InvoiceRefusRequest struct {
|
||||
*requests.JsonRequest
|
||||
InvoiceRequestId int64 `position:"Json" field:"invoice_request_id"`
|
||||
ReviewUserName string `position:"Json" field:"review_user_name"`
|
||||
RefusRemark string `position:"Json" field:"refus_remark"`
|
||||
}
|
||||
|
||||
// InvoiceRefusResponse 拒绝开发票响应
|
||||
type InvoiceRefusResponse struct {
|
||||
*responses.BaseResponse
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
// CreateInvoiceRefusRequest 创建拒绝开发票请求
|
||||
func CreateInvoiceRefusRequest(param InvoiceRefusParam) *InvoiceRefusRequest {
|
||||
req := &InvoiceRefusRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
InvoiceRequestId: param.InvoiceRequestId,
|
||||
ReviewUserName: param.ReviewUserName,
|
||||
RefusRemark: param.RefusRemark,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/invoice/refus")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
// CreateInvoiceRefusResponse 创建拒绝开发票响应
|
||||
func CreateInvoiceRefusResponse() *InvoiceRefusResponse {
|
||||
return &InvoiceRefusResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -1,52 +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 ManualReplenishParam struct {
|
||||
GameId int64
|
||||
Money int
|
||||
OrderId string
|
||||
UserName string
|
||||
PayChannel int64
|
||||
PayChannelType int64
|
||||
}
|
||||
|
||||
type ManualReplenishRequest struct {
|
||||
*requests.RpcRequest
|
||||
GameId int64 `position:"Body" field:"game_id"`
|
||||
Money int `position:"Body" field:"money"`
|
||||
OrderId string `position:"Body" field:"order_id"`
|
||||
UserName string `position:"Body" field:"user_name"`
|
||||
PayChannel int64 `position:"Body" field:"pay_channel"`
|
||||
PayChannelType int64 `position:"Body" field:"pay_channel_type"`
|
||||
}
|
||||
|
||||
type ManualReplenishResponse struct {
|
||||
*responses.BaseResponse
|
||||
State int `json:"state"`
|
||||
Msg string `json:"msg"`
|
||||
}
|
||||
|
||||
func CreateManualReplenishRequest(param ManualReplenishParam) *ManualReplenishRequest {
|
||||
req := &ManualReplenishRequest{
|
||||
RpcRequest: &requests.RpcRequest{},
|
||||
GameId: param.GameId,
|
||||
Money: param.Money,
|
||||
OrderId: param.OrderId,
|
||||
UserName: param.UserName,
|
||||
PayChannel: param.PayChannel,
|
||||
PayChannelType: param.PayChannelType,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/sdk/manualReplenish")
|
||||
req.Method = requests.POST
|
||||
return req
|
||||
}
|
||||
|
||||
func CreateManualReplenishResponse() *ManualReplenishResponse {
|
||||
return &ManualReplenishResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
}
|
||||
@ -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 merchantConfigDebugRequest struct {
|
||||
*requests.RpcRequest
|
||||
MchId string `position:"Body" field:"mch_id" default:"" `
|
||||
PayType int `position:"Body" field:"pay_type" 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
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
package mkt2
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "2026-02-03"
|
||||
)
|
||||
|
||||
var HOST = requests.Host{
|
||||
Default: "res-proc",
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
sdk.Client
|
||||
}
|
||||
|
||||
func NewClient() (client *Client, err error) {
|
||||
client = new(Client)
|
||||
err = client.Init()
|
||||
return
|
||||
}
|
||||
|
||||
func (c *Client) AddTask(request *AddTaskRequest) (response *AddTaskResponse, err error) {
|
||||
response = CreateAddTaskResponse()
|
||||
err = c.DoAction(request, response)
|
||||
return
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
package mkt2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils/random"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// TestAddResourceToVdbTask 添加素材上传向量库逻辑
|
||||
func TestAddResourceToVdbTask(t *testing.T) {
|
||||
client, err := NewClient()
|
||||
if err != nil {
|
||||
t.Error("NewClient error:", err)
|
||||
return
|
||||
}
|
||||
request := CreateResourceToVdbTaskRequest(ResourceToVdbTaskParam{
|
||||
MaxRetry: 0,
|
||||
TraceId: random.StrRandom(10),
|
||||
Payload: ResourceToVdbPayload{
|
||||
ResourceURL: "https://resouce-mkt.gaore.com/material/video/2021-09/01/2124474664246343/6eb5621f8ff2de8f64d4aefa3db4f551.mp4",
|
||||
MD5: "",
|
||||
},
|
||||
})
|
||||
response, err := client.AddTask(request)
|
||||
if err != nil {
|
||||
t.Error("MaterialTaskNotify error:", err)
|
||||
return
|
||||
}
|
||||
t.Log("response:", response)
|
||||
fmt.Println("")
|
||||
}
|
||||
@ -1,83 +0,0 @@
|
||||
package mkt2
|
||||
|
||||
import (
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||
)
|
||||
|
||||
type AddTaskRequest struct {
|
||||
*requests.JsonRequest
|
||||
TaskType string `position:"Json" field:"task_type"`
|
||||
MaxRetry int64 `position:"Json" field:"max_retry"`
|
||||
TraceId string `position:"Json" field:"trace_id"`
|
||||
Payload any `position:"Json" field:"payload"`
|
||||
Extra any `position:"Json" field:"extra"`
|
||||
}
|
||||
|
||||
type AddTaskResponseData struct {
|
||||
TaskId int64 `json:"task_id"`
|
||||
}
|
||||
type AddTaskResponse struct {
|
||||
*responses.BaseResponse
|
||||
Data AddTaskResponseData `json:"data"`
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Err string `json:"err"`
|
||||
TraceId string `json:"trace_id"`
|
||||
}
|
||||
|
||||
type AddTaskParam struct {
|
||||
TaskType string `position:"Json" field:"task_type"`
|
||||
MaxRetry int64 `position:"Json" field:"max_retry"`
|
||||
TraceId string `position:"Json" field:"trace_id"`
|
||||
Payload any `position:"Json" field:"payload"`
|
||||
Extra any `position:"Json" field:"extra"`
|
||||
}
|
||||
|
||||
func CreateAddTaskRequest(param AddTaskParam) (req *AddTaskRequest) {
|
||||
req = &AddTaskRequest{
|
||||
JsonRequest: &requests.JsonRequest{},
|
||||
TaskType: param.TaskType,
|
||||
MaxRetry: param.MaxRetry,
|
||||
TraceId: param.TraceId,
|
||||
Payload: param.Payload,
|
||||
Extra: param.Extra,
|
||||
}
|
||||
req.InitWithApiInfo(HOST, VERSION, "/api/task/add")
|
||||
req.Method = requests.POST
|
||||
return
|
||||
}
|
||||
|
||||
func CreateAddTaskResponse() (response *AddTaskResponse) {
|
||||
response = &AddTaskResponse{
|
||||
BaseResponse: &responses.BaseResponse{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// ResourceToVdbPayload
|
||||
//素材上传向量库任务playLod
|
||||
|
||||
const TaskTypeResourceToVdb = "resource_to_vdb"
|
||||
|
||||
type ResourceToVdbPayload struct {
|
||||
ResourceURL string `json:"resource_url"` // 资源 URL
|
||||
MD5 string `json:"md5"` // 资源 MD5
|
||||
}
|
||||
|
||||
type ResourceToVdbTaskParam struct {
|
||||
MaxRetry int64
|
||||
TraceId string
|
||||
Payload ResourceToVdbPayload
|
||||
Extra map[string]any
|
||||
}
|
||||
|
||||
func CreateResourceToVdbTaskRequest(param ResourceToVdbTaskParam) (req *AddTaskRequest) {
|
||||
return CreateAddTaskRequest(AddTaskParam{
|
||||
TaskType: TaskTypeResourceToVdb,
|
||||
MaxRetry: param.MaxRetry,
|
||||
TraceId: param.TraceId,
|
||||
Payload: param.Payload,
|
||||
Extra: param.Extra,
|
||||
})
|
||||
}
|
||||
@ -1,53 +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
|
||||
}
|
||||
|
||||
// NewPayRedisData 设置支付redis相关数据
|
||||
func (c *Client) NewPayRedisData(req *NewPayRedisDataReq) (resp *NewPayRedisDataResp, err error) {
|
||||
resp = CreateNewPayRedisDataResp()
|
||||
err = c.DoAction(req, resp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// SyncWxComplaint 同步微信投诉工单
|
||||
func (c *Client) SyncWxComplaint(req *SyncWxComplaintRequest) (resp *SyncWxComplaintResp, err error) {
|
||||
resp = CreateSyncWxComplaintResp()
|
||||
err = c.DoAction(req, resp)
|
||||
return
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user