order-food-admin/app/Console/Commands/FinishReserveOrder.php

53 lines
1.1 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Carbon\Carbon;
use App\Models\Order;
class FinishReserveOrder extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'milk-tea:finish_reserve_order';
/**
* The console command description.
*
* @var string
*/
protected $description = '自动过期两个星期的预约订单';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$list = Order::where([
'is_reserve'=>1,
'order_status'=>1,
'pay_status'=>1,
])->where('reserve_time', Carbon::now()->subDays(14)->startOfDay())
->whereNull('order_number')->update(['shipping_status'=>1]);
$this->info('执行成功');
}
}