重置密码副作用配套: - services/www 新增 RefreshUserSessionID(清 www 登录态,apisdk.gaore.com /user/sdk_passport.php)及无凭证 NewClient - 新建 services/web 包,ForceOut 清官网 web 登录态(web.gaore.com /web/users/force_out) 端点/参数/签名与老综合后台 GaoreSDK 1:1 对齐
43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
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
|
||
}
|