erp-backend/app/Console/Kernel.php
2026-04-01 17:07:04 +08:00

77 lines
2.2 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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');
}
}