You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace App\Console;
use App\Models\Notifications;
use App\Models\OrderItems;
use App\Models\Orders;
use App\Models\Refund;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Support\Facades\Log;
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)
{
//$schedule->command('inspire')->hourly();
$schedule->command('order-items:create-daily')->everyMinute();
$schedule->command('sync-recharge-pay-state:weixin')->everyMinute();
$schedule->command('sync-recharge-pay-state:alipay')->everyMinute();
//自动扣款下午两点开始扣款每小时可处理3000个子订单每天可以处理30000个子订单
$schedule->call(function () {
(new OrderItems())->autoCheckout();
})->everyMinute()->timezone('Asia/Shanghai')->between('14:00', '23:59');
//自动退款
$schedule->call(function () {
(new Refund())->autoRefund();
})->everyMinute();
//自动生成日志文件,配合系统层面定时更新文件权限,避免临时生成后的权限问题
$schedule->call(function () {
Log::info('auto generate log file');
})->daily();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__ . '/Commands');
require base_path('routes/console.php');
}
}