服务端对接
如果不想接入 sdk 就使用举报服务,可以通过 HTTP 请求的方式直接调用举报服务接口,但是需要自行实现接口签名、传递必要参数等基础功能。
域名
测试地址
大陆
http://xdsdk-bj-qa-reportingbff.xd.cn
海外
http://xdsdk-sg-qa-reportingbff.xd.com
生产地址
大陆
http://xdsdk-bj-prod-reportingbff.xd.cn
海外
http://xdsdk-sg-prod-reportingbff.xd.com
使用方法
- 如果需要上传图片:
- 先通过 /xd/reporting/open/v1/upload/oss_sign_url 接口上传获得签名
signUrl
- 再读取用户上传文件,使用阿里云sdk(https://help.aliyun.com/zh/oss/user-guide/simple-upload)或者 restful API(https://help.aliyun.com/zh/oss/developer-reference/putobject?spm=a2c4g.11186623.0.0.29585168bwW3GT#reference-l5p-ftw-tdb) 上传到 oss
- 获取上传完成的地址
ossUrl
- 先通过 /xd/reporting/open/v1/upload/oss_sign_url 接口上传获得签名
- 组装参数并请求 /xd/reporting/open/v1/player/report 接口上报举报
接口
/xd/reporting/open/v1/player/report
POST
Summary:
- 上报举报
请求体参数
Name | Located in | Type | Description | Required |
---|---|---|---|---|
client_info | body | v1ClientInfo | 客户端必要信息 | yes |
reporter | body | v1User | 举报人 | yes |
reportee | body | v1User | 被举报人 | yes |
reasons | body | [ v1Reason ] | 原因 | yes |
evidence | body | [ v1File ] | 上传文件 | No |
user_description | body | string | 用户描述 | No |
extras | body | string | 额外信息 | No |
nonce | body | string | 一次性随机字符串 | yes |
timestamp | body | string | 请求时间戳 | yes |
sign | body | string | 签名 | yes |
syntax = "proto3";
rpc CreateReportLog (CreateReportLogReq) returns (CreateReportLogResp) {
option (google.api.http) = {
post: "/xd/reporting/open/v1/player/report",
body: "*"
};
}
message CreateReportLogReq {
ClientInfo client_info = 1;
/** 举报人 */
User reporter = 2;
/** 被举报人 */
User reportee = 3;
/** 举报原因 */
repeated Reason reasons = 4;
/** 举报证据 */
repeated File evidence = 5;
string user_description = 6;
string extras = 7;
string nonce = 8;
string timestamp = 9;
string sign = 10;
}
message CreateReportLogResp {}
message ClientInfo {
/** 必传参数 */
string client_id = 1;
string ip = 2;
/** 选填 */
/** 设备 id */
string DeviceID = 20;
}
message Report {
/** 举报人 */
User reporter = 1;
/** 被举报人 */
User reportee = 2;
/** 举报原因 */
repeated Reason reasons = 3;
/** 举报证据 */
repeated File evidence = 4;
string user_description = 5;
/** 业务方根据自身需求补充的信息,透传给后端 */
string extras = 6;
}
message User {
string xdid = 1;
/** 角色 id */
string role_id = 2;
/** 所在服务器 id */
string server_code = 3;
/** 角色名 */
string role_name = 4;
/** 业务方根据自身需求补充的信息,透传给后端 */
string extra = 5;
}
message Reason {
/** 商定好的举报原因 id */
int64 id = 1;
/** 原因名称 */
string title = 2;
/** 业务方根据自身需求补充的信息,透传给后端 */
string extras = 3;
}
message File {
string name = 1;
int64 size_byte = 2;
string uri = 3;
}
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
body | body | Yes | v1CreateReportLogReq |
响应体
Code | Description | Schema |
---|---|---|
200 | A successful response. | v1CreateReportLogResp |
default | An unexpected error response. | rpcStatus |
请求示例
curl --location 'http://xdsdk-bj-qa-reportingbff.xd.cn/xd/reporting/open/v1/player/report' \
--header 'Content-Type: application/json' \
--data '{
"client_info": {
"client_id": "客户端 id",
"ip": "ip",
"device_id": "设备 id"
},
"reporter": {
"xdid": "xdid",
"role_id": "角色 id",
"role_name": "角色 名称",
"server_code": "服务器 id",
"extra": "{\"key\": \"value\"}"
},
"reportee": {
"xdid": "xdid",
"role_id": "角色 id",
"role_name": "角色 名称",
"server_code": "服务器 id",
"extra": "{\"key\": \"value\"}"
},
"reasons": [
{
"id": 0,
"title": "举报原因名称",
"extra": "{\"key\": \"value\"}"
}
],
"evidence": [
{
"name": "上传文件名",
"size_byte": 1024Byte,
"uri": "上传文件地址"
}
],
"user_description": "用户填充内容",
"extras": "{\"key\": \"value\"}"
"sign": "fa42de88de4f0da50f2e5c2918a9389d",
"timestamp": "1720677626",
"nonce": "nonce"
}'
- 注意,
sign
字段不参与签名
/xd/reporting/open/v1/upload/oss_sign_url
GET
Summary:
- 上传举报附属的文件
请求参数
Name | Located in | Description | Required | Schema |
---|---|---|---|---|
client_info.client_id | query | * 必传参数 | No | string |
client_info.ip | query | No | string | |
client_info.device_id | query | * 设备 id | No | string |
xdid | query | No | string | |
file_name | query | No | string | |
file_size | query | No | string (int64) | |
nonce | query | 一次性随机字符串 | yes | string |
timestamp | query | 请求时间戳 | yes | string |
sign | query | 签名 | yes | string |
响应体
Code | Description | Schema |
---|---|---|
200 | A successful response. | v1GetUploadOssSignedUrlResp |
default | An unexpected error response. | rpcStatus |
Models
v1ClientInfo
Name | Type | Description | Required |
---|---|---|---|
client_id | string | No | |
ip | string | No | |
DeviceID | string | No |
v1CreateReportLogReq
Name | Type | Description | Required |
---|---|---|---|
client_info | v1ClientInfo | No | |
reporter | v1User | No | |
reportee | v1User | No | |
reasons | [ v1Reason ] | No | |
evidence | [ v1File ] | No | |
user_description | string | No | |
extras | string | No |
v1CreateReportLogResp
Name | Type | Description | Required |
---|---|---|---|
v1CreateReportLogResp | object |
v1File
Name | Type | Description | Required |
---|---|---|---|
name | string | No | |
size_byte | string (int64) | No | |
uri | string | No |
v1GetUploadOssSignedUrlResp
Name | Type | Description | Required |
---|---|---|---|
signed_url | string | No | |
ttl | string (int64) | No |
v1Reason
Name | Type | Description | Required |
---|---|---|---|
id | string (int64) | No | |
title | string | No | |
extras | string | No |
v1User
Name | Type | Description | Required |
---|---|---|---|
xdid | string | No | |
role_id | string | No | |
server_code | string | No | |
role_name | string | No | |
extra | string | No |
接口签名
sign 字段的签算过程见 s2s md5 加密 小节。