6
0

Compare commits

...

3 Commits

5 changed files with 159 additions and 3 deletions

View File

@ -10,6 +10,7 @@ type ComplaintCompleteRequest struct {
MchId string `position:"Body" field:"mch_id" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" default:"" `
ExtData string `position:"Body" field:"ext_data" default:"" `
PayType int `position:"Body" field:"pay_type" default:"" `
}
type ComplaintCompleteResponse struct {

View File

@ -10,6 +10,7 @@ type ComplaintUploadRequest struct {
MchId string `position:"Body" field:"mch_id" default:"" `
ImageUrl string `position:"Body" field:"image_url" default:"" `
ComplaintId string `position:"Body" field:"complaint_id" default:" " `
PayType int `position:"Body" field:"pay_type" default:"" `
}
type ComplaintUploadResponse struct {

View File

@ -32,3 +32,24 @@ func (c *Client) CreateBanReq(req *BanReq) (resp *BanResp, err error) {
}
return
}
// CreateAddBanRuleCacheReq 添加封禁规则缓存
func (c *Client) CreateAddBanRuleCacheReq(req *AddBanRuleCacheReq) (resp *AddBanRuleCacheResp, err error) {
resp = CreateAddBanRuleCacheResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}
// CreateRemoveBanRuleCacheReq 删除封禁规则缓存
func (c *Client) CreateRemoveBanRuleCacheReq(req *RemoveBanRuleCacheReq) (resp *RemoveBanRuleCacheResp, err error) {
resp = CreateRemoveBanRuleCacheResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}

View File

@ -6,7 +6,7 @@ import (
"time"
)
// 获取用户累计付费
// 踢人
func TestBan(t *testing.T) {
client, err := NewClient()
if err != nil {
@ -14,7 +14,7 @@ func TestBan(t *testing.T) {
}
req := CreateBanReq(BanReqParam{
ActionTime: time.Now().Unix(),
EventType: 0,
TriggerType: triggerTypeLogin,
Ip: "127.0.0.1",
GameId: 8654,
UserName: "aq36604627",
@ -53,3 +53,52 @@ func TestBan(t *testing.T) {
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
}
// 添加封禁规则
func TestAddBanRuleCache(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateAddBanRuleCacheReq(RuleInfo{
Id: 21,
Phone: "13247173568",
UserName: "gr24616919",
IdCard: "",
DeviceId: "device_id1",
LongId: "long_id1",
IsVirtual: 0,
EndTime: "2029-01-01",
})
resp, err := client.CreateAddBanRuleCacheReq(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
}
// 删除封禁规则
func TestRemoveBanRuleCache(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
infos := []RuleInfo{{
Id: 21,
Phone: "13247173568",
UserName: "gr24616919",
IdCard: "",
DeviceId: "device_id1",
LongId: "long_id1",
IsVirtual: 0,
EndTime: "2029-01-01",
}}
req := CreateRemoveBanRuleCacheReq(RemoveBanRuleCacheReqParam{Rules: infos})
resp, err := client.CreateRemoveBanRuleCacheReq(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
}

View File

@ -6,6 +6,13 @@ import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
const (
triggerTypeHeartbeat = "heartbeat" // 心跳上报触发
triggerTypeLogin = "login" // 用户登录、注册
)
// BanReq
// 上报用户设备信息,判断是否要踢用户下线
type BanReq struct {
*requests.JsonRequest
}
@ -21,7 +28,7 @@ type BanResp struct {
}
type BanReqParam struct {
ActionTime int64 `json:"action_time" form:"action_time"` // 上报时间
EventType int64 `json:"event_type" form:"event_type"` // 上报类型
TriggerType string `json:"trigger_type" form:"trigger_type"` // 触发类型
Ip string `json:"ip" form:"ip"` // ip
GameId int64 `json:"game_id" form:"game_id"` // 游戏id
UserName string `json:"user_name" form:"user_name"` // 用户名
@ -73,3 +80,80 @@ func CreateBanResp() *BanResp {
BaseResponse: &responses.BaseResponse{},
}
}
// AddBanRuleCacheReq
// 添加封禁规则缓存
type AddBanRuleCacheReq struct {
*requests.JsonRequest
}
type AddBanRuleCacheResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct{} `json:"data"`
}
type RuleInfo struct {
Id int64 `json:"id"`
Phone string `json:"phone"`
UserName string `json:"user_name"`
IdCard string `json:"id_card"`
DeviceId string `json:"device_id"`
LongId string `json:"long_id"`
IsVirtual int64 `json:"is_virtual"`
EndTime string `json:"end_time"`
}
func CreateAddBanRuleCacheReq(data RuleInfo) *AddBanRuleCacheReq {
req := &AddBanRuleCacheReq{
&requests.JsonRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/user_ban/add_cache")
req.Method = requests.POST
marshal, _ := json.Marshal(data)
_ = json.Unmarshal(marshal, &req.JsonParams)
return req
}
func CreateAddBanRuleCacheResp() *AddBanRuleCacheResp {
return &AddBanRuleCacheResp{
BaseResponse: &responses.BaseResponse{},
}
}
// RemoveBanRuleCacheReq
// 删除封禁规则缓存
type RemoveBanRuleCacheReq struct {
*requests.JsonRequest
}
type RemoveBanRuleCacheReqParam struct {
Rules []RuleInfo `json:"rules"`
}
type RemoveBanRuleCacheResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct{} `json:"data"`
}
func CreateRemoveBanRuleCacheReq(param RemoveBanRuleCacheReqParam) *RemoveBanRuleCacheReq {
req := &RemoveBanRuleCacheReq{
&requests.JsonRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/user_ban/remove_cache")
req.Method = requests.POST
marshal, _ := json.Marshal(param)
_ = json.Unmarshal(marshal, &req.JsonParams)
return req
}
func CreateRemoveBanRuleCacheResp() *RemoveBanRuleCacheResp {
return &RemoveBanRuleCacheResp{
BaseResponse: &responses.BaseResponse{},
}
}