mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
alarm email add human time
This commit is contained in:
@@ -98,8 +98,7 @@ class Test extends Command
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$interval = 100;
|
$diff = get_setting("system.alarm_email_receiver");
|
||||||
$diff = sprintf("*/%d * * * *", ceil($interval/60));
|
|
||||||
dd($diff);
|
dd($diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ LUA;
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$receiverUid = get_setting("system.alarm_email_receiver");
|
$receiverUid = get_setting("system.alarm_email_receiver");
|
||||||
|
do_log("receiverUid: $receiverUid");
|
||||||
if (empty($receiverUid)) {
|
if (empty($receiverUid)) {
|
||||||
$locale = Locale::getDefault();
|
$locale = Locale::getDefault();
|
||||||
$subject = self::getAlarmEmailSubject($locale);
|
$subject = self::getAlarmEmailSubject($locale);
|
||||||
@@ -282,7 +283,9 @@ LUA;
|
|||||||
"level" => $level,
|
"level" => $level,
|
||||||
"last_time" => $lastTime > 0 ? Carbon::createFromTimestamp($lastTime)->toDateTimeString() : "",
|
"last_time" => $lastTime > 0 ? Carbon::createFromTimestamp($lastTime)->toDateTimeString() : "",
|
||||||
"elapsed_seconds" => $lastTime > 0 ? $now->getTimestamp() - $lastTime : "",
|
"elapsed_seconds" => $lastTime > 0 ? $now->getTimestamp() - $lastTime : "",
|
||||||
|
"elapsed_seconds_human" => $lastTime > 0 ? mkprettytime($now->getTimestamp() - $lastTime) : "",
|
||||||
"interval" => $interval,
|
"interval" => $interval,
|
||||||
|
"interval_human" => mkprettytime($interval),
|
||||||
], $locale);
|
], $locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ return [
|
|||||||
'disable_user_parked' => 'Disable inactive user accounts, parked.',
|
'disable_user_parked' => 'Disable inactive user accounts, parked.',
|
||||||
'destroy_disabled_account' => 'Timed physical deletion of disabled accounts',
|
'destroy_disabled_account' => 'Timed physical deletion of disabled accounts',
|
||||||
'alarm_email_subject' => '[:site_name] background cleanup task exception',
|
'alarm_email_subject' => '[:site_name] background cleanup task exception',
|
||||||
'alarm_email_body' => 'Current time: :now_time, level :level, Last run time was: :last_time, it has been more than: :elapsed_seconds seconds since it was run, the set run interval is: :interval seconds, please check!',
|
'alarm_email_body' => 'Current time: :now_time, level :level, Last run time was: :last_time, it has been more than: :elapsed_seconds seconds(:elapsed_seconds_human) since it was run, the set run interval is: :interval seconds(:interval_human), please check!',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ return [
|
|||||||
'disable_user_parked' => '定时封禁已挂起的非活跃账号.',
|
'disable_user_parked' => '定时封禁已挂起的非活跃账号.',
|
||||||
'destroy_disabled_account' => '定时物理删除已封禁账号',
|
'destroy_disabled_account' => '定时物理删除已封禁账号',
|
||||||
'alarm_email_subject' => '[:site_name]后台清理任务异常',
|
'alarm_email_subject' => '[:site_name]后台清理任务异常',
|
||||||
'alarm_email_body' => '当前时间::now_time, 级别 :level 上次运行时间是::last_time,已经超过::elapsed_seconds 秒没有运行,设置的运行间隔是::interval 秒,请检查!',
|
'alarm_email_body' => '当前时间::now_time, 级别 :level 上次运行时间是::last_time,已经超过::elapsed_seconds 秒(:elapsed_seconds_human)没有运行,设置的运行间隔是::interval 秒(:interval_human),请检查!',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ return [
|
|||||||
'disable_user_parked' => '定時封禁已掛起的非活躍賬號.',
|
'disable_user_parked' => '定時封禁已掛起的非活躍賬號.',
|
||||||
'destroy_disabled_account' => '定時物理刪除已封禁賬號',
|
'destroy_disabled_account' => '定時物理刪除已封禁賬號',
|
||||||
'alarm_email_subject' => '[:site_name]後臺清理任務異常',
|
'alarm_email_subject' => '[:site_name]後臺清理任務異常',
|
||||||
'alarm_email_body' => '當前時間::now_time, 級別 :level 上次運行時間是::last_time,已經超過::elapsed_seconds 秒沒有運行,設置的運行間隔是::interval 秒,請檢查!',
|
'alarm_email_body' => '當前時間::now_time, 級別 :level 上次運行時間是::last_time,已經超過::elapsed_seconds 秒(:elapsed_seconds_human)沒有運行,設置的運行間隔是::interval 秒(:interval_human),請檢查!',
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user