option('path') ?: base_path('judge_card.template.json')); $directory = dirname($outputPath); if (! is_dir($directory)) { File::ensureDirectoryExists($directory); } $template = $builder->build(); $json = json_encode($template, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); if ($json === false) { $this->error('生成 judge_card.template.json 失败:JSON 编码错误'); return self::FAILURE; } File::put($outputPath, $json.PHP_EOL); $this->info("判卷卡模板已生成:{$outputPath}"); return self::SUCCESS; } }