8
0
gaore-common-sdk-go/services/web/client.go
huangqz 252e5953f3 feat(www,web): 新增 RefreshUserSessionID 与 web.ForceOut
重置密码副作用配套:
- 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 对齐
2026-06-17 10:05:05 +08:00

43 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}