feat(pay): 新增切支付名单中转与清缓存 SDK 接口
game 服务新增 GetPaySwitchUser(按 user_name+game_id 读 db_center 切支付名单,返回 status+risk_level); asdk 服务新增 ClearPaySwitchCache(内网无签名,按 user_name+game_id 即时清切支付判定缓存)。 供 asdk/center 微信小游戏切支付功能调用。
This commit is contained in:
parent
7f363e9428
commit
7097afb18c
@ -54,3 +54,10 @@ 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
|
||||||
|
}
|
||||||
|
|||||||
42
services/asdk/pay_switch.go
Normal file
42
services/asdk/pay_switch.go
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
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{},
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -205,3 +205,10 @@ 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
|
||||||
|
}
|
||||||
|
|||||||
45
services/game/pay_switch.go
Normal file
45
services/game/pay_switch.go
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user