ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ <?php namespace App\Console; use App\Models\VipRecord; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; use Illuminate\Support\Facades\Log; class Kernel extends ConsoleKernel { protected function scheduleTimezone() { return config('app.timezone'); } /** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { // $schedule->command('inspire')->hourly(); /********************************* 每分钟执行一次任务 ******************************************/ $schedule->call(function (){ VipRecord::clearExpiredVip(); /*清理过期的vip*/ })->everyMinute(); /********************************* 每小时执行一次任务 ******************************************/ $schedule->call(function (){ //Your code })->hourly(); /********************************* 每天 00:00 执行一次任务 ******************************************/ $schedule->call(function (){ //Your code })->daily(); } /** * Register the commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__.'/Commands'); require base_path('routes/console.php'); } } ~~~ ``` su -c "cd /www/wwwroot/admin && php artisan schedule:run >> /dev/null 2>&1" -s /bin/sh www ```