feat(shopro_huifu): 添加汇付进件自动提交功能 - 新增自动提交开关配置项,支持定时自动提交汇付进件 - 添加失败重提间隔配置,支持失败后指定时间自动重试 - 创建OnboardAutoSubmit命令类,实现自动提交逻辑 - 在进件页面更新提示信息,说明自动提交流程 - 同步更新数据库配置表结构和升级脚本 ```
40 行
1.4 KiB
PHP
40 行
1.4 KiB
PHP
<?php
|
|
|
|
namespace addons\shopro_huifu\command;
|
|
|
|
use addons\shopro_huifu\library\onboard\HuifuOnboardAutoSubmit;
|
|
use think\console\Command;
|
|
use think\console\Input;
|
|
use think\console\input\Option;
|
|
use think\console\Output;
|
|
|
|
class OnboardAutoSubmit extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
$this->setName('shopro_huifu:onboard-auto-submit')
|
|
->addOption('limit', 'l', Option::VALUE_OPTIONAL, '每轮最多处理条数', 30)
|
|
->addOption('dry-run', null, Option::VALUE_NONE, '只扫描不调用汇付')
|
|
->setDescription('Auto submit Huifu onboard: new drafts immediately, failed retry after cooldown');
|
|
}
|
|
|
|
protected function execute(Input $input, Output $output)
|
|
{
|
|
$dryRun = (bool) $input->getOption('dry-run');
|
|
$limit = intval($input->getOption('limit'));
|
|
$output->writeln('=== 汇付进件自动提交 ===' . ($dryRun ? ' [dry-run]' : ''));
|
|
|
|
$stats = (new HuifuOnboardAutoSubmit())->run($limit, $dryRun);
|
|
$output->writeln('扫描: ' . $stats['scanned']);
|
|
$output->writeln('首次提交: ' . $stats['submit_now']);
|
|
$output->writeln('失败重提: ' . $stats['retry']);
|
|
$output->writeln('跳过: ' . $stats['skipped']);
|
|
$output->writeln('执行失败: ' . $stats['failed']);
|
|
foreach ($stats['details'] as $line) {
|
|
$output->writeln(' · ' . $line);
|
|
}
|
|
|
|
return $stats['failed'] > 0 ? 1 : 0;
|
|
}
|
|
}
|