8
0

Compare commits

..

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

15 changed files with 5 additions and 487 deletions

View File

@ -54,10 +54,3 @@ func (c *Client) Auth(req *AuthReq) (resp *AuthResp, err error) {
err = c.DoAction(req, resp) err = c.DoAction(req, resp)
return 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
}

View File

@ -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{},
}
}

View File

@ -14,7 +14,7 @@ import (
// 说明:切片为空表示不限定该条件;标量字符串为空时不参与筛选 // 说明:切片为空表示不限定该条件;标量字符串为空时不参与筛选
type GetUserLoginLogParam struct { type GetUserLoginLogParam struct {
Uid string `json:"uid"` Uid string `json:"uid"`
EventTime []string `json:"event_time"` // 区间 [开始, 结束] EventTime string `json:"event_time"` // 形如 "2026-06"
GameSign string `json:"game_sign"` GameSign string `json:"game_sign"`
ServerGroupId []string `json:"server_group_id"` ServerGroupId []string `json:"server_group_id"`
GameId string `json:"game_id"` GameId string `json:"game_id"`
@ -31,7 +31,7 @@ type GetUserLoginLogParam struct {
type GetUserLoginLogRequest struct { type GetUserLoginLogRequest struct {
*requests.JsonRequest *requests.JsonRequest
Uid string `position:"Json" field:"uid"` Uid string `position:"Json" field:"uid"`
EventTime []string `position:"Json" field:"event_time"` EventTime string `position:"Json" field:"event_time"`
GameSign string `position:"Json" field:"game_sign"` GameSign string `position:"Json" field:"game_sign"`
ServerGroupId []string `position:"Json" field:"server_group_id"` ServerGroupId []string `position:"Json" field:"server_group_id"`
GameId string `position:"Json" field:"game_id"` GameId string `position:"Json" field:"game_id"`
@ -50,7 +50,7 @@ type GetUserLoginLogRequest struct {
// - 标量字符串用 omitempty空串时不出现在 JSON 中,避免被 DMS 当成真实筛选条件。 // - 标量字符串用 omitempty空串时不出现在 JSON 中,避免被 DMS 当成真实筛选条件。
type getUserLoginLogBody struct { type getUserLoginLogBody struct {
Uid string `json:"uid,omitempty"` Uid string `json:"uid,omitempty"`
EventTime []string `json:"event_time"` EventTime string `json:"event_time,omitempty"`
GameSign string `json:"game_sign,omitempty"` GameSign string `json:"game_sign,omitempty"`
ServerGroupId []string `json:"server_group_id"` ServerGroupId []string `json:"server_group_id"`
GameId string `json:"game_id,omitempty"` GameId string `json:"game_id,omitempty"`
@ -67,7 +67,7 @@ type getUserLoginLogBody struct {
func (request *GetUserLoginLogRequest) GetBodyReader() io.Reader { func (request *GetUserLoginLogRequest) GetBodyReader() io.Reader {
body := getUserLoginLogBody{ body := getUserLoginLogBody{
Uid: request.Uid, Uid: request.Uid,
EventTime: emptyStrSlice(request.EventTime), EventTime: request.EventTime,
GameSign: request.GameSign, GameSign: request.GameSign,
ServerGroupId: emptyStrSlice(request.ServerGroupId), ServerGroupId: emptyStrSlice(request.ServerGroupId),
GameId: request.GameId, GameId: request.GameId,

View File

@ -205,10 +205,3 @@ func (c *Client) GetRole(req *GetRoleReq) (response *GetRoleResp, err error) {
err = c.DoAction(req, response) err = c.DoAction(req, response)
return 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
}

View File

@ -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
}

View File

@ -1,10 +1,9 @@
package passport package passport
import ( import (
"strings"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "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/requests"
"strings"
) )
const ( const (
@ -71,34 +70,6 @@ func (c *Client) DelUserAuth(param DelUserAuthRequestParam) (response string, er
return delUserAuthResponse.GetHttpContentString(), nil 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 // GetUserGameSign
// 获取用户登录过的游戏大类 // 获取用户登录过的游戏大类
func (c *Client) GetUserGameSign(req *GetUserGameSignRequest) (response *GetUserGameSignResponse, err error) { func (c *Client) GetUserGameSign(req *GetUserGameSignRequest) (response *GetUserGameSignResponse, err error) {

View File

@ -235,28 +235,6 @@ func TestDelUserAuth(t *testing.T) {
t.Logf("del user auth result: %s", res) 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) { func TestGetUserLogin(t *testing.T) {
client, err := NewClient() client, err := NewClient()
@ -274,24 +252,3 @@ func TestGetUserLogin(t *testing.T) {
fmt.Printf("raw: %s\n", resp.GetHttpContentString()) fmt.Printf("raw: %s\n", resp.GetHttpContentString())
fmt.Printf("data: %+v\n, %d", resp.Data, len(resp.Data)) 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)
}

View File

@ -137,92 +137,3 @@ func CreateDelUserAuthResponse() (response *DelUserAuthResponse) {
} }
return 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
}

View File

@ -13,7 +13,6 @@ const (
ReplaceKeyUrl ReplaceKey = "${url}" // 链接 ReplaceKeyUrl ReplaceKey = "${url}" // 链接
ReplaceKeyUserName ReplaceKey = "${userName}" // 用户名 ReplaceKeyUserName ReplaceKey = "${userName}" // 用户名
ReplaceKeyDateTime ReplaceKey = "${dateTime}" // 年月日时分秒 ReplaceKeyDateTime ReplaceKey = "${dateTime}" // 年月日时分秒
ReplaceKeyPassWord ReplaceKey = "${passWord}" // 密码
) )
type Item struct { type Item struct {
@ -55,7 +54,6 @@ const (
TemplateTypeKFOrderAdditional SmsType = "kf_order_additional" // 客服工单完成 TemplateTypeKFOrderAdditional SmsType = "kf_order_additional" // 客服工单完成
TemplateTypeCancelTip SmsType = "cancel_tip" // 提交账号注销申请 TemplateTypeCancelTip SmsType = "cancel_tip" // 提交账号注销申请
TemplateTypeReverseCancel SmsType = "reverse_cancel" // 终止账号注销申请 TemplateTypeReverseCancel SmsType = "reverse_cancel" // 终止账号注销申请
TemplateTypeResetPassword SmsType = "reset_password" // 重置密码
) )
type SendSmsParam struct { type SendSmsParam struct {

View File

@ -53,13 +53,3 @@ func (c *Client) CreateRemoveBanRuleCacheReq(req *RemoveBanRuleCacheReq) (resp *
} }
return return
} }
// CreateCheckBatchReq 批量检查用户是否被封禁
func (c *Client) CreateCheckBatchReq(req *CheckBatchReq) (resp *CheckBatchResp, err error) {
resp = CreateCheckBatchResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}

View File

@ -158,47 +158,3 @@ func CreateRemoveBanRuleCacheResp() *RemoveBanRuleCacheResp {
BaseResponse: &responses.BaseResponse{}, BaseResponse: &responses.BaseResponse{},
} }
} }
// CheckBatchReq
// 批量检查用户是否被封禁(只读,按身份维度匹配现行封禁规则)
type CheckBatchReq struct {
*requests.JsonRequest
}
type CheckBatchReqParam struct {
UserNames []string `json:"user_names"` // 要检查的用户名列表
}
type CheckBatchItem struct {
UserName string `json:"user_name"` // 用户名
Ban bool `json:"ban"` // 是否被封禁
BanRuleId int64 `json:"ban_rule_id"` // 命中的封禁规则id(未命中为0)
BanEndTime string `json:"ban_end_time"` // 封禁结束时间(未命中为空)
}
type CheckBatchResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
List []CheckBatchItem `json:"list"`
} `json:"data"`
}
func CreateCheckBatchReq(param CheckBatchReqParam) *CheckBatchReq {
req := &CheckBatchReq{
&requests.JsonRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/user_ban/check_batch")
req.Method = requests.POST
marshal, _ := json.Marshal(param)
_ = json.Unmarshal(marshal, &req.JsonParams)
return req
}
func CreateCheckBatchResp() *CheckBatchResp {
return &CheckBatchResp{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -1,42 +0,0 @@
package web
import (
"strings"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "2020-01-01"
)
// HOST 官网 web 服务域名(带 "."SDK 不会再追加 .gaore.com
var HOST = requests.Host{
Default: "web.gaore.com",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
// ForceOut 清除玩家官网 web 登录 session返回远端原始响应
// 对齐老综合后台 GaoreSDK web->force_out
func (c *Client) ForceOut(userName string, ts int64) (response string, err error) {
req := CreateForceOutReq(userName, ts)
resp := CreateForceOutResp()
err = c.DoAction(req, resp)
if err != nil && strings.Contains(err.Error(), "json Unmarshal:") {
// 远端返回非 JSON如纯文本直接取原始响应
return resp.GetHttpContentString(), nil
} else if err != nil {
return "", err
}
return resp.GetHttpContentString(), nil
}

View File

@ -1,44 +0,0 @@
package web
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"
)
// forceOutSignKey 老综合后台业务层计算 sign 用的固定盐
const forceOutSignKey = "user_session_20220505"
type ForceOutReq struct {
*requests.RpcRequest
}
type ForceOutResp struct {
*responses.BaseResponse
}
// CreateForceOutReq 创建官网强制下线请求
// POST web.gaore.com/web/users/force_outsign=md5(user_name+time+"user_session_20220505")
func CreateForceOutReq(userName string, ts int64) *ForceOutReq {
sign := utils.Md5(fmt.Sprintf("%s%d%s", userName, ts, forceOutSignKey))
req := &ForceOutReq{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/web/users/force_out")
req.FormParams = map[string]string{
"user_name": userName,
"time": fmt.Sprintf("%d", ts),
"sign": sign,
}
req.Method = requests.POST
return req
}
func CreateForceOutResp() *ForceOutResp {
return &ForceOutResp{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -1,8 +1,6 @@
package www package www
import ( import (
"strings"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" "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/requests"
) )
@ -27,13 +25,6 @@ type Client struct {
sdk.Client sdk.Client
} }
// NewClient 无凭证客户端(用于自带签名的表单接口,如 refreshUserSessionId
func NewClient() (client *Client, err error) {
client = &Client{}
err = client.Init()
return
}
func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) { func NewClientWithAccessKey(accesskey, secrect, source string) (client *Client, err error) {
client = &Client{} client = &Client{}
err = client.InitWithAccessKey(accesskey, secrect, source) err = client.InitWithAccessKey(accesskey, secrect, source)
@ -51,17 +42,3 @@ func (c *Client) GetUserInfo(req *GetPwdRequest) (response *GetPwdResponse, err
err = c.DoAction(req, response) err = c.DoAction(req, response)
return return
} }
// RefreshUserSessionID 刷新用户 session清 www 登录态),返回远端原始响应
func (c *Client) RefreshUserSessionID(uname string) (response string, err error) {
req := CreateRefreshUserSessionIDReq(uname)
resp := CreateRefreshUserSessionIDResp()
err = c.DoAction(req, resp)
if err != nil && strings.Contains(err.Error(), "json Unmarshal:") {
// 远端返回非 JSON如纯文本直接取原始响应
return resp.GetHttpContentString(), nil
} else if err != nil {
return "", err
}
return resp.GetHttpContentString(), nil
}

View File

@ -1,55 +0,0 @@
package www
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"
)
// 对齐老综合后台 GaoreSDK www->refreshUserSessionId 的固定 appid=20 验签
const (
refreshSessionAppID = "20"
refreshSessionAppKey = "yWpx3hWQHFhSnTCj#20#6KuRKuaAjLJ5sYRy"
)
// refreshSessionHost 老 PHP SDK 打的是 apisdk.gaore.com与本包默认 HOST(apisdk.9ooo.cn) 不同,
// 此处显式固定到 apisdk.gaore.com与老综合后台 1:1 对齐。
var refreshSessionHost = requests.Host{Default: "apisdk.gaore.com"}
type RefreshUserSessionIDReq struct {
*requests.RpcRequest
}
type RefreshUserSessionIDResp struct {
*responses.BaseResponse
}
// CreateRefreshUserSessionIDReq 刷新用户 www session使官网/9ooo 登录态失效)
// POST /user/sdk_passport.phpsign=md5(appkey+time)
func CreateRefreshUserSessionIDReq(uname string) *RefreshUserSessionIDReq {
ts := time.Now().Unix()
sign := utils.Md5(refreshSessionAppKey + fmt.Sprintf("%d", ts))
req := &RefreshUserSessionIDReq{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(refreshSessionHost, VERSION, "/user/sdk_passport.php")
req.FormParams = map[string]string{
"appid": refreshSessionAppID,
"time": fmt.Sprintf("%d", ts),
"do": "refreshUserSessionId",
"uname": uname,
"sign": sign,
}
req.Method = requests.POST
return req
}
func CreateRefreshUserSessionIDResp() *RefreshUserSessionIDResp {
return &RefreshUserSessionIDResp{
BaseResponse: &responses.BaseResponse{},
}
}