41 行
1.1 KiB
PHP
41 行
1.1 KiB
PHP
<?php
|
|
|
|
namespace addons\shopro_huifu\command;
|
|
|
|
use addons\shopro\library\split\Config;
|
|
use addons\shopro\model\split\SplitOrder;
|
|
use addons\shopro_huifu\library\HuifuSplitService;
|
|
use think\console\Command;
|
|
use think\console\Input;
|
|
use think\console\Output;
|
|
|
|
class SplitRetry extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
$this->setName('shopro_huifu:split-retry')->setDescription('Retry failed Huifu split confirm orders');
|
|
}
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
{
|
|
$config = new Config();
|
|
if (!$config->isEnable()) {
|
|
$output->writeln('Split disabled.');
|
|
return;
|
|
}
|
|
|
|
$rows = SplitOrder::where('channel', 'huifu')
|
|
->where('status', 4)
|
|
->where('retry_count', '<', $config->getRetryMax())
|
|
->where('next_retry_time', '<=', time())
|
|
->limit(20)
|
|
->select();
|
|
|
|
$service = new HuifuSplitService();
|
|
foreach ($rows as $row) {
|
|
$service->retry($row['id']);
|
|
}
|
|
$output->writeln('Huifu split retry finished.');
|
|
}
|
|
}
|