From 5bf28acf95fc04cd3b8df225b61bcd73c9dc214b Mon Sep 17 00:00:00 2001 From: lemon <15040771@qq.com> Date: Mon, 13 Sep 2021 23:57:47 +0800 Subject: [PATCH] 1 --- app/Console/Commands/BalanceDue.php | 47 +++++++++++++------------- app/Console/Commands/DemandTimeout.php | 1 - app/Console/Kernel.php | 2 +- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/app/Console/Commands/BalanceDue.php b/app/Console/Commands/BalanceDue.php index ea03d66..56c54d0 100644 --- a/app/Console/Commands/BalanceDue.php +++ b/app/Console/Commands/BalanceDue.php @@ -43,29 +43,28 @@ class BalanceDue extends Command */ public function handle() { - Log::info(111); - //if (env('SMS_SWITCH' , '') == true) { - // $orders = Order::query() - // ->where('status', OrderStatus::PAY_EARNEST) - // ->get(); - // $sms = new SmsService(); - // foreach ($orders as $order) { - // if (!empty($order->mobile)) { - // $sms->send( - // 'pay', - // [ - // $order->order_no, - // '定金/订金', - // $order->timeout, - // '定金/订金', - // '小程序' - // ], - // [ - // $order->mobile - // ], - // ); - // } - // } - //} + if (env('SMS_SWITCH' , '') == true) { + $orders = Order::query() + ->where('status', OrderStatus::PAY_EARNEST) + ->get(); + $sms = new SmsService(); + foreach ($orders as $order) { + if (!empty($order->mobile)) { + $sms->send( + 'pay', + [ + $order->order_no, + '定金/订金', + $order->timeout, + '定金/订金', + '小程序' + ], + [ + $order->mobile + ], + ); + } + } + } } } diff --git a/app/Console/Commands/DemandTimeout.php b/app/Console/Commands/DemandTimeout.php index 74d525d..e0b00b3 100644 --- a/app/Console/Commands/DemandTimeout.php +++ b/app/Console/Commands/DemandTimeout.php @@ -40,7 +40,6 @@ class DemandTimeout extends Command */ public function handle() { - Log::info(222); //Log::info('定时任务'); Demand::query() ->where('deadline','<=' ,now()) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 81ef277..cc7d34a 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -27,7 +27,7 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule) { $schedule->command('demand:timeout')->everyMinute(); - $schedule->command('balance:due')->everyMinute(); + $schedule->command('balance:due')->dailyAt('00:00'); // $schedule->command('inspire')->hourly(); }