CaiWuXiTong/app/Console/Commands/SyncInternalFlowCompanies.php

36 lines
1.0 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Modules\EcommerceFinance\Services\InternalFlowWorkbookImporter;
use Throwable;
class SyncInternalFlowCompanies extends Command
{
protected $signature = 'internal-flow:sync-companies';
protected $description = '将内部流转配置公司补齐到当前数据集,并同步其固定标签';
public function handle(InternalFlowWorkbookImporter $importer): int
{
try {
$result = $importer->syncConfiguredCompanies();
} catch (Throwable $exception) {
report($exception);
$this->error('内部流转公司标签同步失败:' . $exception->getMessage());
return self::FAILURE;
}
$this->info(sprintf(
'内部流转公司标签同步完成:新增 %s 家,更新 %s 家,配置共 %s 家。',
number_format($result['inserted']),
number_format($result['updated']),
number_format($result['total']),
));
return self::SUCCESS;
}
}