mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 23:42:48 +08:00
- 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
26 lines
534 B
PHP
26 lines
534 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace base\tools\controller\timer;
|
|
|
|
use app\common\controller\TimerController;
|
|
use think\facade\Db;
|
|
|
|
class LogCleanBase extends TimerController
|
|
{
|
|
protected $frequency = 86400;
|
|
|
|
public function do()
|
|
{
|
|
$days = 30;
|
|
$threshold = time() - ($days * 86400);
|
|
|
|
$count = Db::name('system_timer_log')
|
|
->where('create_time', '<', $threshold)
|
|
->delete();
|
|
|
|
return "已清理 {$count} 条超过 {$days} 天的定时器执行日志。";
|
|
}
|
|
}
|