| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <x-filament::page>
- <div class="space-y-6">
- <x-filament::section
- description="上传题目 JSON 后,点击页面右上角「一键导入」或下方绿色按钮,即可写入本地 questions 并生成可复制到服务器的 SQL 文件。"
- >
- {{ $this->form }}
- <div class="mt-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:flex-wrap">
- <x-filament::button
- type="button"
- wire:click="runImport"
- color="success"
- size="lg"
- class="w-full sm:w-auto font-semibold"
- >
- 一键导入
- </x-filament::button>
- <span class="text-sm text-gray-600 dark:text-gray-400">
- 与右上角「一键导入」相同操作
- </span>
- </div>
- </x-filament::section>
- <x-filament::section heading="命令行(可选)">
- <pre class="overflow-x-auto rounded-lg bg-gray-950 p-4 text-xs text-gray-100 dark:bg-gray-900"><code># 本地:从文件导入并生成 SQL
- php artisan questions:import /绝对路径/题目.json
- # 仅生成 SQL、不写本地库(适合只在服务器执行)
- php artisan questions:import /path/to/x.json --sql-only
- # 从本地库按 id 导出 SQL(默认不含 id,由服务器自增主键)
- php artisan questions:export-sql --ids=101,102,103
- # 若必须在目标库对齐原 id:
- php artisan questions:export-sql --ids=101,102 --with-id</code></pre>
- </x-filament::section>
- @if ($this->lastSqlPath)
- <x-filament::section heading="本次生成的 SQL 文件">
- <p class="break-all font-mono text-sm text-gray-700 dark:text-gray-300">{{ $this->lastSqlPath }}</p>
- @if ($this->lastMessage)
- <p class="mt-2 whitespace-pre-wrap text-sm text-gray-600 dark:text-gray-400">{{ $this->lastMessage }}</p>
- @endif
- </x-filament::section>
- @endif
- </div>
- </x-filament::page>
|