223 lines
7.6 KiB
Go
223 lines
7.6 KiB
Go
package stat
|
|
|
|
import (
|
|
"crypto/md5"
|
|
"encoding/hex"
|
|
"fmt"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
|
"time"
|
|
)
|
|
|
|
type SetUserNewGameAuthReq struct {
|
|
*requests.RpcRequest
|
|
}
|
|
|
|
type SetUserNewGameAuthResp struct {
|
|
*responses.BaseResponse
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data Data `json:"data"`
|
|
}
|
|
|
|
type Data struct {
|
|
Result string `json:"result"`
|
|
}
|
|
|
|
const key = "gr_new_game"
|
|
|
|
// CreateSetUserNewGameAuthReq 设置用户新游戏授权
|
|
func CreateSetUserNewGameAuthReq(data map[string]string) *SetUserNewGameAuthReq {
|
|
req := &SetUserNewGameAuthReq{
|
|
&requests.RpcRequest{},
|
|
}
|
|
|
|
ts := time.Now().Unix()
|
|
hash := md5.New()
|
|
hash.Write([]byte(fmt.Sprintf("%v%v", ts, key)))
|
|
hashBytes := hash.Sum(nil)
|
|
|
|
token := hex.EncodeToString(hashBytes)
|
|
|
|
req.InitWithApiInfo(HOST, VERSION, "/user/setUserNewGameAuth")
|
|
req.Method = requests.POST
|
|
|
|
req.FormParams = data
|
|
if req.FormParams == nil {
|
|
req.FormParams = make(map[string]string)
|
|
}
|
|
req.FormParams["sign"] = token
|
|
req.FormParams["time"] = fmt.Sprintf("%v", ts)
|
|
return req
|
|
}
|
|
|
|
// CreateSetUserNewGameAuthResp 创建设置用户新游戏授权响应
|
|
func CreateSetUserNewGameAuthResp() *SetUserNewGameAuthResp {
|
|
return &SetUserNewGameAuthResp{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
}
|
|
|
|
// ------------------------------------
|
|
|
|
// UserRoleReg 玩家汇总角色创建记录
|
|
type UserRoleReg struct {
|
|
UserName string `json:"user_name"`
|
|
Uid string `json:"uid"`
|
|
RoleId string `json:"role_id"`
|
|
RoleName string `json:"role_name"`
|
|
GameSign string `json:"game_sign"`
|
|
Id string `json:"id"`
|
|
CreatedAt string `json:"created_at"`
|
|
}
|
|
type UserRoleRegPage struct {
|
|
Page int `json:"page"`
|
|
TotalCount int `json:"total_count"`
|
|
PageSize int `json:"page_size"`
|
|
Data []UserRoleReg `json:"data"`
|
|
}
|
|
|
|
type UserRoleRegParam struct {
|
|
Page int `json:"page"`
|
|
PageSize int `json:"page_size"`
|
|
RoleId string `json:"role_id"`
|
|
RoleName string `json:"role_name"`
|
|
}
|
|
type UserRoleRegReq struct {
|
|
*requests.RpcRequest
|
|
}
|
|
type UserRoleRegResp struct {
|
|
*responses.BaseResponse
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data UserRoleRegPage `json:"data"`
|
|
}
|
|
|
|
func CreateUserRoleRegPageReq(param UserRoleRegParam) *UserRoleRegReq {
|
|
req := &UserRoleRegReq{
|
|
&requests.RpcRequest{},
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/user/getRoleRegPage")
|
|
req.Method = requests.POST
|
|
req.FormParams = map[string]string{
|
|
"page": fmt.Sprintf("%v", param.Page),
|
|
"page_size": fmt.Sprintf("%v", param.PageSize),
|
|
"role_id": param.RoleId,
|
|
"role_name": param.RoleName,
|
|
}
|
|
|
|
return req
|
|
}
|
|
func CreateUserRoleRegPageResp() *UserRoleRegResp {
|
|
return &UserRoleRegResp{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
}
|
|
|
|
type DeviceInfo struct {
|
|
Network string `position:"Body" field:"network" default:""`
|
|
ScreenResolution string `position:"Body" field:"screen_resolution" default:""`
|
|
System string `position:"Body" field:"system" default:""`
|
|
Electric string `position:"Body" field:"electric" default:""`
|
|
ProcessorModel string `position:"Body" field:"processor_model" default:""`
|
|
BaseBand string `position:"Body" field:"baseband" default:""`
|
|
Model string `position:"Body" field:"model" default:""`
|
|
Battery string `position:"Body" field:"battery" default:""`
|
|
Package string `position:"Body" field:"package" default:""`
|
|
LongId string `position:"Body" field:"long_id" default:""`
|
|
Imei string `position:"Body" field:"imei" default:""`
|
|
Oaid string `position:"Body" field:"oaid" default:""`
|
|
Idfa string `position:"Body" field:"idfa" default:""`
|
|
Idfv string `position:"Body" field:"idfv" default:""`
|
|
AdDevice string `position:"Body" field:"ad_device" default:""`
|
|
Os string `position:"Body" field:"os" default:""`
|
|
IP string `position:"Body" field:"ip" default:""`
|
|
Ua string `position:"Body" field:"ua" default:""`
|
|
WxPlatform string `position:"Body" field:"wx_platform" default:""`
|
|
Adinfo string `position:"Body" field:"adinfo" default:""`
|
|
}
|
|
|
|
type UserRegRequest struct {
|
|
*requests.RpcRequest
|
|
DeviceInfo
|
|
ChannelId int64 `position:"Body" field:"mtype" default:"1"`
|
|
GameId int64 `position:"Body" field:"game_id" default:"0"`
|
|
LoginGameId int64 `position:"Body" field:"login_game_id" default:"0"`
|
|
GameSign string `position:"Body" field:"game_sign" default:""`
|
|
Uid int64 `position:"Body" field:"uid" default:"0"`
|
|
UserName string `position:"Body" field:"user_name" default:""`
|
|
Openid int64 `position:"Body" field:"openid" default:"0"`
|
|
ComeBackUser int64 `position:"Body" field:"come_back_user" default:"0"`
|
|
RegTime int64 `position:"Body" field:"reg_time" default:""`
|
|
Logined int64 `position:"Body" field:"logined" default:"1"`
|
|
RegType int64 `position:"Body" field:"reg_type" default:""`
|
|
LpReg int64 `position:"Body" field:"lp_reg" default:"0"`
|
|
MatchType int64 `position:"Body" field:"match_type" default:"0"`
|
|
AgentId int64 `position:"Body" field:"agent_id" default:"100"`
|
|
SiteId int64 `position:"Body" field:"site_id" default:"1001"`
|
|
PkgAgentId int64 `position:"Body" field:"pkg_agent_id" default:"0"`
|
|
PkgSiteId int64 `position:"Body" field:"pkg_site_id" default:"0"`
|
|
FromAd int64 `position:"Body" field:"from_ad" default:"0"`
|
|
FanCode string `position:"Body" field:"fan_code" default:""`
|
|
InvalidUuid int64 `position:"Body" field:"invalid_uuid" default:"0"`
|
|
}
|
|
|
|
type UserRegResponse struct {
|
|
*responses.BaseResponse
|
|
Code int64 `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data struct {
|
|
Result any `json:"result,omitempty"`
|
|
RegNum int64 `json:"reg_num,omitempty"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
func CreateUserRegRequest() *UserRegRequest {
|
|
req := &UserRegRequest{
|
|
RpcRequest: &requests.RpcRequest{},
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/user/reg")
|
|
req.Method = requests.POST
|
|
return req
|
|
}
|
|
|
|
type UserLoginRequest struct {
|
|
*requests.RpcRequest
|
|
DeviceInfo
|
|
ChannelId int64 `position:"Body" field:"mtype" default:"0"`
|
|
GameId int64 `position:"Body" field:"game_id" default:"0"`
|
|
GameSign string `position:"Body" field:"game_sign" default:""`
|
|
Version string `position:"Body" field:"version" default:""`
|
|
UserName string `position:"Body" field:"user_name" default:""`
|
|
Uid int64 `position:"Body" field:"uid" default:"0"`
|
|
RegTime int64 `position:"Body" field:"reg_time" default:"0"`
|
|
LoginTime int64 `position:"Body" field:"login_time" default:"0"`
|
|
LoginAgentId int64 `position:"Body" field:"login_agent_id" default:"0"`
|
|
LoginSiteId int64 `position:"Body" field:"login_site_id" default:"0"`
|
|
PkgAgentId int64 `position:"Body" field:"pkg_agent_id" default:"0"`
|
|
PkgSiteId int64 `position:"Body" field:"pkg_site_id" default:"0"`
|
|
FromAd int64 `position:"Body" field:"from_ad" default:"0"`
|
|
CpData string `position:"Body" field:"cp_data" default:""`
|
|
OriginalImei string `position:"Body" field:"originalimei" default:""`
|
|
InvalidUuid int64 `position:"Body" field:"invalid_uuid" default:"0"`
|
|
ServerId int64 `position:"Body" field:"server_id" default:"1"`
|
|
}
|
|
|
|
type UserLoginResponse struct {
|
|
*responses.BaseResponse
|
|
Code int64 `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data struct {
|
|
Result any `json:"result,omitempty"`
|
|
} `json:"data"`
|
|
}
|
|
|
|
func CreateUserLoginRequest() *UserLoginRequest {
|
|
req := &UserLoginRequest{
|
|
RpcRequest: &requests.RpcRequest{},
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/user/login")
|
|
req.Method = requests.POST
|
|
return req
|
|
}
|