From 2da94cfe7c781329d9e9b300a9fbd97b9d76e875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E8=8C=82=E6=96=B0?= Date: Mon, 5 Jan 2026 11:25:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(game):=20=E6=96=B0=E5=A2=9E=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=B8=B8=E6=88=8F=E8=A7=92=E8=89=B2=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3;feat(pay):=20=E6=96=B0=E5=A2=9E=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=94=A8=E6=88=B7=E6=80=BB=E5=85=85=E5=80=BC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/game/client.go | 8 +++++ services/game/game.go | 70 ++++++++++++++++++++++++++++++++++++ services/pay/client.go | 8 +++++ services/pay/get_user_pay.go | 39 ++++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 services/pay/get_user_pay.go diff --git a/services/game/client.go b/services/game/client.go index 387cc77..646fb39 100644 --- a/services/game/client.go +++ b/services/game/client.go @@ -147,3 +147,11 @@ func (c *Client) GetGameClientInfo(gameId, status int64) (response *ClientInfoRe err = c.DoAction(clientInfoReq, response) return } + +// GetGameRoleName +// 获取游戏角色信息 +func (c *Client) GetGameRoleName(req *GetGameRoleNameReq) (response *GetGameRoleNameResp, err error) { + response = CreateGetGameRoleNameResp() + err = c.DoAction(req, response) + return +} diff --git a/services/game/game.go b/services/game/game.go index 0ffc90b..161aa8a 100644 --- a/services/game/game.go +++ b/services/game/game.go @@ -4,8 +4,12 @@ import ( "fmt" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" + "time" ) +const gameKey = "gaoreapi" + type GetGameOsInfoReq struct { *requests.RpcRequest } @@ -522,3 +526,69 @@ func CreateGetLoginBgResp() *GetLoginBgResp { BaseResponse: &responses.BaseResponse{}, } } + +type GetGameRoleNameReq struct { + *requests.RpcRequest + AppId int64 `position:"Body" field:"appid"` + UserName string `position:"Body" field:"user_name"` + ServerId int64 `position:"Body" field:"server_id"` + UserId int64 `position:"Body" field:"user_id"` + Time int64 `position:"Body" field:"time"` + Sign string `position:"Body" field:"sign"` + Os int64 `position:"Body" field:"os"` +} + +type GetGameRoleNameResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data struct { + UserInfo []Role `json:"userinfo"` + } `json:"data"` +} + +type Role struct { + RoleId string `json:"roleId"` + Name string `json:"name"` + Server int64 `json:"server"` + ServerName string `json:"serverName"` + Level int64 `json:"level"` + VipLevel int64 `json:"vipLevel"` + CreateTime int64 `json:"createTime"` + RoleLevelUpdateTime int64 `json:"roleLevelUpdateTime"` + Power int64 `json:"power"` + Profession string `json:"profession"` + ZhuanshengLv int64 `json:"zhuansheng_lv"` + ZhuanshengName string `json:"zhuanshengName"` + Gold int64 `json:"gold"` + LoginDays int64 `json:"loginDays"` + PlayTime int64 `json:"playTime"` + DayData struct { + DailyCheckPoint int64 `json:"dailyCheckPoint"` + OnlineTime int64 `json:"onlineTime"` + Liveness int64 `json:"liveness"` + } +} + +func CreateGetGameRoleNameReq(gameId, sid, uid, os int64, nameName string) *GetGameRoleNameReq { + ts := time.Now().Unix() + req := &GetGameRoleNameReq{ + RpcRequest: &requests.RpcRequest{}, + AppId: gameId, + UserName: nameName, + ServerId: sid, + UserId: uid, + Time: ts, + Sign: utils.Md5(fmt.Sprintf("%d%d%s", gameId, ts, gameKey)), + Os: os, + } + req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameRoleName") + req.Method = requests.POST + return req +} + +func CreateGetGameRoleNameResp() *GetGameRoleNameResp { + return &GetGameRoleNameResp{ + BaseResponse: &responses.BaseResponse{}, + } +} diff --git a/services/pay/client.go b/services/pay/client.go index 8aab99e..30e0f0c 100644 --- a/services/pay/client.go +++ b/services/pay/client.go @@ -78,3 +78,11 @@ func (c *Client) GetUserScoreLog(req *GetUserScoreLogRequest) (response *GetUser err = c.DoAction(req, response) return } + +// GetUserPay +// 获取用户总充值 +func (c *Client) GetUserPay(req *GetUserPayRequest) (response *GetUserPayResponse, err error) { + response = CreateGetUserPayResponse() + err = c.DoAction(req, response) + return +} diff --git a/services/pay/get_user_pay.go b/services/pay/get_user_pay.go new file mode 100644 index 0000000..f54f9a4 --- /dev/null +++ b/services/pay/get_user_pay.go @@ -0,0 +1,39 @@ +package pay + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type GetUserPayRequest struct { + *requests.RpcRequest + Uids string `position:"Body" field:"uids"` + Type int64 `position:"Body" field:"type"` + GameIds string `position:"Body" field:"game_ids" ` +} + +type GetUserPayResponse struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data map[int64]float64 `json:"data"` +} + +func CreateGetUserPayRequest(uids, gameIds string, t int64) (req *GetUserPayRequest) { + req = &GetUserPayRequest{ + RpcRequest: &requests.RpcRequest{}, + Uids: uids, + Type: t, + GameIds: gameIds, + } + req.InitWithApiInfo(HOST, VERSION, "/api/user/getUserPay") + req.Method = requests.POST + return +} + +func CreateGetUserPayResponse() (response *GetUserPayResponse) { + response = &GetUserPayResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +}