Files
QQuiz/scripts/check_postgres.bat
handsomezhuzhu a01f3540c5 feat: 实现数据库驱动的API配置管理和项目结构重组
## 新功能
- 实现管理后台API配置管理(OpenAI/Anthropic/Qwen)
- API配置保存到数据库,实时生效无需重启
- API密钥遮罩显示(前10位+后4位)
- 完整endpoint URL自动显示

## 后端改进
- 新增 config_service.py 用于加载数据库配置
- LLMService 支持动态配置注入,回退到环境变量
- 更新 exam.py 和 question.py 使用数据库配置
- 扩展 schemas.py 支持所有API配置字段

## 前端改进
- 重写 AdminSettings.jsx 增强UI体验
- API密钥显示/隐藏切换
- 当前使用的提供商可视化标识
- 移除"需要重启"的误导性提示

## 项目结构重组
- 移动所有脚本到 scripts/ 目录
- 移动所有文档到 docs/ 目录
- 清理 Python 缓存文件

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 19:24:12 +08:00

94 lines
2.7 KiB
Batchfile

@echo off
title PostgreSQL Status Check
color 0B
echo.
echo ========================================
echo PostgreSQL Database Status Check
echo ========================================
echo.
REM Check PostgreSQL installation
echo [1] Checking PostgreSQL Installation...
if exist "C:\Program Files\PostgreSQL\18" (
echo OK - PostgreSQL 18 is installed
echo Location: C:\Program Files\PostgreSQL\18
) else (
echo ERROR - PostgreSQL 18 not found!
pause
exit /b 1
)
echo.
REM Check PostgreSQL service
echo [2] Checking PostgreSQL Service...
sc query postgresql-x64-18 >nul 2>&1
if %errorlevel% equ 0 (
echo OK - PostgreSQL service exists
echo.
echo Service details:
sc query postgresql-x64-18
echo.
) else (
echo WARNING - PostgreSQL service not found!
echo Trying alternative names...
sc query | findstr /i "postgres"
)
echo.
REM Check if port 5432 is listening
echo [3] Checking Port 5432...
netstat -ano | findstr ":5432" | findstr "LISTENING" >nul
if %errorlevel% equ 0 (
echo OK - PostgreSQL is listening on port 5432
netstat -ano | findstr ":5432" | findstr "LISTENING"
) else (
echo ERROR - Port 5432 is NOT listening!
echo PostgreSQL service is probably not running.
echo.
echo To start the service, you can:
echo 1. Open Services (services.msc)
echo 2. Find "postgresql-x64-18" service
echo 3. Right-click and select "Start"
echo.
echo OR run: net start postgresql-x64-18
)
echo.
REM Try to connect to database
echo [4] Testing Database Connection...
set PGPASSWORD=postgres
"C:\Program Files\PostgreSQL\18\pgAdmin 4\runtime\psql.exe" -h localhost -U postgres -c "SELECT version();" postgres >nul 2>&1
if %errorlevel% equ 0 (
echo OK - Successfully connected to PostgreSQL!
echo.
"C:\Program Files\PostgreSQL\18\pgAdmin 4\runtime\psql.exe" -h localhost -U postgres -c "SELECT version();" postgres
echo.
REM Check if qquiz database exists
echo [5] Checking QQuiz Database...
"C:\Program Files\PostgreSQL\18\pgAdmin 4\runtime\psql.exe" -h localhost -U postgres -c "\l" postgres | findstr "qquiz_db" >nul
if %errorlevel% equ 0 (
echo OK - qquiz_db database exists
) else (
echo INFO - qquiz_db database does not exist yet
echo This is normal for first-time setup
)
) else (
echo ERROR - Cannot connect to PostgreSQL!
echo.
echo Possible reasons:
echo 1. PostgreSQL service is not running
echo 2. Default password 'postgres' is incorrect
echo 3. PostgreSQL is not configured to accept local connections
echo.
echo Please start the PostgreSQL service first!
)
echo.
echo ========================================
echo Check Complete
echo ========================================
echo.
pause