package stat import ( "crypto/md5" "encoding/hex" "encoding/json" "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 BindLiveCodeParam struct { Uid int64 `json:"uid"` UserName string `json:"user_name"` GameId int64 `json:"game_id"` GameSign string `json:"game_sign"` RegDate string `json:"reg_date"` LiveCode string `json:"live_code"` LiveSiteId int64 `json:"live_site_id"` AnchorName string `json:"anchor_name"` BindTime int64 `json:"bind_time"` } type BindLiveCodeReq = requests.JsonRequest type BindLiveCodeResp struct { *responses.BaseResponse Code int `json:"code"` Msg string `json:"msg"` } func CreateBindLiveCodeReq(param BindLiveCodeParam) *BindLiveCodeReq { req := &requests.JsonRequest{} _param, _ := json.Marshal(param) paramMap := make(map[string]any) _ = json.Unmarshal(_param, ¶mMap) req.InitWithApiInfo(HOST, VERSION, "/user/bindLiveCode") req.Method = requests.POST req.JsonParams = paramMap return req }