From e1bf94a55e7edb9be61779d08c1c71becbe72ae9 Mon Sep 17 00:00:00 2001 From: augushong Date: Tue, 26 May 2026 17:20:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(timer):=20=E6=96=B0=E5=A2=9E=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=AF=8F=E6=97=A5=E8=87=AA=E5=8A=A8=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New LogClean timer controller (site type, frequency 86400s) - run_type defaults to auto, only one node cleans per day - Cleans system_timer_log records older than 30 days --- app/tools/controller/timer/LogClean.php | 11 ++++++++ extend/base/common/command/timer/config.php | 7 ++++++ .../tools/controller/timer/LogCleanBase.php | 25 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 app/tools/controller/timer/LogClean.php create mode 100644 extend/base/tools/controller/timer/LogCleanBase.php diff --git a/app/tools/controller/timer/LogClean.php b/app/tools/controller/timer/LogClean.php new file mode 100644 index 0000000..d3667e1 --- /dev/null +++ b/app/tools/controller/timer/LogClean.php @@ -0,0 +1,11 @@ + 600, 'concurrency' => 1, ], + [ + 'name' => 'timer_log_clean', + 'type' => 'site', + 'target' => '/tools/timer.LogClean/do', + 'frequency' => 86400, + 'concurrency' => 1, + ], ]; diff --git a/extend/base/tools/controller/timer/LogCleanBase.php b/extend/base/tools/controller/timer/LogCleanBase.php new file mode 100644 index 0000000..9ab6850 --- /dev/null +++ b/extend/base/tools/controller/timer/LogCleanBase.php @@ -0,0 +1,25 @@ +where('create_time', '<', $threshold) + ->delete(); + + return "已清理 {$count} 条超过 {$days} 天的定时器执行日志。"; + } +}