Compare commits
2 Commits
0d27e98d09
...
3bac8be70e
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bac8be70e | |||
| a927388388 |
@@ -203,12 +203,15 @@ async def get_alert(
|
||||
if not alarm_dict:
|
||||
raise HTTPException(status_code=404, detail="告警不存在")
|
||||
|
||||
# 查询单个摄像头名称
|
||||
# 查询单个摄像头信息
|
||||
device_id = alarm_dict.get("device_id")
|
||||
camera_service = get_camera_name_service()
|
||||
name_map = {device_id: await camera_service.get_display_name(device_id)} if device_id else {}
|
||||
camera_info_map = {}
|
||||
if device_id:
|
||||
camera_info = await camera_service.get_camera_info(device_id)
|
||||
camera_info_map[device_id] = camera_info
|
||||
|
||||
return YudaoResponse.success(await _alarm_to_camel(alarm_dict, name_map))
|
||||
return YudaoResponse.success(await _alarm_to_camel(alarm_dict, camera_info_map, camera_service))
|
||||
|
||||
|
||||
@router.put("/alert/handle")
|
||||
|
||||
@@ -570,6 +570,11 @@ class AlarmEventService:
|
||||
alarm.handle_status = "DONE"
|
||||
alarm.handle_remark = "非工作时间自动关闭"
|
||||
alarm.handled_at = datetime.now(timezone.utc)
|
||||
elif resolve_type == "intrusion_cleared":
|
||||
alarm.alarm_status = "CLOSED"
|
||||
alarm.handle_status = "DONE"
|
||||
alarm.handle_remark = "入侵消失自动关闭(持续无人180秒)"
|
||||
alarm.handled_at = datetime.now(timezone.utc)
|
||||
|
||||
alarm.updated_at = datetime.now(timezone.utc)
|
||||
db.commit()
|
||||
|
||||
Reference in New Issue
Block a user