diff --git a/server/app/command/GancaoSyncLogisticsRoute.php b/server/app/command/GancaoSyncLogisticsRoute.php index ac986310..5b7da05b 100755 --- a/server/app/command/GancaoSyncLogisticsRoute.php +++ b/server/app/command/GancaoSyncLogisticsRoute.php @@ -22,14 +22,14 @@ use think\console\Output; * zyt_express_tracking + zyt_express_trace + zyt_express_state_log + zyt_express_query_log * * 使用方法: - * php think gancao:sync-logistics 默认拉 100 单 - * php think gancao:sync-logistics --limit=200 自定义拉取上限 + * php think gancao:sync-logistics 默认拉 2000 单(跳过已完成/已签收) + * php think gancao:sync-logistics --limit=500 自定义拉取上限 * php think gancao:sync-logistics --order-id=123 只跑指定订单 * php think gancao:sync-logistics -t SF1234567890 按快递单号走快递100 查询并落库 * php think gancao:sync-logistics --detail 打印每单详细 * * 建议 crontab(每 30 分钟执行一次): - * 0,30 * * * * cd /path/to/server && php think gancao:sync-logistics --limit=200 >> runtime/log/gancao_sync.log 2>&1 + * 0,30 * * * * cd /path/to/server && php think gancao:sync-logistics >> runtime/log/gancao_sync.log 2>&1 * * 跳过履约状态为已完成(3)、已签收(6) 的业务订单,不再拉取甘草路由。 * 已对「业务订单创建人非二中心」(发货/签收自动释放规则见 ExpressTrackingService)的诊单会写入 tcm_diagnosis.shipped_non_er_assistant_cleared_at, @@ -41,7 +41,7 @@ class GancaoSyncLogisticsRoute extends Command { $this->setName('gancao:sync-logistics') ->setDescription('同步甘草订单的物流路由(GET_TASK_ROUTE_LIST)到本地物流追踪表') - ->addOption('limit', 'l', Option::VALUE_OPTIONAL, '本次最多处理多少条订单', 100) + ->addOption('limit', 'l', Option::VALUE_OPTIONAL, '本次最多处理多少条订单(跳过已完成/已签收)', 2000) ->addOption('order-id', null, Option::VALUE_OPTIONAL, '只同步指定 prescription_order.id', null) ->addOption('tracking-number', 't', Option::VALUE_REQUIRED, '按快递单号走快递100 查询并落库') ->addOption('detail', 'd', Option::VALUE_NONE, '打印每单详细结果'); @@ -122,6 +122,9 @@ class GancaoSyncLogisticsRoute extends Command $output->writeln('同步完成'); $output->writeln('========================================'); $output->writeln('总数:' . $stats['total']); + if (isset($stats['skipped'])) { + $output->writeln('跳过:' . (int) $stats['skipped'] . '(已完成/已签收)'); + } $output->writeln('成功:' . $stats['success']); $output->writeln('失败:' . $stats['failed']); $output->writeln('医助已移除(甘草同步+指派日志):' . (int) ($stats['assistant_cleared'] ?? 0));