7
0

feat(game): 新增获取游戏角色信息接口;feat(pay): 新增获取用户总充值接口

This commit is contained in:
叶 茂新 2026-01-05 11:25:49 +08:00
parent fd09f0ff02
commit 2da94cfe7c
4 changed files with 125 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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