argument('file'); if (!is_file($path)) { $this->error('文件不存在: ' . $path); return self::FAILURE; } $content = file_get_contents($path); $payload = json_decode($content ?: '[]', true); if (!is_array($payload)) { $this->error('JSON 解析失败'); return self::FAILURE; } $result = app(PromptService::class)->importFromArray($payload); $this->info(sprintf('导入 %d,更新 %d', $result['imported'] ?? 0, $result['updated'] ?? 0)); if (!empty($result['errors'])) { $this->warn('部分失败:' . implode(';', $result['errors'])); } return self::SUCCESS; } }