|
@@ -150,6 +150,7 @@ def create_deployment():
|
|
|
# 复制必要文件
|
|
# 复制必要文件
|
|
|
essential_files = [
|
|
essential_files = [
|
|
|
"app.py",
|
|
"app.py",
|
|
|
|
|
+ "get_device_id.py",
|
|
|
".env.example",
|
|
".env.example",
|
|
|
"requirements.txt",
|
|
"requirements.txt",
|
|
|
".registration.example",
|
|
".registration.example",
|
|
@@ -186,13 +187,41 @@ def create_deployment():
|
|
|
# 创建启动脚本
|
|
# 创建启动脚本
|
|
|
create_start_scripts(deploy_dir)
|
|
create_start_scripts(deploy_dir)
|
|
|
|
|
|
|
|
- # 创建 Windows 服务脚本(新增)
|
|
|
|
|
|
|
+ # 创建 Windows 服务脚本,获取当前设备ID脚本
|
|
|
if sys.platform == "win32":
|
|
if sys.platform == "win32":
|
|
|
create_windows_service_scripts(deploy_dir)
|
|
create_windows_service_scripts(deploy_dir)
|
|
|
|
|
+ create_get_device_id_script(deploy_dir)
|
|
|
|
|
|
|
|
print(f"✅ 部署包: {deploy_dir}")
|
|
print(f"✅ 部署包: {deploy_dir}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def create_get_device_id_script(deploy_dir):
|
|
|
|
|
+ """创建获取设备ID脚本"""
|
|
|
|
|
+ print(" 创建获取设备ID脚本...")
|
|
|
|
|
+ bat_content = """@echo off
|
|
|
|
|
+ chcp 65001 >nul
|
|
|
|
|
+ echo === LongjoeAgent ===
|
|
|
|
|
+ echo.
|
|
|
|
|
+
|
|
|
|
|
+ REM 检查Python
|
|
|
|
|
+ python --version >nul 2>&1
|
|
|
|
|
+ if errorlevel 1 (
|
|
|
|
|
+ echo 错误: 未找到Python
|
|
|
|
|
+ pause
|
|
|
|
|
+ exit /b 1
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ REM 获取当前设备ID
|
|
|
|
|
+ echo 获取当前设备ID...
|
|
|
|
|
+ python get_device_id.py
|
|
|
|
|
+
|
|
|
|
|
+ pause
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ bat_file = deploy_dir / "get_device_id.bat"
|
|
|
|
|
+ bat_file.write_text(bat_content, encoding="utf-8")
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def create_start_scripts(deploy_dir):
|
|
def create_start_scripts(deploy_dir):
|
|
|
"""创建启动脚本"""
|
|
"""创建启动脚本"""
|
|
|
|
|
|