fix: 修复 Windows 启动脚本编码
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
@echo off
|
||||
chcp 65001 >nul
|
||||
title CapacityReport v2.0.2
|
||||
|
||||
echo ========================================
|
||||
echo CapacityReport - 容量报表处理程序
|
||||
echo CapacityReport - report service
|
||||
echo ========================================
|
||||
echo.
|
||||
|
||||
@@ -11,25 +10,26 @@ cd /d "%~dp0"
|
||||
|
||||
set PYTHON_EXE=.venv\Scripts\python.exe
|
||||
if not exist "%PYTHON_EXE%" (
|
||||
echo [错误] 未找到 uv 创建的虚拟环境: %PYTHON_EXE%
|
||||
echo [提示] 请先在项目根目录执行: uv venv
|
||||
echo [ERROR] Python virtual environment not found: %PYTHON_EXE%
|
||||
echo [HINT] Run this command in the project root first: uv venv
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
"%PYTHON_EXE%" -c "import fastapi, uvicorn, pandas, openpyxl, pymysql, sqlalchemy, chardet" >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo [提示] 正在安装或补齐 Python 依赖...
|
||||
echo [INFO] Installing or repairing Python dependencies...
|
||||
uv pip install -r requirements.txt
|
||||
if errorlevel 1 (
|
||||
echo [错误] Python 依赖安装失败
|
||||
echo [ERROR] Failed to install Python dependencies.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
if not exist "frontend\dist\index.html" (
|
||||
echo [提示] 前端构建产物不存在,请先执行:
|
||||
echo [ERROR] Frontend build output not found.
|
||||
echo [HINT] Run these commands first:
|
||||
echo cd frontend
|
||||
echo npm install
|
||||
echo npm run build
|
||||
@@ -39,14 +39,14 @@ if not exist "frontend\dist\index.html" (
|
||||
|
||||
:loop
|
||||
echo.
|
||||
echo [%date% %time%] 启动服务...
|
||||
echo [启动] 服务地址: http://localhost:9081
|
||||
echo [提示] 关闭此窗口即可停止服务
|
||||
echo [%date% %time%] Starting service...
|
||||
echo [INFO] Service URL: http://localhost:9081
|
||||
echo [INFO] Close this window to stop the service.
|
||||
echo.
|
||||
|
||||
"%PYTHON_EXE%" -m app.main
|
||||
|
||||
echo.
|
||||
echo [%date% %time%] 服务已停止,3 秒后自动重启...
|
||||
echo [%date% %time%] Service stopped. Restarting in 3 seconds...
|
||||
timeout /t 3 /nobreak >nul
|
||||
goto loop
|
||||
|
||||
Reference in New Issue
Block a user