CaiWuXiTong/app/Console/Commands/ImportTaobaoAlipayBills.php
chenxi 1751d8e062 接入淘系支付宝账单副本库全量数据 (#208)
使用经营分析副本库作为全量分页、筛选、汇总与导出主数据源;演示表仅按记录编码补充源表缺失字段。验证:47 项 PHP 测试、435 assertions;6 项账户账单脚本测试;真实页面全量及日期筛选验收通过。
2026-09-19 01:52:45 +08:00

39 lines
1.3 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Business\TaobaoAlipayBillSpreadsheetImporter;
use Illuminate\Console\Command;
use Throwable;
class ImportTaobaoAlipayBills extends Command
{
protected $signature = 'business:import-taobao-alipay-bills
{file : 淘系支付宝账户 Excel 文件路径}
{--company=1 : 数据所属公司 ID}
{--replace : 校验通过后替换该公司的全部淘系支付宝账单}';
protected $description = '从标准附件导入店铺收款账户账单的淘系支付宝账户数据';
public function handle(TaobaoAlipayBillSpreadsheetImporter $importer): int
{
try {
$result = $importer->import(
(string) $this->argument('file'),
max(1, (int) $this->option('company')),
(bool) $this->option('replace'),
);
} catch (Throwable $e) {
$this->components->error($e->getMessage());
return self::FAILURE;
}
$this->components->info(
"导入完成:新增 {$result['inserted']} 条,更新 {$result['updated']} 条,替换旧数据 {$result['replaced']} 条,跳过 {$result['skipped']} 条。"
);
return self::SUCCESS;
}
}