6
0
gaore-common-sdk-go/services/chat/batch_ban_account.go

66 lines
2.4 KiB
Go
Raw Normal View History

package chat
import (
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests"
"golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses"
)
// BatchBanAccountRequest 批量封用户(逐条返回结果,部分失败不影响其余)。
// 对应 chat 服务 POST /api/open/batchBanAccount验签走 form 参数 gkey/time/sign。
type BatchBanAccountRequest struct {
*requests.RpcRequest
Gkey string `position:"Body" field:"gkey"`
Time string `position:"Body" field:"time"`
Sign string `position:"Body" field:"sign"`
Items string `position:"Body" field:"items"` // JSON 数组字符串,每项 {gkey,sid,uid,user_name,role_id,role_name,game_id},单次最多 200 条
Banduration int64 `position:"Body" field:"banduration"` // 封禁时长(分钟),必须 >0
Banremark string `position:"Body" field:"banremark"` // 封禁备注(写入 gr_block 留痕)
OpAdmin string `position:"Body" field:"op_admin"` // 操作人(拼进备注留痕)
}
// BanAccountItem 待封角色Items 的 JSON 元素)
type BanAccountItem struct {
Gkey string `json:"gkey"` // 游戏标识
Sid string `json:"sid"` // 区服 ID
Uid int64 `json:"uid"` // 高热用户 ID
UserName string `json:"user_name"` // 高热账号
RoleId string `json:"role_id"` // 角色 ID
RoleName string `json:"role_name"` // 角色名
GameId int64 `json:"game_id"` // 子游戏 ID
}
// BanAccountResult 单条封禁结果
type BanAccountResult struct {
Uid int64 `json:"uid"`
RoleId string `json:"role_id"`
Success bool `json:"success"`
Message string `json:"message"`
}
type BatchBanAccountResponse struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Results []BanAccountResult `json:"results"`
} `json:"data"`
}
// CreateBatchBanAccountRequest 组装请求并完成 open 签名key 由调用方配置传入)。
func CreateBatchBanAccountRequest(gkey, key string) (req *BatchBanAccountRequest) {
req = &BatchBanAccountRequest{
RpcRequest: &requests.RpcRequest{},
}
req.InitWithApiInfo(HOST, VERSION, "/api/open/batchBanAccount")
req.Method = requests.POST
req.Gkey, req.Time, req.Sign = signOpenApi(gkey, key)
return
}
func CreateBatchBanAccountResponse() (response *BatchBanAccountResponse) {
response = &BatchBanAccountResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}