Files
Web_BLS_Heartbeat_Server/scripts/update.bat
XuJiacheng 41301f9ce5 feat: 实现GUID主键与service_mask索引改造
- 将主键从自增id改为GUID格式并添加格式校验
- 为service_mask添加表达式索引优化首位查询性能
- 更新相关文档说明改造方案与验证步骤
- 添加统计模块记录数据库写入与Kafka消费量
- 重构Redis心跳协议改用LIST类型存储项目状态
- 修复部署脚本中的服务名称不一致问题
2026-01-17 18:37:44 +08:00

92 lines
2.2 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
echo ========================================
echo BLS心跳接收端更新脚本
echo ========================================
setlocal enabledelayedexpansion
:: 检查服务是否运行
echo [1/6] 检查服务状态...
pm2 describe bls-heartbeat >nul 2>&1
if errorlevel 1 (
echo [警告] 服务未运行,跳过停止步骤
) else (
echo [信息] 停止服务...
pm2 stop bls-heartbeat
if errorlevel 1 (
echo [错误] 服务停止失败
pause
exit /b 1
)
)
:: 备份当前版本
echo [2/6] 备份当前版本...
if exist "dist" (
if exist "dist_backup" (
rmdir /s /q dist_backup
)
xcopy /E /I /Y dist dist_backup >nul
echo [成功] 当前版本已备份到dist_backup目录
) else (
echo [警告] 未找到dist目录跳过备份
)
:: 更新依赖
echo [3/6] 更新项目依赖...
call npm install --production
if errorlevel 1 (
echo [错误] 依赖更新失败
pause
exit /b 1
)
:: 检查构建文件
echo [4/6] 检查构建文件...
if not exist "dist\index.es.js" (
echo [错误] 未找到构建文件请确保已上传新版本的dist目录
pause
exit /b 1
)
echo [成功] 构建文件检查通过
:: 更新数据库(如果需要)
echo [5/6] 更新数据库...
echo [信息] 运行数据库更新脚本...
call npm run db:apply
if errorlevel 1 (
echo [警告] 数据库更新失败,请检查数据库连接配置
echo [提示] 可以稍后手动运行: npm run db:apply
) else (
echo [成功] 数据库更新完成
)
:: 启动服务
echo [6/6] 启动服务...
pm2 start ecosystem.config.cjs
if errorlevel 1 (
echo [错误] 服务启动失败
pause
exit /b 1
)
:: 显示服务状态
echo ========================================
echo 服务状态
echo ========================================
pm2 status
echo ========================================
echo 更新完成!
echo ========================================
echo.
echo 常用命令:
echo 查看状态: pm2 status
echo 查看日志: pm2 logs bls-heartbeat
echo 重启服务: pm2 restart bls-heartbeat
echo 停止服务: pm2 stop bls-heartbeat
echo 实时监控: pm2 monit
echo.
pause