|
|
|
|
@ -50,7 +50,8 @@ class CameraMonitorSyncCommand extends Command
|
|
|
|
|
if (! $alert) {
|
|
|
|
|
$alert = CameraAlert::create(['camera_device_id' => $camera->id, 'venue_id' => $camera->venue_id, 'alert_type' => $alertType, 'status' => 'OPEN', 'severity' => $needsManual ? 'critical' : 'warning', 'title' => $needsManual ? '摄像头需要人工处理' : '摄像头状态异常', 'reason' => $reason, 'first_occurred_at' => now(), 'last_occurred_at' => now()]);
|
|
|
|
|
} else { $alert->update(['last_occurred_at' => now(), 'reason' => $reason]); }
|
|
|
|
|
if ($needsManual && $camera->notification_enabled && $settings->send_manual_action_email && (int) $alert->notification_count === 0) $this->notify($alert, $camera, $settings);
|
|
|
|
|
$alreadySent = $alert->notifications()->where('channel', 'email')->where('send_status', 'sent')->exists();
|
|
|
|
|
if ($needsManual && $camera->notification_enabled && $settings->send_manual_action_email && ! $alreadySent) $this->notify($alert, $camera, $settings);
|
|
|
|
|
});
|
|
|
|
|
return self::SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|