初始化项目 v2.0:中国邮政揽收系统自动填单工具
基于 HTTP API + Node.js token bridge 方案,不依赖浏览器自动化。
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
chcp 65001 >nul 2>&1
|
||||
|
||||
echo ============================================
|
||||
echo PickupAuto Build Script (HTTP mode)
|
||||
echo ============================================
|
||||
echo.
|
||||
|
||||
:: Check Python
|
||||
python --version >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo [ERROR] Python not found. Please install Python 3.10+
|
||||
echo https://www.python.org/downloads/
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Check Node.js (for token bridge)
|
||||
node --version >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo [ERROR] Node.js not found. Please install Node.js 18+
|
||||
echo https://nodejs.org/
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Check uv, install if missing
|
||||
uv --version >nul 2>&1
|
||||
if %errorlevel% neq 0 (
|
||||
echo [INFO] Installing uv...
|
||||
pip install uv
|
||||
if %errorlevel% neq 0 (
|
||||
echo [ERROR] Failed to install uv
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
echo [1/4] Installing Python dependencies...
|
||||
uv sync
|
||||
if %errorlevel% neq 0 (
|
||||
echo [ERROR] Python dependency install failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [2/4] Installing token bridge dependencies...
|
||||
cd token_bridge
|
||||
call npm install
|
||||
if %errorlevel% neq 0 (
|
||||
echo [ERROR] npm install failed in token_bridge
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
cd ..
|
||||
|
||||
echo [3/4] Cleaning old build...
|
||||
if exist dist rmdir /s /q dist
|
||||
if exist build rmdir /s /q build
|
||||
|
||||
echo [4/4] Building exe with PyInstaller...
|
||||
uv run pyinstaller ^
|
||||
--onefile ^
|
||||
--windowed ^
|
||||
--name "PickupAuto" ^
|
||||
--icon="pickup.ico" ^
|
||||
--add-data "config.json;." ^
|
||||
--add-data "pickup.ico;." ^
|
||||
--add-data "token_bridge;token_bridge" ^
|
||||
--hidden-import=openpyxl ^
|
||||
--hidden-import=requests ^
|
||||
main.py
|
||||
|
||||
if %errorlevel% neq 0 (
|
||||
echo [ERROR] PyInstaller build failed
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Copy config to dist for reference
|
||||
copy config.json dist\config.json >nul 2>&1
|
||||
|
||||
echo.
|
||||
echo ============================================
|
||||
echo Build complete!
|
||||
echo Output: dist\PickupAuto.exe
|
||||
echo.
|
||||
echo Requirements for end users:
|
||||
echo - Windows 10/11 64-bit
|
||||
echo - Node.js 18+ (for security token computation)
|
||||
echo - Access to internal network (10.4.188.1)
|
||||
echo ============================================
|
||||
pause
|
||||
Reference in New Issue
Block a user