25 lines
821 B
PHP
25 lines
821 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Modules\EcommerceFinance\Services\AccountBillsExportTasks;
|
|
|
|
class RunAccountBillsExportQueue extends Command
|
|
{
|
|
protected $signature = 'account-bills:exports:run {--max-jobs=1}';
|
|
protected $description = '依次消费账单导出任务,生产从受限批容器启动';
|
|
|
|
public function handle(AccountBillsExportTasks $tasks): int
|
|
{
|
|
$limit = max(0, (int) $this->option('max-jobs'));
|
|
for ($processed = 0; $limit === 0 || $processed < $limit; $processed++) {
|
|
$task = $tasks->nextQueued();
|
|
if ($task === null) break;
|
|
$code = $this->call('account-bills:export-run', ['token' => $task['token']]);
|
|
if ($code === 75) break;
|
|
}
|
|
return self::SUCCESS;
|
|
}
|
|
}
|