28 lines
870 B
PHP
28 lines
870 B
PHP
|
<?php
|
||
|
namespace app\cmd;
|
||
|
use app\model\Order;
|
||
|
use app\service\CmbService;
|
||
|
use app\service\OrderService;
|
||
|
use think\Collection;
|
||
|
use think\console\Command;
|
||
|
use think\console\Input;
|
||
|
use think\console\Output;
|
||
|
|
||
|
class GetPayOrder extends Command
|
||
|
{
|
||
|
protected function configure()
|
||
|
{
|
||
|
$this->setName('getPayOrder')->setDescription('主动查询支付订单状态');
|
||
|
|
||
|
}
|
||
|
protected function execute(Input $input, Output $output)
|
||
|
{
|
||
|
Order::where(['pay_status' => Order::PAY_STATUS_WAIT])->field('id,order_number')->chunk(100, function (Collection $orderCollection) use (&$output) {
|
||
|
// 未支付订单主动获取订单状态
|
||
|
foreach ($orderCollection as $order) {
|
||
|
CmbService::getPayOrder($order->order_number);
|
||
|
}
|
||
|
});
|
||
|
$output->writeln("主动查询支付订单状态完成");
|
||
|
}
|
||
|
}
|