77 lines
2.2 KiB
PHP
77 lines
2.2 KiB
PHP
<?php
|
||
|
||
namespace App\Console;
|
||
|
||
use Illuminate\Console\Scheduling\Schedule;
|
||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||
|
||
class Kernel extends ConsoleKernel
|
||
{
|
||
/**
|
||
* 注册的命令
|
||
*/
|
||
protected $commands = [
|
||
\App\Console\Commands\PullOrdersCommand::class,
|
||
\App\Console\Commands\MatchSkuCommand::class,
|
||
\App\Console\Commands\RetrySyncCommand::class,
|
||
\App\Console\Commands\CleanPullRecordsCommand::class,
|
||
\App\Console\Commands\CheckPrintPluginUpdates::class,
|
||
];
|
||
|
||
/**
|
||
* 定义任务调度
|
||
*/
|
||
protected function schedule(Schedule $schedule)
|
||
{
|
||
// 淘宝订单拉取,每10分钟一次,避开凌晨
|
||
$schedule->command('orders:pull taobao')
|
||
->everyTenMinutes()
|
||
->between('6:00', '23:00')
|
||
->withoutOverlapping()
|
||
->runInBackground();
|
||
|
||
// 京东订单拉取
|
||
$schedule->command('orders:pull jd')
|
||
->everyFifteenMinutes()
|
||
->withoutOverlapping()
|
||
->runInBackground();
|
||
|
||
// 拼多多订单拉取
|
||
$schedule->command('orders:pull pdd')
|
||
->everyFifteenMinutes()
|
||
->withoutOverlapping()
|
||
->runInBackground();
|
||
|
||
// SKU自动匹配,每5分钟
|
||
$schedule->command('orders:match-sku')
|
||
->everyFiveMinutes()
|
||
->withoutOverlapping()
|
||
->runInBackground();
|
||
|
||
// 重试回传,每小时
|
||
$schedule->command('orders:retry-sync')
|
||
->hourly()
|
||
->withoutOverlapping()
|
||
->runInBackground();
|
||
|
||
// 清理拉取记录,每天凌晨3点
|
||
$schedule->command('orders:clean-records')
|
||
->dailyAt('03:00')
|
||
->withoutOverlapping();
|
||
|
||
// 检测打印插件更新,每小时一次
|
||
$schedule->command('print-plugin:check-updates')
|
||
->hourly()
|
||
->withoutOverlapping()
|
||
->runInBackground();
|
||
}
|
||
|
||
/**
|
||
* 注册命令
|
||
*/
|
||
protected function commands()
|
||
{
|
||
$this->load(__DIR__.'/Commands');
|
||
require base_path('routes/console.php');
|
||
}
|
||
} |