158 lines
3.6 KiB
Go
158 lines
3.6 KiB
Go
package cs
|
|
|
|
import (
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
|
|
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
|
|
)
|
|
|
|
/**
|
|
* 获取玩家(用户)相关信息
|
|
*/
|
|
|
|
// UserInfo 用户信息
|
|
type UserInfo struct {
|
|
UserName string `json:"user_name"`
|
|
Uid int64 `json:"uid"`
|
|
Telephone string `json:"telephone"`
|
|
}
|
|
|
|
type GetUserInfoRequest struct {
|
|
*requests.RpcRequest
|
|
}
|
|
|
|
type GetUserInfoResponse struct {
|
|
*responses.BaseResponse
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data UserInfo `json:"data"`
|
|
}
|
|
|
|
func CreateGetUserInfoRequest(userName string) (req *GetUserInfoRequest) {
|
|
req = &GetUserInfoRequest{
|
|
RpcRequest: &requests.RpcRequest{},
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/v1/user/info")
|
|
|
|
req.FormParams = map[string]string{
|
|
"user_name": userName,
|
|
}
|
|
|
|
req.Method = requests.POST
|
|
return
|
|
}
|
|
|
|
func CreateGetUserInfoResponse() (response *GetUserInfoResponse) {
|
|
response = &GetUserInfoResponse{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
return
|
|
}
|
|
|
|
// UserRoleInfo 玩家角色信息
|
|
type UserRoleInfo struct {
|
|
Uid int64 `json:"uid"`
|
|
RoleName string `json:"role_name"`
|
|
RoleId string `json:"role_id"`
|
|
}
|
|
|
|
type GetUserRoleListRequest struct {
|
|
*requests.JsonRequest
|
|
}
|
|
|
|
type GetUserRoleListResponse struct {
|
|
*responses.BaseResponse
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data []UserRoleInfo `json:"data"`
|
|
}
|
|
|
|
func CreateGetUserRoleListRequest(uId int64, gameId int64) (req *GetUserRoleListRequest) {
|
|
req = &GetUserRoleListRequest{
|
|
JsonRequest: &requests.JsonRequest{},
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/v1/user/role_list")
|
|
|
|
req.JsonParams["uid"] = uId
|
|
req.JsonParams["game_id"] = gameId
|
|
|
|
req.Method = requests.POST
|
|
return
|
|
}
|
|
func CreateGetUserRoleListResponse() (response *GetUserRoleListResponse) {
|
|
response = &GetUserRoleListResponse{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
return
|
|
}
|
|
|
|
// UserServerInfo 玩家区服信息
|
|
type UserServerInfo struct {
|
|
ServerName string `json:"server_name"`
|
|
}
|
|
type GetUserServerListRequest struct {
|
|
*requests.JsonRequest
|
|
}
|
|
type GetUserServerListResponse struct {
|
|
*responses.BaseResponse
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data []UserServerInfo `json:"data"`
|
|
}
|
|
|
|
func CreateGetUserServerListRequest(uId int64, gameId int64) (req *GetUserServerListRequest) {
|
|
req = &GetUserServerListRequest{
|
|
JsonRequest: &requests.JsonRequest{},
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/v1/user/server_list")
|
|
|
|
req.JsonParams["uid"] = uId
|
|
req.JsonParams["game_id"] = gameId
|
|
|
|
req.Method = requests.POST
|
|
return
|
|
}
|
|
func CreateGetUserServerListResponse() (response *GetUserServerListResponse) {
|
|
response = &GetUserServerListResponse{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
return
|
|
}
|
|
|
|
type SendSmsReq struct {
|
|
Phone string `json:"phone"`
|
|
}
|
|
|
|
// SendSmsResp 发送短信返回
|
|
type SendSmsResp struct {
|
|
// 短信发送时间戳,工单模块 有效期5分钟
|
|
SendCodeTime int64 `json:"send_code_time"`
|
|
}
|
|
|
|
type SendSmsRequest struct {
|
|
*requests.JsonRequest
|
|
Phone string `position:"Json" field:"phone"`
|
|
}
|
|
type SendSmsResponse struct {
|
|
*responses.BaseResponse
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data SendSmsResp `json:"data"`
|
|
}
|
|
|
|
func CreateSendSmsRequest(param SendSmsReq) (req *SendSmsRequest) {
|
|
req = &SendSmsRequest{
|
|
JsonRequest: &requests.JsonRequest{},
|
|
Phone: param.Phone,
|
|
}
|
|
req.InitWithApiInfo(HOST, VERSION, "/v1/user/send_sms")
|
|
|
|
req.Method = requests.POST
|
|
return
|
|
}
|
|
func CreateSendSmsResponse() (response *SendSmsResponse) {
|
|
response = &SendSmsResponse{
|
|
BaseResponse: &responses.BaseResponse{},
|
|
}
|
|
return
|
|
}
|