8
0
gaore-common-sdk-go/services/www/refresh_session.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

56 lines
1.6 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 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{},
}
}