argument('path'); try { $sourceName = trim((string) $this->option('source-name')); $result = $importer->import( $path, $sourceName !== '' ? $sourceName : basename($path), (bool) $this->option('dry-run'), ); } catch (Throwable $exception) { $this->error($exception->getMessage()); return self::FAILURE; } $action = $this->option('dry-run') ? '校验完成' : '导入完成'; $this->info(sprintf( '%s:共 %d 条,新增 %d 条,更新 %d 条。', $action, $result['total'], $result['created'], $result['updated'], )); return self::SUCCESS; } }