All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m55s
70 lines
2.0 KiB
Markdown
70 lines
2.0 KiB
Markdown
# 资产审计日志接口回放示例
|
||
|
||
以下示例用于构造 success / failed / denied 三类日志数据。请替换 `<token>`、`<identifier>`、`<device_id>`、`<card_id>` 等占位符。
|
||
|
||
## 1. success 示例
|
||
|
||
### 1.1 设备限速(`device_speed_limit`)
|
||
|
||
```bash
|
||
curl -X POST "http://127.0.0.1:8080/api/admin/devices/<identifier>/speed-limit" \
|
||
-H "Authorization: Bearer <token>" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"speed_limit":1024}'
|
||
```
|
||
|
||
### 1.2 资产轮询开关(`asset_polling_status`)
|
||
|
||
```bash
|
||
curl -X PATCH "http://127.0.0.1:8080/api/admin/assets/<identifier>/polling-status" \
|
||
-H "Authorization: Bearer <token>" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"enable_polling":false}'
|
||
```
|
||
|
||
## 2. denied 示例
|
||
|
||
### 2.1 保护期内停机(`device_stop` / `card_manual_stop`)
|
||
|
||
```bash
|
||
curl -X POST "http://127.0.0.1:8080/api/admin/assets/<identifier>/stop" \
|
||
-H "Authorization: Bearer <token>"
|
||
```
|
||
|
||
若命中保护期规则,应返回拒绝并写入 `result_status=denied`。
|
||
|
||
### 2.2 越权分配设备(`device_allocate`)
|
||
|
||
```bash
|
||
curl -X POST "http://127.0.0.1:8080/api/admin/devices/allocate" \
|
||
-H "Authorization: Bearer <agent-token>" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"target_shop_id":999999,"device_ids":[1,2,3],"remark":"审计验收"}'
|
||
```
|
||
|
||
## 3. failed 示例
|
||
|
||
### 3.1 无效设备标识触发远程控制失败(`device_reboot`)
|
||
|
||
```bash
|
||
curl -X POST "http://127.0.0.1:8080/api/admin/devices/<invalid-identifier>/reboot" \
|
||
-H "Authorization: Bearer <token>"
|
||
```
|
||
|
||
### 3.2 导入任务入队失败(`device_import_task_create` / `iot_card_import_task_create`)
|
||
|
||
通过临时关闭队列依赖或传入无效参数触发失败,确认写入 `result_status=failed` 和错误摘要。
|
||
|
||
## 4. 结果核对
|
||
|
||
执行完回放后,使用:
|
||
|
||
- `docs/add-asset-operation-audit-log/手工验收脚本.sql`
|
||
|
||
重点核对:
|
||
|
||
1. 同一操作存在 success/failed/denied
|
||
2. `before_data` 与 `after_data` 有效
|
||
3. WiFi 密码字段为掩码
|
||
4. 批量字段 `batch_total/success_count/fail_count` 合理
|