init_npc 时将被拒绝连接。https://hippo.adventists.cn/api| Header | 类型 | 必填 | 说明 |
|---|---|---|---|
api_key | string | 是 | 32 位 API 密钥 |
org_id | string | 是 | 6 位组织 ID |
401:{
"message": "Invalid API KEY or ORG ID"
}| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /api/device/block | 封禁设备/角色 |
| POST | /api/device/unblock | 解封设备/角色 |
| GET | /api/device/blocklist | 查询封禁列表 |
| GET | /api/device/block/check | 查询单个封禁状态 |
init_npc 时会被拒绝。POST /api/device/block{
"type": "device",
"identifier": "ABC123",
"reason": "违规使用"
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 是 | "device" 或 "npc" |
| identifier | string | 是 | 设备 ID 或角色 ID(npcid) |
| reason | string | 否 | 封禁原因 |
当 type为"npc"时,identifier必须属于当前组织(即identifier前 6 位与org_id一致),否则返回403。
{
"ok": true,
"block_key": "device:ABC123"
}{
"ok": false,
"error": "Missing required field: type"
}{
"ok": false,
"error": "Cannot block NPC belonging to another org"
}POST /api/device/unblock{
"type": "device",
"identifier": "ABC123"
}| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 是 | "device" 或 "npc" |
| identifier | string | 是 | 设备 ID 或角色 ID |
{
"ok": true
}{
"ok": false,
"error": "Block record not found"
}{
"ok": false,
"error": "Cannot unblock record owned by another org"
}GET /api/device/blocklist| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 否 | 按类型过滤:"device" 或 "npc",不传则返回全部 |
{
"ok": true,
"items": [
{
"block_key": "device:ABC123",
"type": "device",
"identifier": "ABC123",
"created_at": "2026-04-10T15:30:00Z",
"created_by": "WOQSOC",
"reason": "违规使用"
},
{
"block_key": "npc:WOQSOC7a8b9c1d2e3f4a5b6c7d8e9f0a1b2c3d",
"type": "npc",
"identifier": "WOQSOC7a8b9c1d2e3f4a5b6c7d8e9f0a1b2c3d",
"created_at": "2026-04-10T16:00:00Z",
"created_by": "WOQSOC",
"reason": "角色停用"
}
]
}GET /api/device/block/check| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 是 | "device" 或 "npc" |
| identifier | string | 是 | 设备 ID 或角色 ID |
{
"ok": true,
"blocked": true,
"detail": {
"reason": "违规使用",
"created_at": "2026-04-10T15:30:00Z",
"created_by": "WOQSOC"
}
}{
"ok": true,
"blocked": false
}init_npc 接口新增可选参数 device_id,并在初始化前进行封禁检查。| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| npcid | string | 是 | 角色 ID |
| lang | string | 否 | 语言设置 |
| device_id | string | 否 | 设备 ID(新增,不传时跳过设备维度的封禁检查) |
device_id,检查该设备是否被封禁npcid 是否被封禁init_npc 返回(HTTP 200):{
"status": "blocked",
"reason": "设备已被封禁"
}status 字段值为 "blocked" 判断连接被拒绝。{
"message": "NPC xxx initialized successfully",
"status": "success",
"code": 200
}| HTTP 状态码 | 说明 |
|---|---|
| 200 | 请求成功 |
| 400 | 参数错误(缺少 type 或 identifier,type 值无效) |
| 401 | api_key 或 org_id 无效 |
| 403 | 无权限(尝试操作其他组织的 NPC) |
| 404 | 未找到(unblock 时封禁记录不存在) |
| 500 | 服务端错误 |