From 89250bd32862c724794c10846e7faf846a8b0c57 Mon Sep 17 00:00:00 2001 From: xuyang Date: Tue, 9 Sep 2025 19:05:26 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=8A=95=E8=AF=89=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E6=96=B0=E5=A2=9E=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pay/complaint_complete.go | 1 + services/pay/complaint_upload.go | 1 + 2 files changed, 2 insertions(+) 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_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 { From 23d59fad11b29459d79e9d72f3db31f74ecd1f88 Mon Sep 17 00:00:00 2001 From: huangqz Date: Tue, 9 Sep 2025 20:04:44 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=A2=9Euserlive=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E3=80=81=E5=88=A0=E9=99=A4=E5=B0=81=E7=A6=81=E8=A7=84?= =?UTF-8?q?=E5=88=99=E7=BC=93=E5=AD=98=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/userlive/client.go | 21 ++++++++ services/userlive/client_test.go | 53 +++++++++++++++++++- services/userlive/user_ban.go | 86 +++++++++++++++++++++++++++++++- 3 files changed, 157 insertions(+), 3 deletions(-) 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..d8b48ec 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,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{}, + } +} From 0e4cb0c4ad5c18c5ee653b13cf2117200d6cbd1b Mon Sep 17 00:00:00 2001 From: xuyang Date: Thu, 11 Sep 2025 11:16:22 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=8A=95=E8=AF=89=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E6=96=B0=E5=A2=9E=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E7=B1=BB=E5=9E=8B=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pay/complaint_reply.go | 1 + services/pay/merchant_config_debug.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) 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/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 { From f31c37759baabc6e39fc2bea1a83549d48060e53 Mon Sep 17 00:00:00 2001 From: huangqz Date: Thu, 11 Sep 2025 11:19:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/userlive/user_ban.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/userlive/user_ban.go b/services/userlive/user_ban.go index d8b48ec..6dd8c48 100644 --- a/services/userlive/user_ban.go +++ b/services/userlive/user_ban.go @@ -33,7 +33,7 @@ type BanReqParam struct { 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"` // 应用名