feat: enrich webhook payloads with downstream event table fields

Add missing fields (event_code, camera_ip, started_at, ended_at,
dwell_seconds, is_discarded, alerted_at, etc.) to both batch_event
and case_event payloads. Introduce source_id config for payload
injection and infer_camera_ip to extract IP from RTSP stream URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 17:04:58 +08:00
parent e919ffd561
commit 45e2cf70f7
8 changed files with 193 additions and 17 deletions

View File

@@ -200,6 +200,7 @@ path = "logs/webhook_retry.jsonl"
enabled = true
event_url = "https://example.com/runtime-events"
case_url = "https://example.com/case-events"
source_id = "cold-display-guard"
callback_token = "shared-secret"
connect_timeout_seconds = 3
read_timeout_seconds = 5
@@ -223,6 +224,16 @@ retry_max_backoff_seconds = 1800
相关 webhook 字段:
- `event_code`:下游事件列表可直接使用的稳定编码,当前取批次 ID
- `camera_id` / `camera_ip`:来源设备和摄像头 IP
- `zone_id` / `zone_label`:所属区域
- `started_at`:开始计时时间点
- `ended_at` / `removed_at`:取出时间点
- `dwell_seconds`:当前批次累计计时时长
- `is_discarded` / `discarded_at`:是否已丢弃及丢弃时间点
- `created_at`:该条外部事件记录的创建时间
- `alerted_at` / `alarm_at`:时长告警时间点
- `updated_at`:该条外部事件记录的最新更新时间
- `snapshot_upload_status``uploaded``error`
- `snapshot_object_key`:上传成功后的 OSS 路径
- `snapshot_file_name`:上传文件名