57 lines
2.2 KiB
PHP
57 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Console;
|
|
|
|
use Carbon\Carbon;
|
|
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(sprintf('real:sync-activated %s', Carbon::now()->subDays(2)->format('Y-m-d')))->cron('0 3 * * *')->withoutOverlapping()->appendOutputTo($logPath);
|
|
$schedule->command(sprintf('real:sync-activated %s', Carbon::now()->subDays(3)->format('Y-m-d')))->cron('0 3 * * *')->withoutOverlapping()->appendOutputTo($logPath);
|
|
$schedule->command(sprintf('real:sync-activated %s', Carbon::now()->subDays(4)->format('Y-m-d')))->cron('0 3 * * *')->withoutOverlapping()->appendOutputTo($logPath);
|
|
$schedule->command(sprintf('real:sync-activated %s', Carbon::now()->subDays(5)->format('Y-m-d')))->cron('0 3 * * *')->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('0 2 * * *')->name('refresh_ckb_order_cards')->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()));
|
|
}
|
|
}
|