Files
zyt/install_express_tracking.bat
T
2026-04-07 18:13:03 +08:00

75 lines
1.9 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
chcp 65001 >nul
REM ============================================
REM 物流追踪系统安装脚本 (Windows)
REM ============================================
echo ==========================================
echo 物流追踪系统安装
echo ==========================================
echo.
REM 获取MySQL连接信息
set /p DB_HOST="数据库主机 [localhost]: "
if "%DB_HOST%"=="" set DB_HOST=localhost
set /p DB_PORT="数据库端口 [3306]: "
if "%DB_PORT%"=="" set DB_PORT=3306
set /p DB_NAME="数据库名称: "
set /p DB_USER="数据库用户名: "
set /p DB_PASS="数据库密码: "
echo.
echo 创建数据库表...
mysql -h%DB_HOST% -P%DB_PORT% -u%DB_USER% -p%DB_PASS% %DB_NAME% < server\database\migrations\create_express_tracking_tables.sql
if %errorlevel% equ 0 (
echo ✓ 数据库表创建成功
) else (
echo ✗ 数据库表创建失败
pause
exit /b 1
)
echo.
echo 测试定时任务命令...
cd server
php think express:auto-update
if %errorlevel% equ 0 (
echo ✓ 定时任务命令测试成功
) else (
echo ✗ 定时任务命令测试失败
pause
exit /b 1
)
cd ..
echo.
echo ==========================================
echo 安装完成!
echo ==========================================
echo.
echo 下一步:
echo 1. 手动添加以下内容到 server/config/console.php
echo 'express:auto-update' =^> \app\command\ExpressAutoUpdate::class,
echo.
echo 2. 配置Windows计划任务(每10分钟执行):
echo - 打开"任务计划程序"
echo - 创建基本任务
echo - 触发器:每10分钟
echo - 操作:启动程序
echo - 程序:php
echo - 参数:think express:auto-update
echo - 起始于:%CD%\server
echo.
echo 3. 或使用命令行创建计划任务:
echo schtasks /create /tn "ExpressAutoUpdate" /tr "php %CD%\server\think express:auto-update" /sc minute /mo 10
echo.
echo 测试命令:
echo cd server ^&^& php think express:auto-update
echo.
pause