diff --git a/services/pay/complaint_complete.go b/services/pay/complaint_complete.go index 74d5d62..57bec0c 100644 --- a/services/pay/complaint_complete.go +++ b/services/pay/complaint_complete.go @@ -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 { diff --git a/services/pay/complaint_reply.go b/services/pay/complaint_reply.go index 2203093..81f5e3c 100644 --- a/services/pay/complaint_reply.go +++ b/services/pay/complaint_reply.go @@ -11,6 +11,7 @@ type ComplaintReplyRequest struct { ComplaintId string `position:"Body" field:"complaint_id" default:"" ` Content string `position:"Body" field:"content" default:"" ` Images string `position:"Body" field:"images" default:"" ` + PayType int `position:"Body" field:"pay_type" default:"" ` } type ComplaintReplyResponse struct { diff --git a/services/pay/complaint_upload.go b/services/pay/complaint_upload.go index dda426e..f821a41 100644 --- a/services/pay/complaint_upload.go +++ b/services/pay/complaint_upload.go @@ -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 { diff --git a/services/pay/merchant_config_debug.go b/services/pay/merchant_config_debug.go index c574707..874e93a 100644 --- a/services/pay/merchant_config_debug.go +++ b/services/pay/merchant_config_debug.go @@ -7,7 +7,8 @@ import ( type merchantConfigDebugRequest struct { *requests.RpcRequest - MchId string `position:"Body" field:"mch_id" default:"" ` + MchId string `position:"Body" field:"mch_id" default:"" ` + PayType int `position:"Body" field:"pay_type" default:"" ` } type merchantConfigDebugResponse struct { diff --git a/services/userlive/client.go b/services/userlive/client.go index 3d9461d..4bde54a 100644 --- a/services/userlive/client.go +++ b/services/userlive/client.go @@ -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 +} diff --git a/services/userlive/client_test.go b/services/userlive/client_test.go index 92959f0..c48f290 100644 --- a/services/userlive/client_test.go +++ b/services/userlive/client_test.go @@ -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) +} diff --git a/services/userlive/user_ban.go b/services/userlive/user_ban.go index 9f601ea..6dd8c48 100644 --- a/services/userlive/user_ban.go +++ b/services/userlive/user_ban.go @@ -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,12 +28,12 @@ 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"` // 用户名 Uid int64 `json:"uid" form:"uid"` // 用户id - ServerId int64 `json:"server_id" form:"server_id"` // 区服id + ServerId string `json:"server_id" form:"server_id"` // 区服id RoleId string `json:"role_id" form:"role_id"` // 角色id BundleId string `json:"bundle_id" form:"bundle_id"` // ios 包名 GameName string `json:"game_name" from:"game_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{}, + } +}