外观
支付宝敏感词检查(必接)
644 字约 2 分钟
2026-08-19
说明
本接口用于对玩家输入的文本或图片进行内容安全检测(敏感词、色情、暴恐、违禁、谩骂等),支付宝渠道通用。
服务端统一调用支付宝内容安全接口,客户端不需要传任何密钥。
注意
有文字输入功能的游戏,务必在发送前通过此接口进行内容过滤,避免因敏感词问题遭到平台封禁。
输入
| 参数 | 类型 | 必传 | 描述 |
|---|---|---|---|
| content | String | 是(与 data_list 二选一) | 待检测内容:纯文本或图片 URL |
| tenants | String | 是 | 内容场景,见下方枚举 |
| options | Object | 否 | 可选参数对象,见下方说明 |
tenants 场景枚举
| 值 | 含义 |
|---|---|
| private_chat | 好友聊天、好友申请、个人留言等私聊 |
| public_chat | 群聊、战队、世界等公共频道 |
| user_info | 个人、宠物、战队、公会等资料 |
| game_content | 运营文案、角色图片等游戏素材 |
| other | 其他 |
options 可选参数
| 字段 | 类型 | 描述 |
|---|---|---|
| content_type | String | TEXT 或 PICTURE。不传则自动判断:content 以 http 开头视为图片,否则文本 |
| products | String | 检测产品码,逗号分隔。不传则五项全检 |
| data_list | String[] | 数组,替代 content,只支持 1 条 |
products 检测项
| 值 | 含义 |
|---|---|
| TJ_POLITICS_MC | 敏感 |
| TJ_PORN_MC | 色情 |
| TJ_ILLEGAL_MC | 违禁 |
| TJ_TERRORISM_MC | 暴恐 |
| TJ_ABUSES_MC | 谩骂 |
输出
| 参数 | 类型 | 描述 |
|---|---|---|
| code | Number | 1000 表示成功 |
| msg | String | 响应消息 |
| data | Object | code 为 1000 时返回,详见下方 |
data 字段
| 字段 | 类型 | 描述 |
|---|---|---|
| suggestion | String | 客户端按此字段判断:pass 放行 / block 拦截 / review 复核 |
| request_id | String | 本次检测请求号 |
| result_code | String | 业务码,成功为 OK |
| detect_check_labels | Object / null | 命中的风险标签,无风险时为 null |
客户端判断逻辑
if (code != 1000) -> 请求失败,可提示稍后重试
if (suggestion == "pass") -> 放行,允许发送
if (suggestion == "block") -> 拦截,不展示/不发送
if (suggestion == "review")-> 人工复核,按产品策略处理示例代码
文本检测(聊天)
let content = "要检测的聊天内容";
let tenants = "public_chat"; // 公共频道
mzfSdk.contentDetect(content, tenants).then(res => {
console.log(JSON.stringify(res));
if (res.code === 1000 && res.data) {
if (res.data.suggestion === "pass") {
// 放行,发送消息
} else if (res.data.suggestion === "block") {
// 拦截,提示用户内容违规
} else if (res.data.suggestion === "review") {
// 需人工复核
}
}
});图片检测(头像/资料)
let imageUrl = "https://example.com/avatar.png";
let tenants = "user_info"; // 用户资料
mzfSdk.contentDetect(imageUrl, tenants, { content_type: "PICTURE" }).then(res => {
console.log(JSON.stringify(res));
});指定检测项
let content = "要检测的内容";
let tenants = "private_chat"; // 私聊
// 只检测谩骂和色情
mzfSdk.contentDetect(content, tenants, {
products: "TJ_ABUSES_MC,TJ_PORN_MC"
}).then(res => {
console.log(JSON.stringify(res));
});