feat(asdk): 新增查询玩家最近登录游戏接口封装
供 AI 客服定位玩家在玩的游戏:传入一批平台账号,返回其中最近登录的 那一款子游戏及其所属根游戏(game_sign),玩法 QA 据此归类检索。 data 为空对象表示这些账号都没有登录记录,是正常结果而非错误,code 仍为 0。
This commit is contained in:
parent
8b692dd9af
commit
fe6c49973b
@ -61,3 +61,10 @@ func (c *Client) ClearPaySwitchCache(req *ClearPaySwitchCacheReq) (resp *ClearPa
|
|||||||
err = c.DoAction(req, resp)
|
err = c.DoAction(req, resp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLastLoginGame 查询玩家最近登录游戏所属的根游戏(内网接口,供 AI 客服定位玩家在玩的游戏)
|
||||||
|
func (c *Client) GetLastLoginGame(req *LastLoginGameReq) (resp *LastLoginGameResp, err error) {
|
||||||
|
resp = CreateLastLoginGameResp()
|
||||||
|
err = c.DoAction(req, resp)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
61
services/asdk/last_login_game.go
Normal file
61
services/asdk/last_login_game.go
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package asdk
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
||||||
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
||||||
|
)
|
||||||
|
|
||||||
|
// LastLoginGameReq
|
||||||
|
// 查询玩家最近登录游戏(内网接口,走 /api 分组的内部签名)
|
||||||
|
type LastLoginGameReq struct {
|
||||||
|
*requests.RpcRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
// LastLoginGameResp
|
||||||
|
// Data 为空对象(game_id=0、game_sign="")表示这些账号都没有登录记录,
|
||||||
|
// 「查不到」是正常结果而非错误,code 仍为 0。
|
||||||
|
type LastLoginGameResp struct {
|
||||||
|
*responses.BaseResponse
|
||||||
|
Code int `json:"code"`
|
||||||
|
Msg string `json:"msg"`
|
||||||
|
Data struct {
|
||||||
|
UserName string `json:"user_name"`
|
||||||
|
GameId int64 `json:"game_id"` // 子游戏(包)ID
|
||||||
|
GameSign string `json:"game_sign"` // 根游戏标识
|
||||||
|
GameName string `json:"game_name"` // 子游戏名,非根游戏名
|
||||||
|
LastLoginTime int64 `json:"last_login_time"`
|
||||||
|
} `json:"data"`
|
||||||
|
TraceId string `json:"trace_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type LastLoginGameParam struct {
|
||||||
|
Ts int64
|
||||||
|
Sign string
|
||||||
|
UserNames []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateLastLoginGameReq 构造查询请求:多个平台账号一并下发,
|
||||||
|
// 服务端在这些账号里挑最近登录的那一条返回。
|
||||||
|
func CreateLastLoginGameReq(param LastLoginGameParam) *LastLoginGameReq {
|
||||||
|
req := &LastLoginGameReq{
|
||||||
|
RpcRequest: &requests.RpcRequest{},
|
||||||
|
}
|
||||||
|
|
||||||
|
req.InitWithApiInfo(HOST, VERSION, "/api/user/last_login_game")
|
||||||
|
req.Method = requests.POST
|
||||||
|
req.FormParams = map[string]string{
|
||||||
|
"ts": strconv.FormatInt(param.Ts, 10),
|
||||||
|
"sign": param.Sign,
|
||||||
|
"user_names": strings.Join(param.UserNames, ","),
|
||||||
|
}
|
||||||
|
return req
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateLastLoginGameResp() *LastLoginGameResp {
|
||||||
|
return &LastLoginGameResp{
|
||||||
|
BaseResponse: &responses.BaseResponse{},
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user