[patch] 优化版本管理显示 与 更新提示(修改表名信息) 修复因线程安全问题导致的崩溃

This commit is contained in:
2025-10-10 15:34:26 +08:00
parent 6ad58b81b0
commit 12c1b1dfb8
3 changed files with 81 additions and 10 deletions

View File

@@ -24,10 +24,31 @@ class NSISInstaller:
# 应用程序信息
self.app_name = "水滴AI客服智能助手"
self.app_name_en = "ShuiDi AI Assistant"
self.app_version = "1.0.0"
# 从 config.py 读取版本号(自动同步)
self.app_version = self._get_version_from_config()
self.app_publisher = "水滴智能科技"
self.app_url = "https://shuidrop.com/"
self.exe_name = "main.exe"
def _get_version_from_config(self):
"""从 config.py 读取版本号"""
try:
config_file = self.project_root / "config.py"
if config_file.exists():
with open(config_file, 'r', encoding='utf-8') as f:
content = f.read()
import re
match = re.search(r'APP_VERSION\s*=\s*["\']([^"\']+)["\']', content)
if match:
version = match.group(1)
print(f"📦 从 config.py 读取版本号: v{version}")
return version
except Exception as e:
print(f"⚠️ 读取版本号失败: {e},使用默认版本")
return "1.0.0"
def check_prerequisites(self):
"""检查构建前提条件"""
@@ -125,8 +146,11 @@ class NSISInstaller:
"""生成NSIS安装脚本"""
print("📝 生成NSIS安装脚本...")
timestamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
installer_name = f"{self.app_name_en}_Setup_{self.app_version}_{timestamp}.exe"
# 标准化安装包命名(不带时间戳,便于固定下载地址)
installer_name = f"{self.app_name_en}_Setup_v{self.app_version}.exe"
# 示例: ShuiDi_AI_Assistant_Setup_v1.4.12.exe
print(f"📦 安装包名称: {installer_name}")
nsis_content = f'''# 水滴AI客服智能助手 NSIS 安装脚本
# 自动生成于 {datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")}