diff --git a/services/game/client.go b/services/game/client.go index a108f3a..e5c91ff 100644 --- a/services/game/client.go +++ b/services/game/client.go @@ -116,3 +116,10 @@ func (c *Client) GetProtocolByCompany(req *GetProtocolByCompanyRep) (resp *GetPr err = c.DoAction(req, resp) return } + +// KickUser 踢人 +func (c *Client) KickUser(req *KickUserReq) (resp *KickUserResp, err error) { + resp = CreateKickUserResp() + err = c.DoAction(req, resp) + return +} diff --git a/services/game/client_test.go b/services/game/client_test.go index d6edfba..4235294 100644 --- a/services/game/client_test.go +++ b/services/game/client_test.go @@ -3,6 +3,7 @@ package game import ( "fmt" "testing" + "time" ) func TestGetGameOsInfo(t *testing.T) { @@ -211,3 +212,18 @@ func TestClient_GetProtocolByCompany(t *testing.T) { } t.Log(resp.Code, resp.Msg, resp.Data.Content) } + +// 测试踢人 +func TestKickUser(t *testing.T) { + client, err := NewClient() + if err != nil { + t.Error(err) + } // CreateKickUserReq + getRealAuthBlackListReq := CreateKickUserReq(8677, 123, "8676", time.Now().Unix()) + kickUserResp, err := client.KickUser(getRealAuthBlackListReq) + if err != nil { + t.Error(err) + return + } + t.Log(kickUserResp) +} diff --git a/services/game/game.go b/services/game/game.go index bc0f694..07e4385 100644 --- a/services/game/game.go +++ b/services/game/game.go @@ -442,3 +442,49 @@ func CreateGetGameRealAuthInfoResp() *GetGameRealAuthInfoResp { BaseResponse: &responses.BaseResponse{}, } } + +// KickUserReq +// 踢人下线 +type KickUserReq struct { + *requests.RpcRequest + GameId int64 `position:"Body" field:"game_id" default:"-" ` + Uid int64 `position:"Body" field:"uid" default:"-" ` + ServerSign string `position:"Body" field:"server_sign" default:"-" ` + Time int64 `position:"Body" field:"time" default:"-" ` +} + +type KickUserRespDataCallCpInfo struct { + Url string `json:"url"` + RequestParam map[string]any `json:"request_param"` + Response map[string]any `json:"response"` +} + +type KickUserRespData struct { + CallCpInfo KickUserRespDataCallCpInfo `json:"call_cp_info"` +} + +type KickUserResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data KickUserRespData `json:"data"` +} + +func CreateKickUserReq(gameId int64, uid int64, serverSign string, time int64) *KickUserReq { + req := &KickUserReq{ + RpcRequest: &requests.RpcRequest{}, + GameId: gameId, + Uid: uid, + ServerSign: serverSign, + Time: time, + } + req.InitWithApiInfo(HOST, VERSION, "/api/game/kickUser") + req.Method = requests.POST + return req +} + +func CreateKickUserResp() *KickUserResp { + return &KickUserResp{ + BaseResponse: &responses.BaseResponse{}, + } +}