28 lines
827 B
PHP
28 lines
827 B
PHP
|
<?php
|
||
|
namespace app\cmd;
|
||
|
use app\model\Order;
|
||
|
use app\service\RechargeService;
|
||
|
use think\Collection;
|
||
|
use think\console\Command;
|
||
|
use think\console\Input;
|
||
|
use think\console\Output;
|
||
|
|
||
|
class QueryRechargeOrder extends Command
|
||
|
{
|
||
|
protected function configure()
|
||
|
{
|
||
|
$this->setName('queryRechargeOrder')->setDescription('主动拉取充值订单状态');
|
||
|
|
||
|
}
|
||
|
protected function execute(Input $input, Output $output)
|
||
|
{
|
||
|
Order::where(['order_status' => Order::STATUS_RECHARGE_ING])->field('*')->chunk(100, function (Collection $orderCollection) use (&$output) {
|
||
|
foreach ($orderCollection as $collection) {
|
||
|
(new RechargeService())->queryRechargeOrder($collection['order_number']);
|
||
|
}
|
||
|
});
|
||
|
$output->writeln("主动拉取充值订单状态完成");
|
||
|
}
|
||
|
|
||
|
}
|