1
0
Fork 0

调整报警内容

main
vine_liutk 2023-09-07 12:29:08 +08:00
parent 4f5ce5642d
commit 31a296f98a
1 changed files with 12 additions and 11 deletions

View File

@ -147,17 +147,18 @@ class DeviceWarningService
$msg = $fieldNameMap[$column].'达到'.($log->$column ?? 0).$fieldUnitMap[$column].'值'; $msg = $fieldNameMap[$column].'达到'.($log->$column ?? 0).$fieldUnitMap[$column].'值';
} }
} }
if($msg){
$notices[] = [ $notices[] = [
'device_id' => $device->id, 'device_id' => $device->id,
'lv' => $lv, 'lv' => $lv,
'content' => '【'.$device->name.'】【'.WarningNotice::lvMap()[$lv].'】'.$msg, 'content' => '【'.$device->name.'】【'.WarningNotice::lvMap()[$lv].'】'.$msg,
'reported_at' => $reportedAt, 'reported_at' => $reportedAt,
'created_at' => now(), 'created_at' => now(),
'updated_at' => now(), 'updated_at' => now(),
'loggable_type' => $log::class, 'loggable_type' => $log::class,
'loggable_id' => $log->id, 'loggable_id' => $log->id,
]; ];
}
} }
count($notices) > 0 && WarningNotice::insert($notices); count($notices) > 0 && WarningNotice::insert($notices);