33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
||
|
||
namespace App\Console\Commands;
|
||
|
||
use Illuminate\Console\Command;
|
||
use Modules\EcommerceFinance\Services\AccountMappingStore;
|
||
|
||
/**
|
||
* 把科目映射表的旧文件存储(storage/app/account-mapping/rules.json / events.json)
|
||
* 导入共享系统数据库(ec_account_mapping_rules / ec_account_mapping_events)。
|
||
*
|
||
* 幂等:以文件为准覆盖数据库内容,可重复执行。
|
||
*/
|
||
class ImportAccountMappingFiles extends Command
|
||
{
|
||
protected $signature = 'account-mapping:import-files {--events : 一并导入操作记录}';
|
||
|
||
protected $description = '把科目映射表的旧文件存储导入共享数据库';
|
||
|
||
public function handle(AccountMappingStore $store): int
|
||
{
|
||
$result = $store->syncFromFiles((bool) $this->option('events'));
|
||
|
||
$this->info(
|
||
'已导入规则 ' . $result['rules'] . ' 条'
|
||
. ($result['events'] > 0 ? ',操作记录 ' . $result['events'] . ' 条' : '')
|
||
. '。'
|
||
);
|
||
|
||
return self::SUCCESS;
|
||
}
|
||
}
|