2024-09-19 12:33:23 +08:00
|
|
|
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{},
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-06-23 17:19:50 +08:00
|
|
|
|
|
|
|
|
// ------------------------------------
|
|
|
|
|
|
|
|
|
|
// 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"`
|
2025-06-24 18:00:55 +08:00
|
|
|
TotalCount int `json:"total_count"`
|
2025-06-23 17:19:50 +08:00
|
|
|
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{},
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-11-30 15:16:45 +08:00
|
|
|
|
|
|
|
|
type DeviceInfo struct {
|
2025-12-02 17:08:13 +08:00
|
|
|
Network string `position:"Body" field:"network" default:"" json:"network"`
|
|
|
|
|
ScreenResolution string `position:"Body" field:"screen_resolution" default:"" json:"screen_resolution"`
|
|
|
|
|
System string `position:"Body" field:"system" default:"" json:"system"`
|
|
|
|
|
Electric string `position:"Body" field:"electric" default:"" json:"electric"`
|
|
|
|
|
ProcessorModel string `position:"Body" field:"processor_model" default:"" json:"processor_model"`
|
|
|
|
|
BaseBand string `position:"Body" field:"baseband" default:"" json:"baseband"`
|
|
|
|
|
Model string `position:"Body" field:"model" default:"" json:"model"`
|
|
|
|
|
Battery string `position:"Body" field:"battery" default:"" json:"battery"`
|
|
|
|
|
Package string `position:"Body" field:"package" default:"" json:"package"`
|
|
|
|
|
LongId string `position:"Body" field:"long_id" default:"" json:"long_id"`
|
|
|
|
|
Imei string `position:"Body" field:"imei" default:"" json:"imei"`
|
|
|
|
|
Oaid string `position:"Body" field:"oaid" default:"" json:"oaid"`
|
|
|
|
|
Idfa string `position:"Body" field:"idfa" default:"" json:"idfa"`
|
|
|
|
|
Idfv string `position:"Body" field:"idfv" default:"" json:"idfv"`
|
|
|
|
|
AdDevice string `position:"Body" field:"ad_device" default:"" json:"ad_device"`
|
|
|
|
|
Os string `position:"Body" field:"os" default:"" json:"os"`
|
|
|
|
|
IP string `position:"Body" field:"ip" default:"" json:"ip"`
|
|
|
|
|
Ua string `position:"Body" field:"ua" default:"" json:"ua"`
|
|
|
|
|
WxPlatform string `position:"Body" field:"wx_platform" default:"" json:"wx_platform"`
|
|
|
|
|
Adinfo string `position:"Body" field:"adinfo" default:"" json:"adinfo"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UserRegParam struct {
|
|
|
|
|
DeviceInfo
|
|
|
|
|
ChannelId int64 `position:"Body" field:"mtype" default:"1" json:"mtype"`
|
|
|
|
|
GameId int64 `position:"Body" field:"game_id" default:"0" json:"game_id"`
|
|
|
|
|
LoginGameId int64 `position:"Body" field:"login_game_id" default:"0" json:"login_game_id"`
|
|
|
|
|
GameSign string `position:"Body" field:"game_sign" default:"" json:"game_sign"`
|
|
|
|
|
Uid int64 `position:"Body" field:"uid" default:"0" json:"uid"`
|
|
|
|
|
UserName string `position:"Body" field:"user_name" default:"" json:"user_name"`
|
|
|
|
|
Openid string `position:"Body" field:"openid" default:"" json:"openid"`
|
|
|
|
|
Phone string `position:"Body" field:"mobile_phone" default:"" json:"mobile_phone"`
|
|
|
|
|
ComeBackUser int64 `position:"Body" field:"come_back_user" default:"0" json:"come_back_user"`
|
|
|
|
|
RegTime int64 `position:"Body" field:"reg_time" default:"" json:"reg_time"`
|
|
|
|
|
Logined int64 `position:"Body" field:"logined" default:"1" json:"logined"`
|
|
|
|
|
RegType int64 `position:"Body" field:"reg_type" default:"" json:"reg_type"`
|
|
|
|
|
LpReg int64 `position:"Body" field:"lp_reg" default:"0" json:"lp_reg"`
|
|
|
|
|
MatchType int64 `position:"Body" field:"match_type" default:"0" json:"match_type"`
|
|
|
|
|
AgentId int64 `position:"Body" field:"agent_id" default:"100" json:"agent_id"`
|
|
|
|
|
SiteId int64 `position:"Body" field:"site_id" default:"1001" json:"site_id"`
|
|
|
|
|
PkgAgentId int64 `position:"Body" field:"pkg_agent_id" default:"0" json:"pkg_agent_id"`
|
|
|
|
|
PkgSiteId int64 `position:"Body" field:"pkg_site_id" default:"0" json:"pkg_site_id"`
|
|
|
|
|
FromAd int64 `position:"Body" field:"from_ad" default:"0" json:"from_ad"`
|
|
|
|
|
FanCode string `position:"Body" field:"fan_code" default:"" json:"fan_code"`
|
|
|
|
|
InvalidUuid int64 `position:"Body" field:"invalid_uuid" default:"0" json:"invalid_uuid"`
|
2025-11-30 15:16:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UserRegRequest struct {
|
|
|
|
|
*requests.RpcRequest
|
2025-12-02 17:08:13 +08:00
|
|
|
UserRegParam
|
2025-11-30 15:16:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-02 17:08:13 +08:00
|
|
|
func CreateUserRegRequest(param *UserRegParam) *UserRegRequest {
|
2025-11-30 15:16:45 +08:00
|
|
|
req := &UserRegRequest{
|
2025-12-02 17:08:13 +08:00
|
|
|
RpcRequest: &requests.RpcRequest{},
|
|
|
|
|
UserRegParam: *param,
|
2025-11-30 15:16:45 +08:00
|
|
|
}
|
|
|
|
|
req.InitWithApiInfo(HOST, VERSION, "/user/reg")
|
|
|
|
|
req.Method = requests.POST
|
|
|
|
|
return req
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-02 17:08:13 +08:00
|
|
|
type UserLoginParam struct {
|
|
|
|
|
DeviceInfo
|
|
|
|
|
ChannelId int64 `position:"Body" field:"mtype" default:"0" json:"mtype"`
|
|
|
|
|
GameId int64 `position:"Body" field:"game_id" default:"0" json:"game_id"`
|
|
|
|
|
GameSign string `position:"Body" field:"game_sign" default:"" json:"game_sign"`
|
|
|
|
|
Version string `position:"Body" field:"version" default:"" json:"version"`
|
|
|
|
|
UserName string `position:"Body" field:"user_name" default:"" json:"user_name"`
|
|
|
|
|
Uid int64 `position:"Body" field:"uid" default:"0" json:"uid"`
|
|
|
|
|
RegTime int64 `position:"Body" field:"reg_time" default:"0" json:"reg_time"`
|
|
|
|
|
LoginTime int64 `position:"Body" field:"login_time" default:"0" json:"login_time"`
|
|
|
|
|
LoginAgentId int64 `position:"Body" field:"login_agent_id" default:"0" json:"login_agent_id"`
|
|
|
|
|
LoginSiteId int64 `position:"Body" field:"login_site_id" default:"0" json:"login_site_id"`
|
|
|
|
|
PkgAgentId int64 `position:"Body" field:"pkg_agent_id" default:"0" json:"pkg_agent_id"`
|
|
|
|
|
PkgSiteId int64 `position:"Body" field:"pkg_site_id" default:"0" json:"pkg_site_id"`
|
|
|
|
|
FromAd int64 `position:"Body" field:"from_ad" default:"0" json:"from_ad"`
|
|
|
|
|
CpData string `position:"Body" field:"cp_data" default:"" json:"cp_data"`
|
|
|
|
|
OriginalImei string `position:"Body" field:"originalimei" default:"" json:"originalimei"`
|
|
|
|
|
InvalidUuid int64 `position:"Body" field:"invalid_uuid" default:"0" json:"invalid_uuid"`
|
|
|
|
|
ServerId int64 `position:"Body" field:"server_id" default:"1" json:"server_id"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-30 15:16:45 +08:00
|
|
|
type UserLoginRequest struct {
|
|
|
|
|
*requests.RpcRequest
|
2025-12-02 17:08:13 +08:00
|
|
|
UserLoginParam
|
2025-11-30 15:16:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UserLoginResponse struct {
|
|
|
|
|
*responses.BaseResponse
|
|
|
|
|
Code int64 `json:"code"`
|
|
|
|
|
Msg string `json:"msg"`
|
|
|
|
|
Data struct {
|
|
|
|
|
Result any `json:"result,omitempty"`
|
|
|
|
|
} `json:"data"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-02 17:08:13 +08:00
|
|
|
func CreateUserLoginRequest(param *UserLoginParam) *UserLoginRequest {
|
2025-11-30 15:16:45 +08:00
|
|
|
req := &UserLoginRequest{
|
2025-12-02 17:08:13 +08:00
|
|
|
RpcRequest: &requests.RpcRequest{},
|
|
|
|
|
UserLoginParam: *param,
|
2025-11-30 15:16:45 +08:00
|
|
|
}
|
|
|
|
|
req.InitWithApiInfo(HOST, VERSION, "/user/login")
|
|
|
|
|
req.Method = requests.POST
|
|
|
|
|
return req
|
|
|
|
|
}
|