6
0

Compare commits

...

6 Commits

Author SHA1 Message Date
huangqz
5d0ba49e7e 新增封禁接口 2025-09-05 19:20:27 +08:00
huangqz
7d0deb756a 新增获取用户累计付费方法 2025-09-05 10:25:50 +08:00
huangqz
3e45030be8 修改获取用户详情接口 2025-09-04 18:59:08 +08:00
huangqz
c0b4a0d83c 封装passport获取用户登录过的游戏大类接口 2025-09-02 17:17:36 +08:00
huangqz
7b904f4d5f 修改踢人接口 2025-08-29 18:31:51 +08:00
huangqz
13a6e20087 新增踢人接口 2025-08-29 17:12:22 +08:00
12 changed files with 437 additions and 3 deletions

View File

@ -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
}

View File

@ -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, "wzcqtest", "8676", time.Now().Unix())
kickUserResp, err := client.KickUser(getRealAuthBlackListReq)
if err != nil {
t.Error(err)
return
}
t.Log(kickUserResp)
}

View File

@ -442,3 +442,49 @@ func CreateGetGameRealAuthInfoResp() *GetGameRealAuthInfoResp {
BaseResponse: &responses.BaseResponse{},
}
}
// KickUserReq
// 踢人下线
type KickUserReq struct {
*requests.RpcRequest
Uid int64 `position:"Body" field:"uid" default:"-" `
GameSign string `position:"Body" field:"game_sign" 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(uid int64, gameSign string, serverSign string, time int64) *KickUserReq {
req := &KickUserReq{
RpcRequest: &requests.RpcRequest{},
Uid: uid,
GameSign: gameSign,
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{},
}
}

View File

@ -55,3 +55,11 @@ func (c *Client) EditCard(req EditCardRequestParam) (response string, err error)
}
return createEditCardResponse.GetHttpContentString(), nil
}
// GetUserGameSign
// 获取用户登录过的游戏大类
func (c *Client) GetUserGameSign(req *GetUserGameSignRequest) (response *GetUserGameSignResponse, err error) {
response = CreateGetUserGameSignResponse()
err = c.DoAction(req, response)
return
}

View File

@ -63,3 +63,18 @@ func TestEditCard(t *testing.T) {
t.Logf("%v", editCardResponse)
}
// 测试获取用户登录过的游戏大类
func TestGetUserGameSign(t *testing.T) {
client, err := NewClient()
if err != nil {
t.Error(err)
}
req := CreateGetUserGameSignRequest("oo70683572", "", "")
resp, err := client.GetUserGameSign(req)
if err != nil {
t.Error(err)
}
t.Logf("resp code:%+v", resp.Code)
t.Logf("resp data:%+v", resp.Data)
}

View File

@ -21,9 +21,35 @@ type GetUserListResponse struct {
}
type UserInfo struct {
UserName string `json:"user_name"` // 用户名
Uid string `json:"uid"` // uid
Telephone string `json:"telephone"` // 手机号
Id string `json:"id"`
Uid string `json:"uid"`
BbsUid string `json:"bbs_uid"`
UserName string `json:"user_name"`
UserPwd string `json:"user_pwd"`
Email string `json:"email"`
Integral string `json:"integral"`
NickName string `json:"nick_name"`
TrueName string `json:"true_name"`
Sex string `json:"sex"`
IdType string `json:"id_type"`
IdCard string `json:"id_card"`
Birthday string `json:"birthday"`
Telephone string `json:"telephone"`
Mobile string `json:"mobile"`
Address string `json:"address"`
Zipcode int64 `json:"zipcode"`
Level string `json:"level"`
Qq string `json:"qq"`
Msn string `json:"msn"`
Question string `json:"question"`
Answer string `json:"answer"`
HeadPic string `json:"head_pic"`
Defendboss string `json:"defendboss"`
RegTime int64 `json:"reg_time"`
RegIp string `json:"reg_ip"`
LoginIp string `json:"login_ip"`
LoginTime string `json:"login_time"`
State string `json:"state"`
}
// CreateGetUserListRequest 获取玩家用户列表
@ -114,3 +140,63 @@ func CreateGetUserRoleListResponse() (response *GetUserRoleListResponse) {
}
return
}
type GetUserGameSignRequest struct {
*requests.RpcRequest
}
type GetUserGameSignResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
List []UserGameSign `json:"list"`
} `json:"data"`
}
type UserGameSign struct {
Id string `json:"id"`
AgentId string `json:"agent_id"`
SiteId string `json:"site_id"`
Uid string `json:"uid"`
UserName string `json:"user_name"`
GameId string `json:"game_id"`
GameSign string `json:"game_sign"`
Oaid string `json:"oaid"`
Imei string `json:"imei"`
Imei2 string `json:"imei2"`
Ua string `json:"ua"`
FirstLoginIp string `json:"first_login_ip"`
FirstLoginTime string `json:"first_login_time"`
LastLoginIp string `json:"last_login_ip"`
LastLoginTime string `json:"last_login_time"`
}
// CreateGetUserGameSignRequest 获取用户登录过的游戏大类
func CreateGetUserGameSignRequest(userName, gameSign, orderBy string) (req *GetUserGameSignRequest) {
ts, sign := GetSign()
req = &GetUserGameSignRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/remote_login.php")
req.FormParams = map[string]string{
"act": "info",
"do": "get_user_game_sign",
"username": userName,
"game_sign": gameSign,
"order_by": orderBy,
"time": fmt.Sprintf("%v", ts),
"sign": sign,
}
req.Method = requests.POST
return
}
func CreateGetUserGameSignResponse() (response *GetUserGameSignResponse) {
response = &GetUserGameSignResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}

View File

@ -64,3 +64,13 @@ func (c *Client) GetUserRoleRegPage(req *UserRoleRegReq) (resp *UserRoleRegResp,
}
return
}
// GetUserTotalPay 获取用户累计付费
func (c *Client) GetUserTotalPay(req *GetUserTotalPayReq) (resp *GetUserTotalPayResp, err error) {
resp = CreateGetUserTotalPayResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}

View File

@ -98,3 +98,22 @@ func TestClient_GetUserRoleRegPage(t *testing.T) {
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
}
// 获取用户累计付费
func TestGetUserTotalPay(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateGetUserTotalPayReq(GetUserTotalPayParam{
Where: "user_name = 'yoyo685757'",
Fields: []string{"user_name", "sum(total_pay_money) as total_pay_money", "last_pay_time"},
GroupBy: []string{"user_name"},
})
resp, err := client.GetUserTotalPay(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
}

63
services/stat/pay.go Normal file
View File

@ -0,0 +1,63 @@
package stat
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
"strings"
)
type GetUserTotalPayReq struct {
*requests.RpcRequest
}
type GetUserTotalPayParam struct {
Where string `json:"where"`
Fields []string `json:"fields"`
GroupBy []string `json:"group_by"`
}
type GetUserTotalPayResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data TotalPayList `json:"data"`
}
type TotalPayList struct {
List []TotalPay `json:"list"`
}
type TotalPay struct {
UserName string `json:"user_name"`
RegDate string `json:"reg_date"`
AgentId int64 `json:"agent_id"`
SiteId int64 `json:"site_id"`
GameId int64 `json:"game_id"`
FirstPayTime string `json:"first_pay_time"`
FirstPayMoney float64 `json:"first_pay_money"`
TotalPayMoney float64 `json:"total_pay_money"`
LastPayTime string `json:"last_pay_time"`
PayTimes int64 `json:"pay_times"`
IsFirst int64 `json:"is_first"`
}
// CreateGetUserTotalPayReq 获取用户累充
func CreateGetUserTotalPayReq(data GetUserTotalPayParam) *GetUserTotalPayReq {
req := &GetUserTotalPayReq{
&requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/pay/getUserTotalPay")
req.Method = requests.POST
req.FormParams = make(map[string]string)
req.FormParams["where"] = data.Where
req.FormParams["fields"] = strings.Join(data.Fields, ",")
req.FormParams["group_by"] = strings.Join(data.GroupBy, ",")
return req
}
// CreateGetUserTotalPayResp 获取用户累充
func CreateGetUserTotalPayResp() *GetUserTotalPayResp {
return &GetUserTotalPayResp{
BaseResponse: &responses.BaseResponse{},
}
}

View File

@ -0,0 +1,34 @@
package userlive
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
)
const (
VERSION = "2020-11-16"
)
var HOST = requests.Host{
Default: "userlive",
}
type Client struct {
sdk.Client
}
func NewClient() (client *Client, err error) {
client = new(Client)
err = client.Init()
return
}
// CreateBanReq 封禁
func (c *Client) CreateBanReq(req *BanReq) (resp *BanResp, err error) {
resp = CreateBanResp()
err = c.DoAction(req, resp)
if err != nil {
return
}
return
}

View File

@ -0,0 +1,55 @@
package userlive
import (
"fmt"
"testing"
"time"
)
// 获取用户累计付费
func TestBan(t *testing.T) {
client, err := NewClient()
if err != nil {
panic(err)
}
req := CreateBanReq(BanReqParam{
ActionTime: time.Now().Unix(),
EventType: 0,
Ip: "127.0.0.1",
GameId: 8654,
UserName: "aq36604627",
Uid: 632308087,
ServerId: 123,
RoleId: "123",
BundleId: "asdfas",
GameName: "fasdf",
GameVersion: "fasdf",
SdkVersion: "fasdf",
Os: "fasd",
OsVersion: "faf",
InApp: "fasdf",
Ua: "fasdfas",
NetworkType: "fasdfa",
IsVirtual: "-1",
Cpu: "cpu",
DeviceModel: "dfasdf",
Baseband: "fasdfa",
Resolution: "fasdfa",
Battery: "fasdf",
LongId: "fasdf",
OriginImei: "fasdf",
Imei: "fasdf",
OriginOaid: "fasdf",
Oaid: "fasdf",
AndroidId: "fasdf",
Idfa: "fsdf",
Idfv: "fasdf",
DeviceId: "fasdf",
})
resp, err := client.CreateBanReq(req)
if err != nil {
panic(err)
}
fmt.Println(resp.Code, resp.Msg, resp.Data)
}

View File

@ -0,0 +1,75 @@
package userlive
import (
"encoding/json"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
type BanReq struct {
*requests.JsonRequest
}
type BanResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Ban bool `json:"ban"` // 是否要禁止
BanRuleId int64 `json:"ban_rule_id"` // 命中的封禁规则id
} `json:"data"`
}
type BanReqParam struct {
ActionTime int64 `json:"action_time" form:"action_time"` // 上报时间
EventType int64 `json:"event_type" form:"event_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
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"` // 应用名
GameVersion string `json:"game_version" from:"game_version"` // 游戏版本
SdkVersion string `json:"sdk_version" from:"sdk_version"` // sdk版本
Os string `json:"os" from:"os"` // 系统
OsVersion string `json:"os_version" from:"os_version"` // 系统版本
InApp string `json:"in_app" from:"in_app"` // 壳包系统,壳包传 如ios、android
Ua string `json:"ua" from:"ua"` // ua
NetworkType string `json:"network_type" from:"network_type"` // 网络类型
IsVirtual string `json:"is_virtual" from:"is_virtual"` // 是否是模拟器字符串01空字符串表示未知
Cpu string `json:"cpu" from:"cpu"` // cpu型号
DeviceModel string `json:"device_model" from:"device_model"` // 设备型号
Baseband string `json:"baseband" from:"baseband"` // 基带信息
Resolution string `json:"resolution" from:"resolution"` // 分辨率
Battery string `json:"battery" from:"battery"` // 电量
LongId string `json:"long_id" form:"long_id"` // 逻辑设备号
OriginImei string `json:"origin_imei" form:"origin_imei"` // imei原值
Imei string `json:"imei" form:"imei"` // 老sdk采集的imei
OriginOaid string `json:"origin_oaid" form:"origin_oaid"` // oaid原值
Oaid string `json:"oaid" form:"oaid"` // 老sdk采集的oaid
AndroidId string `json:"android_id" form:"android_id"` // 安卓id
Idfa string `json:"idfa" form:"idfa"` // idfa
Idfv string `json:"idfv" form:"idfv"` // idfv
DeviceId string `json:"device_id" form:"device_id"` // device_id
}
func CreateBanReq(data BanReqParam) *BanReq {
req := &BanReq{
&requests.JsonRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/user_ban/ban")
req.Method = requests.POST
marshal, _ := json.Marshal(data)
_ = json.Unmarshal(marshal, &req.JsonParams)
return req
}
// CreateBanResp 创建同步开服数据响应
func CreateBanResp() *BanResp {
return &BanResp{
BaseResponse: &responses.BaseResponse{},
}
}