vd/app/Console/Kernel.php
2019-06-03 10:44:03 +08:00

52 lines
1.5 KiB
PHP

<?php
namespace App\Console;
use App\Jobs\QueuedCommand;
use Illuminate\Support\Facades\DB;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$logPath = storage_path('logs/artisan.log');
$schedule->command('real:sync-activated')->cron('* */4 * * *')->withoutOverlapping()->appendOutputTo($logPath);
$schedule->command('virtual:schedule-auto-activate')->cron('* * * 1 *')->withoutOverlapping()->appendOutputTo($logPath);
// $schedule->command('virtual:schedule-vd-activate')->cron('0 2 * * *')->withoutOverlapping()->appendOutputTo($logPath);
$schedule->call(function () {
DB::select('refresh materialized view ckb_order_cards');
})->cron('* */4 * * *')->withoutOverlapping()->appendOutputTo($logPath);
}
/**
* Queue the given console command.
*
* @param string $command
* @param array $parameters
* @return void
*/
public function queue($command, array $parameters = [])
{
dispatch(new QueuedCommand(func_get_args()));
}
}