💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ <?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 ```