Compare commits
No commits in common. "a24a977deca1dcf50e1d69276273963c7fe4b315" and "68e566a9254c2be789c556861becc5b874a33616" have entirely different histories.
a24a977dec
...
68e566a925
@ -1,7 +1,7 @@
|
||||
;iss
|
||||
|
||||
#define MyAppName "基础环境"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppVersion "v1.0.0"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "command"
|
||||
@ -10,9 +10,6 @@
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
; 默认配置
|
||||
@ -20,19 +17,19 @@
|
||||
; 不得复用,每个应用必须有唯一AppId
|
||||
AppId={{517C2278-C7C9-43D0-8E94-BFD2039C7BB8}
|
||||
; 默认安装路径
|
||||
DefaultDirName={autopf}\{#MyAppFirstPath}
|
||||
DefaultDirName={localappdata}\XManage
|
||||
; 是否加密
|
||||
;Encryption=yes
|
||||
; 安装密码
|
||||
;Password={#InstallPassword}
|
||||
;Password=20250801
|
||||
; ICO图标
|
||||
; SetupIconFile=Resources\startup.ico
|
||||
UninstallFilesDir={app}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}.exe
|
||||
VersionInfoCompany=
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
VersionInfoDescription=装配DB、IO、MQ、Command等
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
VersionInfoDescription=
|
||||
VersionInfoProductVersion=1.0.0
|
||||
VersionInfoProductName=基础环境(支持Windows7及以上)
|
||||
|
||||
; 默认配置
|
||||
@ -64,8 +61,6 @@ Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl";
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
; checkablealone 默认选中
|
||||
; unchecked 默认不选中
|
||||
;Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
|
||||
@ -102,19 +97,19 @@ Name: "MySQL"; Description: "MySQL程序"; Types: full; Flags: checkablealone;
|
||||
;; ============================================== 共享文件 禁止使用 ignoreversion 作为 Flags ==============================================
|
||||
;; Readme
|
||||
; 安装完的 readme 信息
|
||||
;Source: "{#MyAppResources}\Readme.md"; DestDir: "{app}"; Flags: isreadme;
|
||||
;Source: "Resources\Readme.md"; DestDir: "{app}"; Flags: isreadme;
|
||||
;; 文件
|
||||
Source: "{#MyAppResources}\grep.exe"; DestDir: "{app}\usr"; DestName: "grep.exe"; Flags: ignoreversion; Components: MainApp;
|
||||
Source: "Resources\grep.exe"; DestDir: "{app}\usr"; DestName: "grep.exe"; Flags: ignoreversion; Components: MainApp;
|
||||
;; 文件夹
|
||||
; recursesubdirs createallsubdirs 递归复制整个目录
|
||||
Source: "{#MyAppResources}\usr\*"; DestDir: "{app}\usr\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: MainApp;
|
||||
Source: "Resources\usr\*"; DestDir: "{app}\usr\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: MainApp;
|
||||
; onlyifdoesntexist 当文件不存在时安装
|
||||
Source: "{#MyAppResources}\jdk\*"; DestDir: "{app}\jdk\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist; Components: JDK;
|
||||
Source: "{#MyAppResources}\redis\*"; DestDir: "{app}\redis\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: Redis;
|
||||
Source: "{#MyAppResources}\io\*"; DestDir: "{app}\io\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: MinIO;
|
||||
Source: "{#MyAppResources}\rocketmq\*"; DestDir: "{app}\rocketmq\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: RocketMQ;
|
||||
Source: "{#MyAppResources}\nginx\*"; DestDir: "{app}\nginx\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: Nginx;
|
||||
Source: "{#MyAppResources}\mysql\*"; DestDir: "{app}\mysql\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: MySQL;
|
||||
Source: "Resources\jdk\*"; DestDir: "{app}\jdk\"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist; Components: JDK;
|
||||
Source: "Resources\redis\*"; DestDir: "{app}\redis\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: Redis;
|
||||
Source: "Resources\io\*"; DestDir: "{app}\io\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: MinIO;
|
||||
Source: "Resources\rocketmq\*"; DestDir: "{app}\rocketmq\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: RocketMQ;
|
||||
Source: "Resources\nginx\*"; DestDir: "{app}\nginx\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: Nginx;
|
||||
Source: "Resources\mysql\*"; DestDir: "{app}\mysql\"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs; Components: MySQL;
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
@ -147,70 +142,68 @@ Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; Value
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName}.exe,0"; Flags: uninsdeletevalue;
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}.exe"" ""%1"""; Flags: uninsdeletevalue;
|
||||
|
||||
|
||||
|
||||
;; 【grep、awk、sed、head、sort、ls、rm、xargs、rar、zip、tar、md5sum、sha1sum...】
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: MainApp; Flags: uninsdeletevalue; \
|
||||
ValueName: "X_COMMAND"; ValueData: "{app}";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: MainApp; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\usr"; Check: NeedsAddPath('%X_COMMAND%\usr');
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: MainApp; \
|
||||
ValueName: "X_COMMAND"; ValueData: "{app}"; Flags: uninsdeletevalue ;
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; AfterInstall: RefreshEnvironment; Components: MainApp; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\usr"; Check: NeedsAddPath('%X_COMMAND%\usr'); Flags: preservestringtype ;
|
||||
|
||||
|
||||
|
||||
;; 【Java】追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: JDK; \
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; AfterInstall: RefreshEnvironment; Components: JDK; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%JAVA_HOME%\bin"; Check: NeedsAddPath('%JAVA_HOME%\bin'); Flags: preservestringtype;
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: JDK; \
|
||||
ValueName: "JAVA_HOME"; ValueData: "{app}\jdk"; Flags: uninsdeletevalue ;
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: JDK; \
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: JDK; \
|
||||
ValueName: "JDK_21"; ValueData: "{app}\jdk"; Flags: uninsdeletevalue ;
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: JDK; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%JAVA_HOME%\bin"; Check: NeedsAddPath('%JAVA_HOME%\bin');
|
||||
|
||||
|
||||
|
||||
;; 【Redis】追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: Redis; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\redis"; Check: NeedsAddPath('%X_COMMAND%\redis');
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; AfterInstall: RefreshEnvironment; Components: Redis; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\redis"; Check: NeedsAddPath('%X_COMMAND%\redis'); Flags: preservestringtype ;
|
||||
|
||||
|
||||
|
||||
;; 【MinIO】追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: MinIO; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\io"; Check: NeedsAddPath('%X_COMMAND%\io');
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; AfterInstall: RefreshEnvironment; Components: MinIO; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\io"; Check: NeedsAddPath('%X_COMMAND%\io'); Flags: preservestringtype ;
|
||||
|
||||
|
||||
|
||||
;; 【Nginx】追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: Nginx; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\nginx"; Check: NeedsAddPath('%X_COMMAND%\nginx');
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; AfterInstall: RefreshEnvironment; Components: Nginx; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\nginx"; Check: NeedsAddPath('%X_COMMAND%\nginx'); Flags: preservestringtype ;
|
||||
|
||||
|
||||
|
||||
;; 【RocketMQ】追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: RocketMQ; Flags: uninsdeletevalue; \
|
||||
ValueName: "ROCKETMQ_HOME"; ValueData: "{app}\rocketmq"; Check: CheckRegistryPath('{app}\rocketmq');
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: RocketMQ; Flags: uninsdeletevalue; \
|
||||
ValueName: "ROCKETMQ_SBIN"; ValueData: "{app}\rocketmq\sbin";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: RocketMQ; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%ROCKETMQ_SBIN%"; Check: NeedsAddPath('%ROCKETMQ_SBIN%');
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: RocketMQ; \
|
||||
ValueName: "ROCKETMQ_HOME"; ValueData: "{app}\rocketmq"; Check: CheckRegistryPath('{app}\rocketmq'); Flags: uninsdeletevalue ;
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: RocketMQ; \
|
||||
ValueName: "ROCKETMQ_SBIN"; ValueData: "{app}\rocketmq\sbin"; Flags: uninsdeletevalue ;
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; AfterInstall: RefreshEnvironment; Components: RocketMQ; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%ROCKETMQ_SBIN%"; Check: NeedsAddPath('%ROCKETMQ_SBIN%'); Flags: preservestringtype ;
|
||||
|
||||
|
||||
|
||||
;; 【MySQL】环境变量【注册服务使用】
|
||||
; 数据库服务注册后服务名
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: MySQL; Flags: uninsdeletevalue; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "X_MANAGE_DB_SC"; ValueData: "x_database";
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: MySQL; \
|
||||
ValueName: "X_MANAGE_DB_SC"; ValueData: "x_database"; Flags: uninsdeletevalue ;
|
||||
; 这两个值,将作为后续判断程序是否已经安装做依据
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: MySQL; Flags: uninsdeletevalue; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "X_MANAGE_DB_EXE"; ValueData: "{app}\mysql\bin\mysqld.exe";
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: MySQL; Flags: uninsdeletevalue ; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "X_MANAGE_DB_COF"; ValueData: "{app}\mysql\my.ini";
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: MySQL; \
|
||||
ValueName: "X_MANAGE_DB_EXE"; ValueData: "{app}\mysql\bin\mysqld.exe"; Flags: uninsdeletevalue ;
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: MySQL; \
|
||||
ValueName: "X_MANAGE_DB_COF"; ValueData: "{app}\mysql\my.ini"; Flags: uninsdeletevalue ;
|
||||
|
||||
; MySQL【通用服务】,导入脚本数据使用
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: MySQL; Flags: uninsdeletevalue; \
|
||||
ValueName: "X_COMMAND_MYSQL"; ValueData: "{app}\mysql\";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; AfterInstall: RefreshEnvironment; Components: MySQL; \
|
||||
ValueName: "X_COMMAND_MYSQL"; ValueData: "{app}\mysql\"; Flags: uninsdeletevalue ;
|
||||
; 追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: MySQL; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND_MYSQL%\bin"; Check: NeedsAddPath('%X_COMMAND_MYSQL%\bin');
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; AfterInstall: RefreshEnvironment; Components: MySQL; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND_MYSQL%\bin"; Check: NeedsAddPath('%X_COMMAND_MYSQL%\bin'); Flags: uninsdeletevalue ;
|
||||
|
||||
|
||||
|
||||
@ -224,15 +217,7 @@ const
|
||||
// 定义 VC++ 2019 运行时的注册表检查路径
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
|
@ -1,257 +0,0 @@
|
||||
;iss
|
||||
|
||||
#define MyAppName "基础环境"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "command"
|
||||
#define MyAppExeNameHump "Command"
|
||||
#define MyAppExeNameUpper "COMMAND"
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
; 默认配置
|
||||
[Setup]
|
||||
; 不得复用,每个应用必须有唯一AppId
|
||||
AppId={{517C2278-C7C9-43D0-8E94-BFD2039C7BB8}
|
||||
; 默认安装路径
|
||||
DefaultDirName={autopf}\{#MyAppFirstPath}
|
||||
; 是否加密
|
||||
;Encryption=yes
|
||||
; 安装密码
|
||||
;Password={#InstallPassword}
|
||||
; ICO图标
|
||||
; SetupIconFile=Resources\startup.ico
|
||||
UninstallFilesDir={app}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}.exe
|
||||
VersionInfoCompany=
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
VersionInfoDescription=基本命令扩充(sed、awk、grep等)
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
VersionInfoProductName=基础环境(支持Windows7及以上)
|
||||
|
||||
; 默认配置
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
ChangesAssociations=yes
|
||||
DisableDirPage=no
|
||||
DisableProgramGroupPage=yes
|
||||
Compression=lzma2
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
ChangesEnvironment=yes
|
||||
PrivilegesRequired=admin
|
||||
ArchitecturesAllowed=x64compatible
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
OutputDir=Release\
|
||||
OutputBaseFilename={#MyAppExeNameHump}Setup-{#MyAppVersion}
|
||||
|
||||
|
||||
; 语言选择
|
||||
[Languages]
|
||||
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl";
|
||||
|
||||
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
; checkablealone 默认选中
|
||||
; unchecked 默认不选中
|
||||
;Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
|
||||
;; 程序 ICO
|
||||
[Icons]
|
||||
;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}.exe"
|
||||
;Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}.exe"; Tasks: desktopicon
|
||||
|
||||
|
||||
;; 组件安装方式
|
||||
[Types]
|
||||
Name: "full"; Description: "完整组件安装";
|
||||
Name: "mini"; Description: "最小安装";
|
||||
;; ============================================== 自定义组件 必须启用 iscustom 作为 Flags ==============================================
|
||||
; iscustom 开启自定义选项
|
||||
Name: "custom"; Description: "自定义组件安装"; Flags: iscustom;
|
||||
|
||||
|
||||
;; 组件列表选择项
|
||||
[Components]
|
||||
;; ============================================== 自定义组件的 Types 可以不参与任何固定式 ==============================================
|
||||
Name: "MainApp"; Description: "{#MyAppName}主程序"; Types: full mini; Flags: checkablealone;
|
||||
|
||||
|
||||
;; 引入文件列表
|
||||
[Files]
|
||||
|
||||
;; ============================================== 共享文件 禁止使用 ignoreversion 作为 Flags ==============================================
|
||||
;; Readme
|
||||
; 安装完的 readme 信息
|
||||
;Source: "{#MyAppResources}\Readme.md"; DestDir: "{app}"; Flags: isreadme;
|
||||
;; 文件
|
||||
Source: "{#MyAppResources}\grep.exe"; DestDir: "{app}\usr"; DestName: "grep.exe"; Flags: ignoreversion; Components: MainApp;
|
||||
;; 文件夹
|
||||
; recursesubdirs createallsubdirs 递归复制整个目录
|
||||
Source: "{#MyAppResources}\usr\*"; DestDir: "{app}\usr\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: MainApp;
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
[Dirs]
|
||||
|
||||
|
||||
;; 安装前后删除文件
|
||||
[InstallDelete]
|
||||
|
||||
|
||||
;; 安装时注册表与环境变量列表
|
||||
[Registry]
|
||||
; uninsdeletevalue 卸载时删除值
|
||||
; uninsdeletekey 卸载时删除键
|
||||
; preservestringtype 保留原值类型
|
||||
;; ============================================== Path 禁止使用任何 *delete*、*remove* 作为 Flags 运行 ==============================================
|
||||
|
||||
;; 【grep、awk、sed、head、sort、ls、rm、xargs、rar、zip、tar、md5sum、sha1sum...】
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Components: MainApp; Flags: uninsdeletevalue; \
|
||||
ValueName: "X_COMMAND"; ValueData: "{app}";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Components: MainApp; Flags: preservestringtype; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%\usr"; Check: NeedsAddPath('%X_COMMAND%\usr');
|
||||
|
||||
|
||||
|
||||
;; 自定义函数
|
||||
[Code]
|
||||
|
||||
const
|
||||
WM_SETTINGCHANGE = 26; // 0x001A 的十进制
|
||||
SMTO_ABORTIFHUNG = 2; // 0x0002 的十进制
|
||||
|
||||
// 定义 VC++ 2019 运行时的注册表检查路径
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
wParam: Integer;
|
||||
lParamStr: String;
|
||||
fuFlags: Integer;
|
||||
uTimeout: Integer;
|
||||
var lpdwResult: Integer
|
||||
): Integer;
|
||||
external 'SendMessageTimeoutW@user32.dll stdcall';
|
||||
|
||||
|
||||
// 给 Path 系统环境变量追加环境
|
||||
function NeedsAddPath(Param: string): boolean;
|
||||
var
|
||||
OrigPath: string;
|
||||
begin
|
||||
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
||||
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
||||
'Path', OrigPath)
|
||||
then begin
|
||||
Result := True;
|
||||
exit;
|
||||
end;
|
||||
// 检查路径是否已存在
|
||||
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
|
||||
if Result = True then
|
||||
Result := Pos(';' + Param + '\;', ';' + OrigPath + ';') = 0;
|
||||
end;
|
||||
|
||||
|
||||
// 刷新系统环境
|
||||
procedure RefreshEnvironment;
|
||||
var
|
||||
Res: Integer;
|
||||
begin
|
||||
SendMessageTimeout(
|
||||
HWND_BROADCAST,
|
||||
WM_SETTINGCHANGE,
|
||||
0,
|
||||
'Environment',
|
||||
SMTO_ABORTIFHUNG,
|
||||
5000,
|
||||
Res
|
||||
);
|
||||
end;
|
||||
|
||||
|
||||
// 检查环境变量,路径是否存在空格
|
||||
function CheckRegistryPath(Path: string): Boolean;
|
||||
begin
|
||||
if Pos(' ', Path) > 0 then
|
||||
begin
|
||||
SuppressibleMsgBox('安装程序错误: 检测到无效的注册表路径 "' + Path + '"。路径不能包含空格。', mbCriticalError, MB_OK, IDOK);
|
||||
Abort;
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
// 以 UTF-8 写入文件
|
||||
function SaveStringToUTF8File(const FileName, Content: String; Append: Boolean): Boolean;
|
||||
var
|
||||
UTF8Content: AnsiString;
|
||||
begin
|
||||
UTF8Content := UTF8Encode(Content);
|
||||
Result := SaveStringToFile(FileName, UTF8Content, Append);
|
||||
end;
|
||||
|
||||
|
||||
// 在安装前检查
|
||||
function InitializeSetup: Boolean;
|
||||
begin
|
||||
// do somethings ...
|
||||
// 默认允许安装继续
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
// 在安装完成后执行
|
||||
procedure CurStepChanged(CurStep: TSetupStep);
|
||||
begin
|
||||
// 仅在安装完成后执行
|
||||
if CurStep = ssPostInstall then
|
||||
begin
|
||||
// do somethings ...
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
// 卸载前先停止程序运行
|
||||
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
||||
begin
|
||||
if CurUninstallStep = usUninstall then begin
|
||||
// do somethings ...
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
[UninstallRun]
|
||||
;; 卸载前运行
|
||||
|
||||
|
||||
|
||||
;; 卸载时删除的文件
|
||||
[UninstallDelete]
|
||||
|
@ -1,7 +1,7 @@
|
||||
;iss
|
||||
|
||||
#define MyAppName "效能评估"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppVersion "v1.0.0"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "eval"
|
||||
@ -10,24 +10,20 @@
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
|
||||
; 默认配置
|
||||
[Setup]
|
||||
AppId={{6BA7B810-9DAD-11D1-80B4-00C04FD430C8}
|
||||
; 默认安装路径
|
||||
DefaultDirName={localappdata}\{#MyAppFirstPath}
|
||||
DefaultDirName={localappdata}\XManage
|
||||
; 安装密码
|
||||
Password={#InstallPassword}
|
||||
Password=20250813
|
||||
; 是否加密
|
||||
Encryption=yes
|
||||
; ICO图标
|
||||
;SetupIconFile=Resources\icon.ico
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
VersionInfoProductVersion=1.0.0
|
||||
VersionInfoCompany=
|
||||
VersionInfoDescription={#MyAppName}服务
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
@ -57,20 +53,17 @@ UninstallFilesDir={app}\{#MyAppExeName}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}\{#MyAppExeName}.bat
|
||||
|
||||
|
||||
|
||||
; 语言选择
|
||||
[Languages]
|
||||
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
|
||||
|
||||
|
||||
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
|
||||
|
||||
;; 程序 ICO
|
||||
[Icons]
|
||||
;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}.exe"
|
||||
@ -78,7 +71,6 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}.bat"; Tasks: desktopicon
|
||||
|
||||
|
||||
|
||||
;; 组件安装方式
|
||||
[Types]
|
||||
; 完整安装所有组件
|
||||
@ -88,7 +80,6 @@ Name: "mini"; Description: "最小安装";
|
||||
Name: custom; Description: 自定义安装; Flags: iscustom
|
||||
|
||||
|
||||
|
||||
;; 组件列表选择项
|
||||
[Components]
|
||||
Name: Starter; Description: {#MyAppName} 启动; Types: full;
|
||||
@ -97,7 +88,6 @@ Name: Server; Description: {#MyAppName} Server; Types: full mini;
|
||||
Name: Data; Description: {#MyAppName} Data; Types: full;
|
||||
|
||||
|
||||
|
||||
;; 安装包引入文件列表
|
||||
[Files]
|
||||
; 后端工程+启动器
|
||||
@ -121,14 +111,12 @@ Source: "Resources\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreve
|
||||
Source: "Resources\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
[Dirs]
|
||||
Name: "{app}\{#MyAppExeName}\web\logs"; Permissions: users-modify; Components: Starter;
|
||||
Name: "{app}\{#MyAppExeName}\web\temp"; Permissions: users-modify; Components: Starter;
|
||||
|
||||
|
||||
|
||||
;; 安装时注册表与环境变量列表
|
||||
[Registry]
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; \
|
||||
@ -174,14 +162,6 @@ const
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
|
@ -1,7 +1,7 @@
|
||||
;iss
|
||||
|
||||
#define MyAppName "模型管理"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppVersion "v1.0.0"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "model"
|
||||
@ -10,24 +10,20 @@
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
|
||||
; 默认配置
|
||||
[Setup]
|
||||
AppId={{A0EBDCA7-8C1A-43FD-BD3A-7E9E6D8B7F6C}
|
||||
; 默认安装路径
|
||||
DefaultDirName={localappdata}\{#MyAppFirstPath}
|
||||
DefaultDirName={localappdata}\XManage
|
||||
; 安装密码
|
||||
Password={#InstallPassword}
|
||||
Password=20250813
|
||||
; 是否加密
|
||||
Encryption=yes
|
||||
; ICO图标
|
||||
;SetupIconFile={#MyAppResources}\icon.ico
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
;SetupIconFile=Resources\icon.ico
|
||||
VersionInfoProductVersion=1.0.0
|
||||
VersionInfoCompany=
|
||||
VersionInfoDescription={#MyAppName}服务
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
@ -57,20 +53,17 @@ UninstallFilesDir={app}\{#MyAppExeName}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}\{#MyAppExeName}.bat
|
||||
|
||||
|
||||
|
||||
; 语言选择
|
||||
[Languages]
|
||||
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
|
||||
|
||||
|
||||
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
|
||||
|
||||
;; 程序 ICO
|
||||
[Icons]
|
||||
;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}.exe"
|
||||
@ -78,7 +71,6 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}.bat"; Tasks: desktopicon
|
||||
|
||||
|
||||
|
||||
;; 组件安装方式
|
||||
[Types]
|
||||
; 完整安装所有组件
|
||||
@ -88,7 +80,6 @@ Name: "mini"; Description: "最小安装";
|
||||
Name: custom; Description: 自定义安装; Flags: iscustom
|
||||
|
||||
|
||||
|
||||
;; 组件列表选择项
|
||||
[Components]
|
||||
Name: Starter; Description: {#MyAppName} 启动; Types: full;
|
||||
@ -97,26 +88,24 @@ Name: Server; Description: {#MyAppName} Server; Types: full mini;
|
||||
Name: Data; Description: {#MyAppName} Data; Types: full;
|
||||
|
||||
|
||||
|
||||
;; 安装包引入文件列表
|
||||
[Files]
|
||||
; 后端工程+启动器
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter
|
||||
Source: "{#MyAppResources}\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server
|
||||
Source: "Resources\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter
|
||||
Source: "Resources\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server
|
||||
|
||||
; 更新数据库脚本
|
||||
Source: "{#MyAppResources}\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Data
|
||||
Source: "Resources\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Data
|
||||
|
||||
; 前端工程 + Nginx
|
||||
Source: "{#MyAppResources}\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "{#MyAppResources}\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
Source: "Resources\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "Resources\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
@ -125,7 +114,6 @@ Name: "{app}\{#MyAppExeName}\web\logs"; Permissions: users-modify; Components: S
|
||||
Name: "{app}\{#MyAppExeName}\web\temp"; Permissions: users-modify; Components: Starter;
|
||||
|
||||
|
||||
|
||||
;; 安装时注册表与环境变量列表
|
||||
[Registry]
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; \
|
||||
@ -165,15 +153,7 @@ const
|
||||
// 定义 VC++ 2019 运行时的注册表检查路径
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
|
@ -1,31 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
:: 时间: 2023-10-14 17:54:07
|
||||
:: 作者: 岳佳君
|
||||
:: 版本: v0.0.2
|
||||
:: 功能: 调用同名 ps1 脚本,临时授权可执行
|
||||
|
||||
:: 获取当前批处理脚本的目录和名称
|
||||
set "bat_path=%~dp0"
|
||||
set "script_name=%~n0"
|
||||
|
||||
:: 检查同目录下的同名 .ps1 文件是否存在
|
||||
if not exist "%bat_path%%script_name%.ps1" (
|
||||
echo Error: PowerShell script "%bat_path%%script_name%.ps1" not found!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: 以 UTF-8 编码运行 PowerShell 脚本
|
||||
echo Running PowerShell script (UTF-8): "%bat_path%%script_name%.ps1"
|
||||
powershell.exe -ExecutionPolicy Bypass -Command "& { [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; . \"%bat_path%%script_name%.ps1\"; exit $LASTEXITCODE }"
|
||||
|
||||
:: 检查执行是否成功
|
||||
if errorlevel 1 (
|
||||
echo Error: Failed to execute PowerShell script.
|
||||
pause
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
endlocal
|
@ -1,28 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
# 时间: 2025-8-6 15:24:00
|
||||
# 版本: v0.0.2
|
||||
# 功能: 转化工具,将 ps1 转为可执行 exe 文件
|
||||
|
||||
# Set-ExecutionPolicy RemoteSigned -Scope Process -Force
|
||||
# Import-Module ps2exe -ErrorAction Stop
|
||||
|
||||
Set-ExecutionPolicy RemoteSigned -Scope Process -Force
|
||||
Write-Output "Convert EXE"
|
||||
Import-Module ps2exe -ErrorAction Stop
|
||||
|
||||
# 转化参数
|
||||
$PS1_NAME = "startup"
|
||||
$APPLICATION_NAME = "model"
|
||||
$APPLICATION_VERSION = "1.0.0"
|
||||
$COPY_RIGHT = "© 2025"
|
||||
|
||||
# 基本启动,无 console,可配置开机自启
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
# 基本启动,提供 console,用于 debug
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}-console.ps1" -OutputFile "${APPLICATION_NAME}-console.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
# 基本启动,两种x
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x86.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x86 -requireAdmin -ErrorAction Stop
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x64.exe" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x64 -requireAdmin -ErrorAction Stop
|
||||
Write-Host "Complete." -ForegroundColor Green
|
||||
Start-Sleep -Seconds 1
|
@ -1,109 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
# Function: Import data from script files or RAR script files into MySQL specific libraries
|
||||
# Author: JiangJun
|
||||
# Create-Time: 2025-8-10 15:57:26
|
||||
# Version: 0.3
|
||||
|
||||
# Set-ExecutionPolicy RemoteSigned -Scope Process -Force
|
||||
|
||||
$logFile = "ScriptExecutionLog_$(Get-Date -Format 'yyyyMMdd_HHmmss').txt"
|
||||
|
||||
function Write-Log {
|
||||
param (
|
||||
[string]$message
|
||||
)
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
$logMessage = "[$timestamp] $message"
|
||||
# [debug]
|
||||
# Write-Output $logMessage | Out-File -FilePath $logFile -Append
|
||||
Write-Host $logMessage
|
||||
}
|
||||
|
||||
function randomText {
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.ToCharArray()
|
||||
$length = 12
|
||||
$random = New-Object System.Random
|
||||
$string = -join (1..$length | ForEach-Object { $chars[$random.Next(0, $chars.Length)] })
|
||||
return $string
|
||||
}
|
||||
|
||||
function Import-Script {
|
||||
param (
|
||||
[string]$dbServer,
|
||||
[string]$dbPort,
|
||||
[string]$dbUser,
|
||||
[string]$dbPassword
|
||||
)
|
||||
if (Test-Path -Path ".\script" -PathType Container) {
|
||||
Write-Log "Found script folder, starting to process .."
|
||||
$subFolders = Get-ChildItem -Path ".\script" -Directory
|
||||
if ($subFolders.Count -eq 0) {
|
||||
Write-Log "There are no subfolders in the script folder, skipping processing."
|
||||
exit
|
||||
}
|
||||
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
$rarFiles = Get-ChildItem -Path $folder.FullName -Filter "*.rar"
|
||||
if ($rarFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
foreach ($rarFile in $rarFiles) {
|
||||
Write-Log "Processing file: $($rarFile.Name) (located in $($folder.Name))"
|
||||
$rarName = $rarFile.BaseName
|
||||
$rarDirectoryName = (Get-Item $rarFile.FullName).DirectoryName
|
||||
try {
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
}
|
||||
} catch {
|
||||
Write-Log "Error unrar $($rarFile.Name):$_"
|
||||
Write-Log "=> $($rarFile.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
$sqlFiles = Get-ChildItem -Path $folder.FullName -Filter "*.sql"
|
||||
if ($sqlFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
foreach ($sqlFile in $sqlFiles) {
|
||||
Write-Log "Processing file: $($sqlFile.Name) (located in $($folder.Name))"
|
||||
$dbName = $sqlFile.BaseName
|
||||
try {
|
||||
Write-Log "Creating database $dbName and importing $($sqlFile.Name)"
|
||||
Start-Process -FilePath "mysql" -ArgumentList "-h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name)" -RedirectStandardInput $sqlFile.FullName -NoNewWindow -Wait
|
||||
Write-Log "Successfully imported $($sqlFile.Name) into database $($folder.Name)"
|
||||
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#$date! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
}
|
||||
} catch {
|
||||
Write-Log "Error importing $($sqlFile.Name):$_"
|
||||
Write-Log "=> $($sqlFile.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Log "All script processing has been completed."
|
||||
}
|
||||
}
|
||||
|
||||
# Param 1: MySQL IP
|
||||
# Param 2: MySQL Port
|
||||
# Param 3: MySQL root
|
||||
# Param 4: MySQL root_password
|
||||
Import-Script "127.0.0.1" "33306" "root" "Root@2025"
|
@ -1,53 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
:: 时间: 2025-8-3 14:18:20
|
||||
:: 作者: JiangJun
|
||||
:: 版本: 0.0.4
|
||||
:: 功能: 关闭 springboot 整体服务(需要配合 XManage 运行环境)
|
||||
|
||||
|
||||
|
||||
:: Nginx 执行 EXE 名称
|
||||
set "nginx_name=model-web.exe"
|
||||
|
||||
:: Nginx 代理端口号
|
||||
set "nginx_proxy_port=:18680"
|
||||
|
||||
:: 服务端口号
|
||||
set "server_port=:28680"
|
||||
|
||||
:: 数据库端口号
|
||||
set "database_port=:33306"
|
||||
|
||||
:: MinIO端口号
|
||||
set "minio_port=:9000"
|
||||
|
||||
|
||||
|
||||
:: 关闭web
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%nginx_proxy_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -pid %X%
|
||||
|
||||
:: 关闭代理
|
||||
set "X="
|
||||
for /f %%a in ('tasklist ^| grep -v "WAIT" ^| grep "%nginx_name%" ^| head -n 1 ^| awk "{print $1}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -im "%nginx_name%"
|
||||
|
||||
:: 关闭后端
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%server_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -pid %X%
|
||||
|
||||
:: 停止数据库服务
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%database_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X net stop x_database
|
||||
|
||||
:: 关闭MinIO
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%minio_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -pid %X%
|
||||
|
||||
:: pause
|
||||
timeout /t 3 /nobreak >nul
|
@ -1,530 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
######################################################################
|
||||
|
||||
# Function
|
||||
# CreateTime: 2025-08-06 12:52:28
|
||||
# Author: Yue Jiajun
|
||||
# Version: 0.0.68
|
||||
|
||||
# Write-Host 是否输出
|
||||
# false: 打包成 exe 时,需要设置为 false
|
||||
# true: 直接运行 ps1时,可以为 true
|
||||
$outputWriteHost = $true
|
||||
$outputLogFile = "$MAIN_PATH\startup.log"
|
||||
$outputErrorFile = "$MAIN_PATH\error.log"
|
||||
######################################################################
|
||||
|
||||
# Get current path
|
||||
$MAIN_PATH = Get-Location
|
||||
|
||||
# Get database service name
|
||||
$SERVER_NAME = $env:X_MANAGE_DB_SC
|
||||
|
||||
# Nginx executable name
|
||||
$NGINX_EXE = "model-web.exe"
|
||||
|
||||
|
||||
# Log recording function
|
||||
function Write-Log {
|
||||
param (
|
||||
[string]$message
|
||||
)
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
$logMessage = "[$timestamp] $message"
|
||||
# [debug]
|
||||
# Write-Output $logMessage | Out-File -FilePath $logFile -Append
|
||||
Write-Host $logMessage
|
||||
}
|
||||
|
||||
function randomText {
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.ToCharArray()
|
||||
$length = 12
|
||||
$random = New-Object System.Random
|
||||
$string = -join (1..$length | ForEach-Object { $chars[$random.Next(0, $chars.Length)] })
|
||||
return $string
|
||||
}
|
||||
|
||||
function Import-Script {
|
||||
param (
|
||||
[string]$dbServer,
|
||||
[string]$dbPort,
|
||||
[string]$dbUser,
|
||||
[string]$dbPassword
|
||||
)
|
||||
# Check whether the script folder exists in the current path
|
||||
if (Test-Path -Path ".\script" -PathType Container) {
|
||||
Write-Log "Found script folder, starting to process .."
|
||||
|
||||
# Get all subfolders
|
||||
$subFolders = Get-ChildItem -Path ".\script" -Directory
|
||||
|
||||
if ($subFolders.Count -eq 0) {
|
||||
Write-Log "There are no subfolders in the script folder, skipping processing."
|
||||
exit
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all RAR files under this folder
|
||||
$rarFiles = Get-ChildItem -Path $folder.FullName -Filter "*.rar"
|
||||
|
||||
if ($rarFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($rarFile in $rarFiles) {
|
||||
Write-Log "Processing file: $($rarFile.Name) (located in $($folder.Name))"
|
||||
|
||||
$rarName = $rarFile.BaseName
|
||||
$rarDirectoryName = (Get-Item $rarFile.FullName).DirectoryName
|
||||
try {
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove rar-file
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error unrar $($rarFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all SQL files under this folder
|
||||
$sqlFiles = Get-ChildItem -Path $folder.FullName -Filter "*.sql"
|
||||
|
||||
if ($sqlFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($sqlFile in $sqlFiles) {
|
||||
Write-Log "Processing file: $($sqlFile.Name) (located in $($folder.Name))"
|
||||
|
||||
# Use file name as database name (without extension)
|
||||
$dbName = $sqlFile.BaseName
|
||||
try {
|
||||
# Connect to the database and execute SQL files
|
||||
Write-Log "Creating database $dbName and importing $($sqlFile.Name)"
|
||||
|
||||
# Here we use MySQL client as an example. If it is SQL Server, please modify it to the corresponding command
|
||||
# For SQL Server, you can use sqlcmd or Invoke sqlcmd
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort -e 'CREATE DATABASE IF NOT EXISTS $dbName;'"
|
||||
# Invoke-Expression $command
|
||||
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $dbName `< `"$($sqlFile.FullName)`""
|
||||
$command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name) `< `"$($sqlFile.FullName)`""
|
||||
|
||||
# [debug]
|
||||
# Write-Log $command
|
||||
|
||||
# Invoke-Expression $command # ERROR
|
||||
# cmd /c $command # SUCCESS, WARN: >> CategoryInfo: NotSpecified: (mysql: [Warning...an be insecure.:String) [], RemoteException
|
||||
# Get-Content $sqlFile.FullName | Invoke-Expression $command # ERROR
|
||||
Start-Process -FilePath "mysql" -ArgumentList "-h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name)" -RedirectStandardInput $sqlFile.FullName -NoNewWindow -Wait
|
||||
|
||||
# Write-Log "Successfully imported $($sqlFile.Name) into database $dbName"
|
||||
Write-Log "Successfully imported $($sqlFile.Name) into database $($folder.Name)"
|
||||
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
# cmd /c rar a -pPassword -hp "target.rar" "file"
|
||||
# Start-Process -FilePath "rar" -ArgumentList "a -pPassword -hp "target.rar" "file"" -NoNewWindow -Wait
|
||||
# Start-Process -FilePath "rar" -ArgumentList 'a', '-pPassword', '-hpPassword', 'target.rar', 'file' -NoNewWindow -Wait
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#20250810! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove script-file
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error importing $($sqlFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Log "All script processing has been completed."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Append-Utf8NoBomContent {
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$FilePath,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Content
|
||||
)
|
||||
|
||||
# 确保目录存在,如果不存在则创建
|
||||
$directory = [System.IO.Path]::GetDirectoryName($FilePath)
|
||||
if (-not [System.IO.Directory]::Exists($directory)) {
|
||||
New-Item -ItemType Directory -Path $directory -Force | Out-Null
|
||||
}
|
||||
|
||||
# 使用 UTF-8(无 BOM)追加内容
|
||||
# 需要PowerShell 6+
|
||||
# $Content | Out-File -FilePath $FilePath -Append -Encoding utf8NoBOM
|
||||
|
||||
# 检查文件是否存在,如果不存在则先创建一个空文件(避免 BOM 问题)
|
||||
if (-not (Test-Path -Path $FilePath)) {
|
||||
# 使用 .NET 创建空文件(无 BOM)
|
||||
[System.IO.File]::WriteAllText($FilePath, "", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
|
||||
# 使用 .NET 方法追加内容(UTF-8 无 BOM)
|
||||
[System.IO.File]::AppendAllText($FilePath, "$Content`r`n", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
|
||||
function Go-Home {
|
||||
if($outputWriteHost) {
|
||||
Write-Host ""
|
||||
Write-Host "Exit ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 任务执行完成"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Sleep -Seconds 5
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Usage-MySQL {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure value in the system environment variable."
|
||||
Write-Host "env: - X_MANAGE_DB_EXE"
|
||||
Write-Host " - X_MANAGE_DB_COF"
|
||||
Write-Host "skip database"
|
||||
Write-Host ""
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Usage-SpringBoot {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure `"JDK_21`" in the system environment variable."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Install-MySQL-Server {
|
||||
# Check required environment variables
|
||||
if (-not $env:X_MANAGE_DB_EXE) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_EXE)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "exe: $($env:X_MANAGE_DB_EXE)"
|
||||
$DB_EXEC = $env:X_MANAGE_DB_EXE
|
||||
|
||||
if (-not $env:X_MANAGE_DB_COF) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_COF)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ini: $($env:X_MANAGE_DB_COF)"
|
||||
}
|
||||
$DB_CONF = $env:X_MANAGE_DB_COF
|
||||
|
||||
# Install MySQL service
|
||||
& $DB_EXEC --install $SERVER_NAME --defaults-file="$DB_CONF"
|
||||
|
||||
# Configure service to start automatically
|
||||
sc.exe config $SERVER_NAME start= auto
|
||||
|
||||
# Wait for service registration
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
# Start the service
|
||||
Start-Service -Name $SERVER_NAME
|
||||
|
||||
# Wait for service to start
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
||||
function Check-With-Start-MySQL {
|
||||
# Check if service exists
|
||||
$service = Get-Service -Name $SERVER_NAME -ErrorAction SilentlyContinue
|
||||
|
||||
if ($service) {
|
||||
# Service exists, check if running
|
||||
if ($service.Status -eq "Running") {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "database ok."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 数据已运行..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
} else {
|
||||
# Start the service if not running
|
||||
if($outputWriteHost) {
|
||||
Write-Host "start up ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动数据库中..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Service -Name $SERVER_NAME
|
||||
}
|
||||
} else {
|
||||
# Install MySQL service
|
||||
Install-MySQL-Server
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Web {
|
||||
# 检查
|
||||
|
||||
}
|
||||
|
||||
function Check-SpringBoot {
|
||||
# 检查 JDK_21 环境变量
|
||||
if (-not $env:JDK_21) {
|
||||
# 如果不存在,则检查安装目录下是否存在 java 可执行文件
|
||||
if (Test-Path "$MAIN_PATH\jre\bin\java.exe") {
|
||||
$env:JDK_21 = "$MAIN_PATH\jre"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ONESELF"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - JDK_21 环境变量不存在,默认生效: $env:JDK_21"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $env:JDK_21) {
|
||||
Usage-SpringBoot
|
||||
return
|
||||
}
|
||||
|
||||
# 检查连接 DB 的 IP 地址
|
||||
if (-not $env:MODEL_MANAGE_DB_SERVER) {
|
||||
# 不存在,则默认 127
|
||||
$env:MODEL_MANAGE_DB_SERVER = "127.0.0.1"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_SERVER 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_SERVER"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
# 检查连接 DB 的端口号
|
||||
if (-not $env:MODEL_MANAGE_DB_PORT) {
|
||||
# 不存在,则默认 3306
|
||||
$env:MODEL_MANAGE_DB_PORT = "3306"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_PORT 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_PORT"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
# 检查 SpringBoot 启动 jar 文件环境变量
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
# 不存在,则默认安装目录下 bin
|
||||
$env:MODEL_MANAGE_BIN = "$MAIN_PATH\bin\demo-0.0.1.jar"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_BIN 环境变量不存在,默认生效: $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable jar"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 缺少可执行的 jar"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
|
||||
if($outputWriteHost) {
|
||||
Write-Host "jdk ok."
|
||||
Write-Host ""
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
}
|
||||
|
||||
function Start-Web {
|
||||
|
||||
# 进入 web 下
|
||||
Set-Location "$MAIN_PATH\web"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Web ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备Web启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# Kill existing web service processes
|
||||
Get-Process -Name $NGINX_EXE.Replace(".exe", "") -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||
|
||||
# 配置默认启动参数
|
||||
$NGINX_PATH = $NGINX_EXE
|
||||
if (-not $NGINX_PATH) {
|
||||
# 不存在,则默认安装目录下 nginx.exe
|
||||
# $NGINX_PATH = "$MAIN_PATH\nginx.exe"
|
||||
$NGINX_PATH = "nginx.exe"
|
||||
if (-not $NGINX_PATH) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable web."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_PATH"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web生效可执行器: $NGINX_PATH"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 检查 Nginx 配置文件是否存在,优先使用 web.conf
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\web.conf"
|
||||
$NGINX_CONFIG = "conf\web.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
# 不存在,则默认安装目录下 nginx.conf
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\nginx.conf"
|
||||
$NGINX_CONFIG = "conf\nginx.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing web config"
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_CONFIG"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web配置生效文件: $NGINX_CONFIG"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 创建以管理员身份运行的 VBS脚本(类似于原始的批处理方式)
|
||||
$vbsContent = @"
|
||||
Set UAC = CreateObject("Shell.Application")
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
|
||||
On Error Resume Next
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
Set tempFile = fso.OpenTextFile("%SystemRoot%\System32\config\systemprofile", 1)
|
||||
If Err.Number = 0 Then
|
||||
WshShell.Run "$NGINX_PATH -c $NGINX_CONFIG", 0, False
|
||||
Else
|
||||
UAC.ShellExecute "$NGINX_PATH", "-c $NGINX_CONFIG", "", "runas", 0
|
||||
End If
|
||||
"@
|
||||
|
||||
# 以 UTF-8 写入文件 temp.vbs ,vbs 脚本不能使用 utf-8
|
||||
# $vbsContent | Out-File -FilePath "$MAIN_PATH\web\temp.vbs" -Encoding UTF8
|
||||
# 以 ANSI 写入文件 temp.vbs
|
||||
$vbsContent | Out-File -FilePath "$MAIN_PATH\web\temp.vbs" -Encoding ASCII
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Build temporary startup script web."
|
||||
}
|
||||
|
||||
# 运行 vbs 并等待结束
|
||||
# Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs" -Wait
|
||||
|
||||
# 不等待,执行下一条命令,Nginx 本身是持续性窗口,等待会导致阻塞
|
||||
Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs"
|
||||
|
||||
# 等待1秒后(防止上一条执行慢),删除临时文件
|
||||
Start-Sleep -Seconds 1
|
||||
Remove-Item "temp.vbs" -Force
|
||||
|
||||
}
|
||||
|
||||
function Start-SpringBoot {
|
||||
|
||||
# 准备启动后台服务
|
||||
Set-Location $MAIN_PATH
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Server ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备SpringBoot启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# jvm启动参数
|
||||
# 指定环境变量 MODEL_MANAGE_DB_SERVER
|
||||
# 指定环境变量 MODEL_MANAGE_DB_PORT
|
||||
# 追加自定义JVM参数 MODEL_VM_PARAMS
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT $env:MODEL_VM_PARAMS"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动JVM参数: $arguments"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 拆分参数为数组
|
||||
$argumentList = $arguments -split " -"
|
||||
|
||||
# 处理第一个元素(没有前导"-")和其余元素(添加前导"-")
|
||||
$argumentList = @($argumentList[0]) + ($argumentList[1..($argumentList.Length-1)] | ForEach-Object { "-$_" })
|
||||
|
||||
# 构建最终的调用命令
|
||||
if($outputWriteHost) {
|
||||
# Write-Host "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动完整命令: $($env:JDK_21)\bin\java.exe $argumentList -jar $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 启动 SpringBoot
|
||||
& "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
|
||||
}
|
||||
|
||||
|
||||
# 检查并启动 MySQL 数据库
|
||||
Check-With-Start-MySQL
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
# 导入数据
|
||||
Import-Script "127.0.0.1" "33306" "root" "Root@2025"
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 Web 运行环境
|
||||
Check-Web
|
||||
# 启动 Nginx 服务
|
||||
Start-Web
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 SpringBoot 运行环境
|
||||
Check-SpringBoot
|
||||
# 启动 SpringBoot 服务
|
||||
Start-SpringBoot
|
||||
|
||||
Write-Host "已启动模型"
|
||||
Start-Sleep -Seconds 3
|
@ -1,488 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
######################################################################
|
||||
|
||||
# Function
|
||||
# CreateTime: 2025-08-06 12:52:28
|
||||
# Author: Yue Jiajun
|
||||
# Version: 0.1.8
|
||||
|
||||
# Write-Host 是否输出
|
||||
# false: 打包成 exe 时,需要设置为 false
|
||||
# true: 直接运行 ps1时,可以为 true
|
||||
$outputWriteHost = $false
|
||||
$outputLogFile = "$MAIN_PATH\startup.log"
|
||||
$outputErrorFile = "$MAIN_PATH\error.log"
|
||||
######################################################################
|
||||
|
||||
# Get current path
|
||||
$MAIN_PATH = Get-Location
|
||||
|
||||
# Get database service name
|
||||
$SERVER_NAME = $env:X_MANAGE_DB_SC
|
||||
|
||||
# Nginx executable name
|
||||
$NGINX_EXE = "model-web.exe"
|
||||
|
||||
function Append-Utf8NoBomContent {
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$FilePath,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Content
|
||||
)
|
||||
|
||||
$directory = [System.IO.Path]::GetDirectoryName($FilePath)
|
||||
if (-not [System.IO.Directory]::Exists($directory)) {
|
||||
New-Item -ItemType Directory -Path $directory -Force | Out-Null
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $FilePath)) {
|
||||
[System.IO.File]::WriteAllText($FilePath, "", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
[System.IO.File]::AppendAllText($FilePath, "$Content`r`n", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
|
||||
function Import-Script {
|
||||
param (
|
||||
[string]$dbServer,
|
||||
[string]$dbPort,
|
||||
[string]$dbUser,
|
||||
[string]$dbPassword
|
||||
)
|
||||
# Check whether the script folder exists in the current path
|
||||
if (Test-Path -Path ".\script" -PathType Container) {
|
||||
Write-Log "Found script folder, starting to process .."
|
||||
|
||||
# Get all subfolders
|
||||
$subFolders = Get-ChildItem -Path ".\script" -Directory
|
||||
|
||||
if ($subFolders.Count -eq 0) {
|
||||
Write-Log "There are no subfolders in the script folder, skipping processing."
|
||||
exit
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all RAR files under this folder
|
||||
$rarFiles = Get-ChildItem -Path $folder.FullName -Filter "*.rar"
|
||||
|
||||
if ($rarFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($rarFile in $rarFiles) {
|
||||
Write-Log "Processing file: $($rarFile.Name) (located in $($folder.Name))"
|
||||
|
||||
$rarName = $rarFile.BaseName
|
||||
$rarDirectoryName = (Get-Item $rarFile.FullName).DirectoryName
|
||||
try {
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove rar-file
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error unrar $($rarFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all SQL files under this folder
|
||||
$sqlFiles = Get-ChildItem -Path $folder.FullName -Filter "*.sql"
|
||||
|
||||
if ($sqlFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($sqlFile in $sqlFiles) {
|
||||
Write-Log "Processing file: $($sqlFile.Name) (located in $($folder.Name))"
|
||||
|
||||
# Use file name as database name (without extension)
|
||||
$dbName = $sqlFile.BaseName
|
||||
try {
|
||||
# Connect to the database and execute SQL files
|
||||
Write-Log "Creating database $dbName and importing $($sqlFile.Name)"
|
||||
|
||||
# Here we use MySQL client as an example. If it is SQL Server, please modify it to the corresponding command
|
||||
# For SQL Server, you can use sqlcmd or Invoke sqlcmd
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort -e 'CREATE DATABASE IF NOT EXISTS $dbName;'"
|
||||
# Invoke-Expression $command
|
||||
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $dbName `< `"$($sqlFile.FullName)`""
|
||||
$command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name) `< `"$($sqlFile.FullName)`""
|
||||
|
||||
# [debug]
|
||||
# Write-Log $command
|
||||
|
||||
# Invoke-Expression $command # ERROR
|
||||
# cmd /c $command # SUCCESS, WARN: >> CategoryInfo: NotSpecified: (mysql: [Warning...an be insecure.:String) [], RemoteException
|
||||
# Get-Content $sqlFile.FullName | Invoke-Expression $command # ERROR
|
||||
Start-Process -FilePath "mysql" -ArgumentList "-h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name)" -RedirectStandardInput $sqlFile.FullName -NoNewWindow -Wait
|
||||
|
||||
# Write-Log "Successfully imported $($sqlFile.Name) into database $dbName"
|
||||
Write-Log "Successfully imported $($sqlFile.Name) into database $($folder.Name)"
|
||||
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
# cmd /c rar a -pPassword -hp "target.rar" "file"
|
||||
# Start-Process -FilePath "rar" -ArgumentList "a -pPassword -hp "target.rar" "file"" -NoNewWindow -Wait
|
||||
# Start-Process -FilePath "rar" -ArgumentList 'a', '-pPassword', '-hpPassword', 'target.rar', 'file' -NoNewWindow -Wait
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#20250810! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove script-file
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error importing $($sqlFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Log "All script processing has been completed."
|
||||
}
|
||||
}
|
||||
|
||||
function Go-Home {
|
||||
if($outputWriteHost) {
|
||||
Write-Host ""
|
||||
Write-Host "Exit ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 任务执行完成"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Sleep -Seconds 5
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Usage-MySQL {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure value in the system environment variable."
|
||||
Write-Host "env: - X_MANAGE_DB_EXE"
|
||||
Write-Host " - X_MANAGE_DB_COF"
|
||||
Write-Host "skip database"
|
||||
Write-Host ""
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Usage-SpringBoot {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure `"JDK_21`" in the system environment variable."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Install-MySQL-Server {
|
||||
# Check required environment variables
|
||||
if (-not $env:X_MANAGE_DB_EXE) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_EXE)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "exe: $($env:X_MANAGE_DB_EXE)"
|
||||
$DB_EXEC = $env:X_MANAGE_DB_EXE
|
||||
|
||||
if (-not $env:X_MANAGE_DB_COF) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_COF)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ini: $($env:X_MANAGE_DB_COF)"
|
||||
}
|
||||
$DB_CONF = $env:X_MANAGE_DB_COF
|
||||
|
||||
# Install MySQL service
|
||||
& $DB_EXEC --install $SERVER_NAME --defaults-file="$DB_CONF"
|
||||
|
||||
# Configure service to start automatically
|
||||
sc.exe config $SERVER_NAME start= auto
|
||||
|
||||
# Wait for service registration
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
# Start the service
|
||||
Start-Service -Name $SERVER_NAME
|
||||
|
||||
# Wait for service to start
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
||||
function Check-With-Start-MySQL {
|
||||
# Check if service exists
|
||||
$service = Get-Service -Name $SERVER_NAME -ErrorAction SilentlyContinue
|
||||
|
||||
if ($service) {
|
||||
# Service exists, check if running
|
||||
if ($service.Status -eq "Running") {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "database ok."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 数据已运行..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
} else {
|
||||
# Start the service if not running
|
||||
if($outputWriteHost) {
|
||||
Write-Host "start up ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动数据库中..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Service -Name $SERVER_NAME
|
||||
}
|
||||
} else {
|
||||
# Install MySQL service
|
||||
Install-MySQL-Server
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Web {
|
||||
# 检查
|
||||
|
||||
}
|
||||
|
||||
function Check-SpringBoot {
|
||||
if (-not $env:JDK_21) {
|
||||
if (Test-Path "$MAIN_PATH\jre\bin\java.exe") {
|
||||
$env:JDK_21 = "$MAIN_PATH\jre"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ONESELF"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - JDK_21 环境变量不存在,默认生效: $env:JDK_21"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $env:JDK_21) {
|
||||
Usage-SpringBoot
|
||||
return
|
||||
}
|
||||
|
||||
if (-not $env:MODEL_MANAGE_DB_SERVER) {
|
||||
$env:MODEL_MANAGE_DB_SERVER = "127.0.0.1"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_SERVER 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_SERVER"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
if (-not $env:MODEL_MANAGE_DB_PORT) {
|
||||
$env:MODEL_MANAGE_DB_PORT = "3306"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_PORT 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_PORT"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
$env:MODEL_MANAGE_BIN = "$MAIN_PATH\bin\demo-0.0.1.jar"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_BIN 环境变量不存在,默认生效: $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable jar"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 缺少可执行的 jar"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
|
||||
if($outputWriteHost) {
|
||||
Write-Host "jdk ok."
|
||||
Write-Host ""
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
}
|
||||
|
||||
function Start-Web {
|
||||
|
||||
Set-Location "$MAIN_PATH\web"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Web ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备Web启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
Get-Process -Name $NGINX_EXE.Replace(".exe", "") -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||
|
||||
$NGINX_PATH = $NGINX_EXE
|
||||
if (-not $NGINX_PATH) {
|
||||
# $NGINX_PATH = "$MAIN_PATH\nginx.exe"
|
||||
$NGINX_PATH = "nginx.exe"
|
||||
if (-not $NGINX_PATH) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable web."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_PATH"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web生效可执行器: $NGINX_PATH"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\web.conf"
|
||||
$NGINX_CONFIG = "conf\web.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\nginx.conf"
|
||||
$NGINX_CONFIG = "conf\nginx.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing web config"
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_CONFIG"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web配置生效文件: $NGINX_CONFIG"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
$vbsContent = @"
|
||||
Set UAC = CreateObject("Shell.Application")
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
|
||||
On Error Resume Next
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
Set tempFile = fso.OpenTextFile("%SystemRoot%\System32\config\systemprofile", 1)
|
||||
If Err.Number = 0 Then
|
||||
WshShell.Run "$NGINX_PATH -c $NGINX_CONFIG", 0, False
|
||||
Else
|
||||
UAC.ShellExecute "$NGINX_PATH", "-c $NGINX_CONFIG", "", "runas", 0
|
||||
End If
|
||||
"@
|
||||
|
||||
# 以 ANSI 写入文件 temp.vbs,vbs 脚本不能使用 utf-8
|
||||
$vbsContent | Out-File -FilePath "$MAIN_PATH\web\temp.vbs" -Encoding ASCII
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Build temporary startup script web."
|
||||
}
|
||||
|
||||
# 运行 vbs 并等待结束
|
||||
# Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs" -Wait
|
||||
|
||||
# 不等待,执行下一条命令,Nginx 本身是持续性窗口,等待会导致阻塞
|
||||
Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs"
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
Remove-Item "temp.vbs" -Force
|
||||
|
||||
}
|
||||
|
||||
function Start-SpringBoot {
|
||||
|
||||
# 准备启动后台服务
|
||||
Set-Location $MAIN_PATH
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Server ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备SpringBoot启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# jvm启动参数
|
||||
# 指定环境变量 MODEL_MANAGE_DB_SERVER
|
||||
# 指定环境变量 MODEL_MANAGE_DB_PORT
|
||||
# 追加自定义JVM参数 MODEL_VM_PARAMS
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT $env:MODEL_VM_PARAMS"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动JVM参数: $arguments"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
$argumentList = $arguments -split " -"
|
||||
$argumentList = @($argumentList[0]) + ($argumentList[1..($argumentList.Length-1)] | ForEach-Object { "-$_" })
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动完整命令: $($env:JDK_21)\bin\java.exe $argumentList -jar $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 启动 SpringBoot
|
||||
$argumentList += "-jar"
|
||||
$argumentList += "`"$env:MODEL_MANAGE_BIN`""
|
||||
$process = Start-Process `
|
||||
-FilePath "$($env:JDK_21)\bin\java.exe" `
|
||||
-ArgumentList $argumentList `
|
||||
-WindowStyle Hidden `
|
||||
-RedirectStandardOutput "NUL" `
|
||||
-RedirectStandardError "NUL_ERR" `
|
||||
-PassThru
|
||||
|
||||
if ($process) {
|
||||
Write-Host "进程已启动,PID: $($process.Id)"
|
||||
} else {
|
||||
Write-Host "进程启动失败!"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# 检查并启动 MySQL 数据库
|
||||
Check-With-Start-MySQL
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
# 导入数据
|
||||
Import-Script "127.0.0.1" "33306" "root" "Root@2025"
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 Web 运行环境
|
||||
Check-Web
|
||||
# 启动 Nginx 服务
|
||||
Start-Web
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 SpringBoot 运行环境
|
||||
Check-SpringBoot
|
||||
# 启动 SpringBoot 服务
|
||||
Start-SpringBoot
|
||||
|
||||
Write-Host "已启动模型"
|
||||
Start-Sleep -Seconds 3
|
@ -1,31 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
:: 时间: 2023-10-14 17:54:07
|
||||
:: 作者: 岳佳君
|
||||
:: 版本: v0.0.2
|
||||
:: 功能: 调用同名 ps1 脚本,临时授权可执行
|
||||
|
||||
:: 获取当前批处理脚本的目录和名称
|
||||
set "bat_path=%~dp0"
|
||||
set "script_name=%~n0"
|
||||
|
||||
:: 检查同目录下的同名 .ps1 文件是否存在
|
||||
if not exist "%bat_path%%script_name%.ps1" (
|
||||
echo Error: PowerShell script "%bat_path%%script_name%.ps1" not found!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: 以 UTF-8 编码运行 PowerShell 脚本
|
||||
echo Running PowerShell script (UTF-8): "%bat_path%%script_name%.ps1"
|
||||
powershell.exe -ExecutionPolicy Bypass -Command "& { [Console]::OutputEncoding = [System.Text.Encoding]::UTF8; . \"%bat_path%%script_name%.ps1\"; exit $LASTEXITCODE }"
|
||||
|
||||
:: 检查执行是否成功
|
||||
if errorlevel 1 (
|
||||
echo Error: Failed to execute PowerShell script.
|
||||
pause
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
endlocal
|
@ -1,28 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
# 时间: 2025-8-6 15:24:00
|
||||
# 版本: v0.0.2
|
||||
# 功能: 转化工具,将 ps1 转为可执行 exe 文件
|
||||
|
||||
# Set-ExecutionPolicy RemoteSigned -Scope Process -Force
|
||||
# Import-Module ps2exe -ErrorAction Stop
|
||||
|
||||
Set-ExecutionPolicy RemoteSigned -Scope Process -Force
|
||||
Write-Output "Convert EXE"
|
||||
Import-Module ps2exe -ErrorAction Stop
|
||||
|
||||
# 转化参数
|
||||
$PS1_NAME = "startup"
|
||||
$APPLICATION_NAME = "model"
|
||||
$APPLICATION_VERSION = "1.0.0"
|
||||
$COPY_RIGHT = "© 2025"
|
||||
|
||||
# 基本启动,无 console,可配置开机自启
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
# 基本启动,提供 console,用于 debug
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}-console.ps1" -OutputFile "${APPLICATION_NAME}-console.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -requireAdmin -ErrorAction Stop
|
||||
# 基本启动,两种x
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x86.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x86 -requireAdmin -ErrorAction Stop
|
||||
Invoke-PS2EXE -InputFile "${PS1_NAME}.ps1" -OutputFile "${APPLICATION_NAME}-x64.exe" -IconFile "icon.ico" -version "${APPLICATION_VERSION}" -copyright "${COPY_RIGHT}" -x64 -requireAdmin -ErrorAction Stop
|
||||
Write-Host "Complete." -ForegroundColor Green
|
||||
Start-Sleep -Seconds 1
|
Binary file not shown.
Before Width: | Height: | Size: 85 KiB |
@ -1,109 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
# Function: Import data from script files or RAR script files into MySQL specific libraries
|
||||
# Author: JiangJun
|
||||
# Create-Time: 2025-8-10 15:57:26
|
||||
# Version: 0.3
|
||||
|
||||
# Set-ExecutionPolicy RemoteSigned -Scope Process -Force
|
||||
|
||||
$logFile = "ScriptExecutionLog_$(Get-Date -Format 'yyyyMMdd_HHmmss').txt"
|
||||
|
||||
function Write-Log {
|
||||
param (
|
||||
[string]$message
|
||||
)
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
$logMessage = "[$timestamp] $message"
|
||||
# [debug]
|
||||
# Write-Output $logMessage | Out-File -FilePath $logFile -Append
|
||||
Write-Host $logMessage
|
||||
}
|
||||
|
||||
function randomText {
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.ToCharArray()
|
||||
$length = 12
|
||||
$random = New-Object System.Random
|
||||
$string = -join (1..$length | ForEach-Object { $chars[$random.Next(0, $chars.Length)] })
|
||||
return $string
|
||||
}
|
||||
|
||||
function Import-Script {
|
||||
param (
|
||||
[string]$dbServer,
|
||||
[string]$dbPort,
|
||||
[string]$dbUser,
|
||||
[string]$dbPassword
|
||||
)
|
||||
if (Test-Path -Path ".\script" -PathType Container) {
|
||||
Write-Log "Found script folder, starting to process .."
|
||||
$subFolders = Get-ChildItem -Path ".\script" -Directory
|
||||
if ($subFolders.Count -eq 0) {
|
||||
Write-Log "There are no subfolders in the script folder, skipping processing."
|
||||
exit
|
||||
}
|
||||
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
$rarFiles = Get-ChildItem -Path $folder.FullName -Filter "*.rar"
|
||||
if ($rarFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
foreach ($rarFile in $rarFiles) {
|
||||
Write-Log "Processing file: $($rarFile.Name) (located in $($folder.Name))"
|
||||
$rarName = $rarFile.BaseName
|
||||
$rarDirectoryName = (Get-Item $rarFile.FullName).DirectoryName
|
||||
try {
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
}
|
||||
} catch {
|
||||
Write-Log "Error unrar $($rarFile.Name):$_"
|
||||
Write-Log "=> $($rarFile.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
$sqlFiles = Get-ChildItem -Path $folder.FullName -Filter "*.sql"
|
||||
if ($sqlFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
foreach ($sqlFile in $sqlFiles) {
|
||||
Write-Log "Processing file: $($sqlFile.Name) (located in $($folder.Name))"
|
||||
$dbName = $sqlFile.BaseName
|
||||
try {
|
||||
Write-Log "Creating database $dbName and importing $($sqlFile.Name)"
|
||||
Start-Process -FilePath "mysql" -ArgumentList "-h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name)" -RedirectStandardInput $sqlFile.FullName -NoNewWindow -Wait
|
||||
Write-Log "Successfully imported $($sqlFile.Name) into database $($folder.Name)"
|
||||
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#$date! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
}
|
||||
} catch {
|
||||
Write-Log "Error importing $($sqlFile.Name):$_"
|
||||
Write-Log "=> $($sqlFile.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Log "All script processing has been completed."
|
||||
}
|
||||
}
|
||||
|
||||
# Param 1: MySQL IP
|
||||
# Param 2: MySQL Port
|
||||
# Param 3: MySQL root
|
||||
# Param 4: MySQL root_password
|
||||
Import-Script "127.0.0.1" "33306" "root" "Root@2025"
|
@ -1,53 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
:: 时间: 2025-8-3 14:18:20
|
||||
:: 作者: JiangJun
|
||||
:: 版本: 0.0.4
|
||||
:: 功能: 关闭 springboot 整体服务(需要配合 XManage 运行环境)
|
||||
|
||||
|
||||
|
||||
:: Nginx 执行 EXE 名称
|
||||
set "nginx_name=model-web.exe"
|
||||
|
||||
:: Nginx 代理端口号
|
||||
set "nginx_proxy_port=:18680"
|
||||
|
||||
:: 服务端口号
|
||||
set "server_port=:28680"
|
||||
|
||||
:: 数据库端口号
|
||||
set "database_port=:33306"
|
||||
|
||||
:: MinIO端口号
|
||||
set "minio_port=:9000"
|
||||
|
||||
|
||||
|
||||
:: 关闭web
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%nginx_proxy_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -pid %X%
|
||||
|
||||
:: 关闭代理
|
||||
set "X="
|
||||
for /f %%a in ('tasklist ^| grep -v "WAIT" ^| grep "%nginx_name%" ^| head -n 1 ^| awk "{print $1}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -im "%nginx_name%"
|
||||
|
||||
:: 关闭后端
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%server_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -pid %X%
|
||||
|
||||
:: 停止数据库服务
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%database_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X net stop x_database
|
||||
|
||||
:: 关闭MinIO
|
||||
set "X="
|
||||
for /f %%a in ('netstat -ano ^| grep -v "WAIT" ^| grep "%minio_port%" ^| head -n 1 ^| awk "{print $NF}"') do @(set X=%%a)
|
||||
if defined X taskkill -f -pid %X%
|
||||
|
||||
:: pause
|
||||
timeout /t 3 /nobreak >nul
|
@ -1,530 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
######################################################################
|
||||
|
||||
# Function
|
||||
# CreateTime: 2025-08-06 12:52:28
|
||||
# Author: Yue Jiajun
|
||||
# Version: 0.0.68
|
||||
|
||||
# Write-Host 是否输出
|
||||
# false: 打包成 exe 时,需要设置为 false
|
||||
# true: 直接运行 ps1时,可以为 true
|
||||
$outputWriteHost = $true
|
||||
$outputLogFile = "$MAIN_PATH\startup.log"
|
||||
$outputErrorFile = "$MAIN_PATH\error.log"
|
||||
######################################################################
|
||||
|
||||
# Get current path
|
||||
$MAIN_PATH = Get-Location
|
||||
|
||||
# Get database service name
|
||||
$SERVER_NAME = $env:X_MANAGE_DB_SC
|
||||
|
||||
# Nginx executable name
|
||||
$NGINX_EXE = "model-web.exe"
|
||||
|
||||
|
||||
# Log recording function
|
||||
function Write-Log {
|
||||
param (
|
||||
[string]$message
|
||||
)
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
$logMessage = "[$timestamp] $message"
|
||||
# [debug]
|
||||
# Write-Output $logMessage | Out-File -FilePath $logFile -Append
|
||||
Write-Host $logMessage
|
||||
}
|
||||
|
||||
function randomText {
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.ToCharArray()
|
||||
$length = 12
|
||||
$random = New-Object System.Random
|
||||
$string = -join (1..$length | ForEach-Object { $chars[$random.Next(0, $chars.Length)] })
|
||||
return $string
|
||||
}
|
||||
|
||||
function Import-Script {
|
||||
param (
|
||||
[string]$dbServer,
|
||||
[string]$dbPort,
|
||||
[string]$dbUser,
|
||||
[string]$dbPassword
|
||||
)
|
||||
# Check whether the script folder exists in the current path
|
||||
if (Test-Path -Path ".\script" -PathType Container) {
|
||||
Write-Log "Found script folder, starting to process .."
|
||||
|
||||
# Get all subfolders
|
||||
$subFolders = Get-ChildItem -Path ".\script" -Directory
|
||||
|
||||
if ($subFolders.Count -eq 0) {
|
||||
Write-Log "There are no subfolders in the script folder, skipping processing."
|
||||
exit
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all RAR files under this folder
|
||||
$rarFiles = Get-ChildItem -Path $folder.FullName -Filter "*.rar"
|
||||
|
||||
if ($rarFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($rarFile in $rarFiles) {
|
||||
Write-Log "Processing file: $($rarFile.Name) (located in $($folder.Name))"
|
||||
|
||||
$rarName = $rarFile.BaseName
|
||||
$rarDirectoryName = (Get-Item $rarFile.FullName).DirectoryName
|
||||
try {
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove rar-file
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error unrar $($rarFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all SQL files under this folder
|
||||
$sqlFiles = Get-ChildItem -Path $folder.FullName -Filter "*.sql"
|
||||
|
||||
if ($sqlFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($sqlFile in $sqlFiles) {
|
||||
Write-Log "Processing file: $($sqlFile.Name) (located in $($folder.Name))"
|
||||
|
||||
# Use file name as database name (without extension)
|
||||
$dbName = $sqlFile.BaseName
|
||||
try {
|
||||
# Connect to the database and execute SQL files
|
||||
Write-Log "Creating database $dbName and importing $($sqlFile.Name)"
|
||||
|
||||
# Here we use MySQL client as an example. If it is SQL Server, please modify it to the corresponding command
|
||||
# For SQL Server, you can use sqlcmd or Invoke sqlcmd
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort -e 'CREATE DATABASE IF NOT EXISTS $dbName;'"
|
||||
# Invoke-Expression $command
|
||||
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $dbName `< `"$($sqlFile.FullName)`""
|
||||
$command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name) `< `"$($sqlFile.FullName)`""
|
||||
|
||||
# [debug]
|
||||
# Write-Log $command
|
||||
|
||||
# Invoke-Expression $command # ERROR
|
||||
# cmd /c $command # SUCCESS, WARN: >> CategoryInfo: NotSpecified: (mysql: [Warning...an be insecure.:String) [], RemoteException
|
||||
# Get-Content $sqlFile.FullName | Invoke-Expression $command # ERROR
|
||||
Start-Process -FilePath "mysql" -ArgumentList "-h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name)" -RedirectStandardInput $sqlFile.FullName -NoNewWindow -Wait
|
||||
|
||||
# Write-Log "Successfully imported $($sqlFile.Name) into database $dbName"
|
||||
Write-Log "Successfully imported $($sqlFile.Name) into database $($folder.Name)"
|
||||
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
# cmd /c rar a -pPassword -hp "target.rar" "file"
|
||||
# Start-Process -FilePath "rar" -ArgumentList "a -pPassword -hp "target.rar" "file"" -NoNewWindow -Wait
|
||||
# Start-Process -FilePath "rar" -ArgumentList 'a', '-pPassword', '-hpPassword', 'target.rar', 'file' -NoNewWindow -Wait
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#20250810! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove script-file
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error importing $($sqlFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Log "All script processing has been completed."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Append-Utf8NoBomContent {
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$FilePath,
|
||||
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Content
|
||||
)
|
||||
|
||||
# 确保目录存在,如果不存在则创建
|
||||
$directory = [System.IO.Path]::GetDirectoryName($FilePath)
|
||||
if (-not [System.IO.Directory]::Exists($directory)) {
|
||||
New-Item -ItemType Directory -Path $directory -Force | Out-Null
|
||||
}
|
||||
|
||||
# 使用 UTF-8(无 BOM)追加内容
|
||||
# 需要PowerShell 6+
|
||||
# $Content | Out-File -FilePath $FilePath -Append -Encoding utf8NoBOM
|
||||
|
||||
# 检查文件是否存在,如果不存在则先创建一个空文件(避免 BOM 问题)
|
||||
if (-not (Test-Path -Path $FilePath)) {
|
||||
# 使用 .NET 创建空文件(无 BOM)
|
||||
[System.IO.File]::WriteAllText($FilePath, "", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
|
||||
# 使用 .NET 方法追加内容(UTF-8 无 BOM)
|
||||
[System.IO.File]::AppendAllText($FilePath, "$Content`r`n", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
|
||||
function Go-Home {
|
||||
if($outputWriteHost) {
|
||||
Write-Host ""
|
||||
Write-Host "Exit ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 任务执行完成"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Sleep -Seconds 5
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Usage-MySQL {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure value in the system environment variable."
|
||||
Write-Host "env: - X_MANAGE_DB_EXE"
|
||||
Write-Host " - X_MANAGE_DB_COF"
|
||||
Write-Host "skip database"
|
||||
Write-Host ""
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Usage-SpringBoot {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure `"JDK_21`" in the system environment variable."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Install-MySQL-Server {
|
||||
# Check required environment variables
|
||||
if (-not $env:X_MANAGE_DB_EXE) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_EXE)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "exe: $($env:X_MANAGE_DB_EXE)"
|
||||
$DB_EXEC = $env:X_MANAGE_DB_EXE
|
||||
|
||||
if (-not $env:X_MANAGE_DB_COF) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_COF)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ini: $($env:X_MANAGE_DB_COF)"
|
||||
}
|
||||
$DB_CONF = $env:X_MANAGE_DB_COF
|
||||
|
||||
# Install MySQL service
|
||||
& $DB_EXEC --install $SERVER_NAME --defaults-file="$DB_CONF"
|
||||
|
||||
# Configure service to start automatically
|
||||
sc.exe config $SERVER_NAME start= auto
|
||||
|
||||
# Wait for service registration
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
# Start the service
|
||||
Start-Service -Name $SERVER_NAME
|
||||
|
||||
# Wait for service to start
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
||||
function Check-With-Start-MySQL {
|
||||
# Check if service exists
|
||||
$service = Get-Service -Name $SERVER_NAME -ErrorAction SilentlyContinue
|
||||
|
||||
if ($service) {
|
||||
# Service exists, check if running
|
||||
if ($service.Status -eq "Running") {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "database ok."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 数据已运行..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
} else {
|
||||
# Start the service if not running
|
||||
if($outputWriteHost) {
|
||||
Write-Host "start up ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动数据库中..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Service -Name $SERVER_NAME
|
||||
}
|
||||
} else {
|
||||
# Install MySQL service
|
||||
Install-MySQL-Server
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Web {
|
||||
# 检查
|
||||
|
||||
}
|
||||
|
||||
function Check-SpringBoot {
|
||||
# 检查 JDK_21 环境变量
|
||||
if (-not $env:JDK_21) {
|
||||
# 如果不存在,则检查安装目录下是否存在 java 可执行文件
|
||||
if (Test-Path "$MAIN_PATH\jre\bin\java.exe") {
|
||||
$env:JDK_21 = "$MAIN_PATH\jre"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ONESELF"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - JDK_21 环境变量不存在,默认生效: $env:JDK_21"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $env:JDK_21) {
|
||||
Usage-SpringBoot
|
||||
return
|
||||
}
|
||||
|
||||
# 检查连接 DB 的 IP 地址
|
||||
if (-not $env:MODEL_MANAGE_DB_SERVER) {
|
||||
# 不存在,则默认 127
|
||||
$env:MODEL_MANAGE_DB_SERVER = "127.0.0.1"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_SERVER 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_SERVER"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
# 检查连接 DB 的端口号
|
||||
if (-not $env:MODEL_MANAGE_DB_PORT) {
|
||||
# 不存在,则默认 3306
|
||||
$env:MODEL_MANAGE_DB_PORT = "3306"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_PORT 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_PORT"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
# 检查 SpringBoot 启动 jar 文件环境变量
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
# 不存在,则默认安装目录下 bin
|
||||
$env:MODEL_MANAGE_BIN = "$MAIN_PATH\bin\demo-0.0.1.jar"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_BIN 环境变量不存在,默认生效: $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable jar"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 缺少可执行的 jar"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
|
||||
if($outputWriteHost) {
|
||||
Write-Host "jdk ok."
|
||||
Write-Host ""
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
}
|
||||
|
||||
function Start-Web {
|
||||
|
||||
# 进入 web 下
|
||||
Set-Location "$MAIN_PATH\web"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Web ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备Web启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# Kill existing web service processes
|
||||
Get-Process -Name $NGINX_EXE.Replace(".exe", "") -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||
|
||||
# 配置默认启动参数
|
||||
$NGINX_PATH = $NGINX_EXE
|
||||
if (-not $NGINX_PATH) {
|
||||
# 不存在,则默认安装目录下 nginx.exe
|
||||
# $NGINX_PATH = "$MAIN_PATH\nginx.exe"
|
||||
$NGINX_PATH = "nginx.exe"
|
||||
if (-not $NGINX_PATH) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable web."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_PATH"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web生效可执行器: $NGINX_PATH"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 检查 Nginx 配置文件是否存在,优先使用 web.conf
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\web.conf"
|
||||
$NGINX_CONFIG = "conf\web.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
# 不存在,则默认安装目录下 nginx.conf
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\nginx.conf"
|
||||
$NGINX_CONFIG = "conf\nginx.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing web config"
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_CONFIG"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web配置生效文件: $NGINX_CONFIG"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 创建以管理员身份运行的 VBS脚本(类似于原始的批处理方式)
|
||||
$vbsContent = @"
|
||||
Set UAC = CreateObject("Shell.Application")
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
|
||||
On Error Resume Next
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
Set tempFile = fso.OpenTextFile("%SystemRoot%\System32\config\systemprofile", 1)
|
||||
If Err.Number = 0 Then
|
||||
WshShell.Run "$NGINX_PATH -c $NGINX_CONFIG", 0, False
|
||||
Else
|
||||
UAC.ShellExecute "$NGINX_PATH", "-c $NGINX_CONFIG", "", "runas", 0
|
||||
End If
|
||||
"@
|
||||
|
||||
# 以 UTF-8 写入文件 temp.vbs ,vbs 脚本不能使用 utf-8
|
||||
# $vbsContent | Out-File -FilePath "$MAIN_PATH\web\temp.vbs" -Encoding UTF8
|
||||
# 以 ANSI 写入文件 temp.vbs
|
||||
$vbsContent | Out-File -FilePath "$MAIN_PATH\web\temp.vbs" -Encoding ASCII
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Build temporary startup script web."
|
||||
}
|
||||
|
||||
# 运行 vbs 并等待结束
|
||||
# Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs" -Wait
|
||||
|
||||
# 不等待,执行下一条命令,Nginx 本身是持续性窗口,等待会导致阻塞
|
||||
Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs"
|
||||
|
||||
# 等待1秒后(防止上一条执行慢),删除临时文件
|
||||
Start-Sleep -Seconds 1
|
||||
Remove-Item "temp.vbs" -Force
|
||||
|
||||
}
|
||||
|
||||
function Start-SpringBoot {
|
||||
|
||||
# 准备启动后台服务
|
||||
Set-Location $MAIN_PATH
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Server ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备SpringBoot启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# jvm启动参数
|
||||
# 指定环境变量 MODEL_MANAGE_DB_SERVER
|
||||
# 指定环境变量 MODEL_MANAGE_DB_PORT
|
||||
# 追加自定义JVM参数 MODEL_VM_PARAMS
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT $env:MODEL_VM_PARAMS"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动JVM参数: $arguments"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 拆分参数为数组
|
||||
$argumentList = $arguments -split " -"
|
||||
|
||||
# 处理第一个元素(没有前导"-")和其余元素(添加前导"-")
|
||||
$argumentList = @($argumentList[0]) + ($argumentList[1..($argumentList.Length-1)] | ForEach-Object { "-$_" })
|
||||
|
||||
# 构建最终的调用命令
|
||||
if($outputWriteHost) {
|
||||
# Write-Host "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动完整命令: $($env:JDK_21)\bin\java.exe $argumentList -jar $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 启动 SpringBoot
|
||||
& "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
|
||||
}
|
||||
|
||||
|
||||
# 检查并启动 MySQL 数据库
|
||||
Check-With-Start-MySQL
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
# 导入数据
|
||||
Import-Script "127.0.0.1" "33306" "root" "Root@2025"
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 Web 运行环境
|
||||
Check-Web
|
||||
# 启动 Nginx 服务
|
||||
Start-Web
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 SpringBoot 运行环境
|
||||
Check-SpringBoot
|
||||
# 启动 SpringBoot 服务
|
||||
Start-SpringBoot
|
||||
|
||||
Write-Host "已启动模型"
|
||||
Start-Sleep -Seconds 3
|
@ -1,488 +0,0 @@
|
||||
#!PowerShell
|
||||
|
||||
######################################################################
|
||||
|
||||
# Function
|
||||
# CreateTime: 2025-08-06 12:52:28
|
||||
# Author: Yue Jiajun
|
||||
# Version: 0.1.8
|
||||
|
||||
# Write-Host 是否输出
|
||||
# false: 打包成 exe 时,需要设置为 false
|
||||
# true: 直接运行 ps1时,可以为 true
|
||||
$outputWriteHost = $false
|
||||
$outputLogFile = "$MAIN_PATH\startup.log"
|
||||
$outputErrorFile = "$MAIN_PATH\error.log"
|
||||
######################################################################
|
||||
|
||||
# Get current path
|
||||
$MAIN_PATH = Get-Location
|
||||
|
||||
# Get database service name
|
||||
$SERVER_NAME = $env:X_MANAGE_DB_SC
|
||||
|
||||
# Nginx executable name
|
||||
$NGINX_EXE = "model-web.exe"
|
||||
|
||||
function Append-Utf8NoBomContent {
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$FilePath,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Content
|
||||
)
|
||||
|
||||
$directory = [System.IO.Path]::GetDirectoryName($FilePath)
|
||||
if (-not [System.IO.Directory]::Exists($directory)) {
|
||||
New-Item -ItemType Directory -Path $directory -Force | Out-Null
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $FilePath)) {
|
||||
[System.IO.File]::WriteAllText($FilePath, "", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
[System.IO.File]::AppendAllText($FilePath, "$Content`r`n", [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
|
||||
function Import-Script {
|
||||
param (
|
||||
[string]$dbServer,
|
||||
[string]$dbPort,
|
||||
[string]$dbUser,
|
||||
[string]$dbPassword
|
||||
)
|
||||
# Check whether the script folder exists in the current path
|
||||
if (Test-Path -Path ".\script" -PathType Container) {
|
||||
Write-Log "Found script folder, starting to process .."
|
||||
|
||||
# Get all subfolders
|
||||
$subFolders = Get-ChildItem -Path ".\script" -Directory
|
||||
|
||||
if ($subFolders.Count -eq 0) {
|
||||
Write-Log "There are no subfolders in the script folder, skipping processing."
|
||||
exit
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all RAR files under this folder
|
||||
$rarFiles = Get-ChildItem -Path $folder.FullName -Filter "*.rar"
|
||||
|
||||
if ($rarFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($rarFile in $rarFiles) {
|
||||
Write-Log "Processing file: $($rarFile.Name) (located in $($folder.Name))"
|
||||
|
||||
$rarName = $rarFile.BaseName
|
||||
$rarDirectoryName = (Get-Item $rarFile.FullName).DirectoryName
|
||||
try {
|
||||
Start-Process -FilePath "rar" -ArgumentList "x -pshzyh!234 `"$($rarFile.FullName)`" `"$rarDirectoryName`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove rar-file
|
||||
if (Test-Path $rarFile.FullName) {
|
||||
Remove-Item $rarFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error unrar $($rarFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Traverse each subfolder
|
||||
foreach ($folder in $subFolders) {
|
||||
Write-Log "Database connection parameters - Please modify according to the actual situation $($folder.Name)"
|
||||
|
||||
# Get all SQL files under this folder
|
||||
$sqlFiles = Get-ChildItem -Path $folder.FullName -Filter "*.sql"
|
||||
|
||||
if ($sqlFiles.Count -eq 0) {
|
||||
Write-Log "There are no SQL files in the folder $($folder.Name), skipping."
|
||||
continue
|
||||
}
|
||||
|
||||
# Process each SQL file
|
||||
foreach ($sqlFile in $sqlFiles) {
|
||||
Write-Log "Processing file: $($sqlFile.Name) (located in $($folder.Name))"
|
||||
|
||||
# Use file name as database name (without extension)
|
||||
$dbName = $sqlFile.BaseName
|
||||
try {
|
||||
# Connect to the database and execute SQL files
|
||||
Write-Log "Creating database $dbName and importing $($sqlFile.Name)"
|
||||
|
||||
# Here we use MySQL client as an example. If it is SQL Server, please modify it to the corresponding command
|
||||
# For SQL Server, you can use sqlcmd or Invoke sqlcmd
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort -e 'CREATE DATABASE IF NOT EXISTS $dbName;'"
|
||||
# Invoke-Expression $command
|
||||
|
||||
# $command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $dbName `< `"$($sqlFile.FullName)`""
|
||||
$command = "mysql -h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name) `< `"$($sqlFile.FullName)`""
|
||||
|
||||
# [debug]
|
||||
# Write-Log $command
|
||||
|
||||
# Invoke-Expression $command # ERROR
|
||||
# cmd /c $command # SUCCESS, WARN: >> CategoryInfo: NotSpecified: (mysql: [Warning...an be insecure.:String) [], RemoteException
|
||||
# Get-Content $sqlFile.FullName | Invoke-Expression $command # ERROR
|
||||
Start-Process -FilePath "mysql" -ArgumentList "-h$dbServer -u$dbUser -p$dbPassword -P$dbPort $($folder.Name)" -RedirectStandardInput $sqlFile.FullName -NoNewWindow -Wait
|
||||
|
||||
# Write-Log "Successfully imported $($sqlFile.Name) into database $dbName"
|
||||
Write-Log "Successfully imported $($sqlFile.Name) into database $($folder.Name)"
|
||||
|
||||
$date = $(Get-Date -Format "yyyy-MM-dd")
|
||||
$random = randomText
|
||||
$target = ".\patch\$($date)"
|
||||
New-Item -Path "$target" -ItemType Directory -Force
|
||||
# cmd /c rar a -pPassword -hp "target.rar" "file"
|
||||
# Start-Process -FilePath "rar" -ArgumentList "a -pPassword -hp "target.rar" "file"" -NoNewWindow -Wait
|
||||
# Start-Process -FilePath "rar" -ArgumentList 'a', '-pPassword', '-hpPassword', 'target.rar', 'file' -NoNewWindow -Wait
|
||||
Start-Process -FilePath "rar" -ArgumentList "a -pPassword#20250810! -hp $target\$($random).rar `"$($sqlFile.FullName)`"" -NoNewWindow -Wait
|
||||
|
||||
# Remove script-file
|
||||
if (Test-Path $sqlFile.FullName) {
|
||||
Remove-Item $sqlFile.FullName -Force
|
||||
# [debug]
|
||||
# Write-Log "File deleted."
|
||||
} else {
|
||||
# [debug]
|
||||
# Write-Log "File does not exist."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Log "Error importing $($sqlFile.Name):$_"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Log "All script processing has been completed."
|
||||
}
|
||||
}
|
||||
|
||||
function Go-Home {
|
||||
if($outputWriteHost) {
|
||||
Write-Host ""
|
||||
Write-Host "Exit ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 任务执行完成"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Sleep -Seconds 5
|
||||
exit 0
|
||||
}
|
||||
|
||||
function Usage-MySQL {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure value in the system environment variable."
|
||||
Write-Host "env: - X_MANAGE_DB_EXE"
|
||||
Write-Host " - X_MANAGE_DB_COF"
|
||||
Write-Host "skip database"
|
||||
Write-Host ""
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Usage-SpringBoot {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Please configure `"JDK_21`" in the system environment variable."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
|
||||
function Install-MySQL-Server {
|
||||
# Check required environment variables
|
||||
if (-not $env:X_MANAGE_DB_EXE) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_EXE)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_EXE}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "exe: $($env:X_MANAGE_DB_EXE)"
|
||||
$DB_EXEC = $env:X_MANAGE_DB_EXE
|
||||
|
||||
if (-not $env:X_MANAGE_DB_COF) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
|
||||
if (-not (Test-Path $env:X_MANAGE_DB_COF)) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Error: Missing parameter! {X_MANAGE_DB_COF}" | Out-File "error.log" -Append
|
||||
}
|
||||
Usage-MySQL
|
||||
return
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ini: $($env:X_MANAGE_DB_COF)"
|
||||
}
|
||||
$DB_CONF = $env:X_MANAGE_DB_COF
|
||||
|
||||
# Install MySQL service
|
||||
& $DB_EXEC --install $SERVER_NAME --defaults-file="$DB_CONF"
|
||||
|
||||
# Configure service to start automatically
|
||||
sc.exe config $SERVER_NAME start= auto
|
||||
|
||||
# Wait for service registration
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
# Start the service
|
||||
Start-Service -Name $SERVER_NAME
|
||||
|
||||
# Wait for service to start
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
|
||||
function Check-With-Start-MySQL {
|
||||
# Check if service exists
|
||||
$service = Get-Service -Name $SERVER_NAME -ErrorAction SilentlyContinue
|
||||
|
||||
if ($service) {
|
||||
# Service exists, check if running
|
||||
if ($service.Status -eq "Running") {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "database ok."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 数据已运行..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
} else {
|
||||
# Start the service if not running
|
||||
if($outputWriteHost) {
|
||||
Write-Host "start up ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动数据库中..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
Start-Service -Name $SERVER_NAME
|
||||
}
|
||||
} else {
|
||||
# Install MySQL service
|
||||
Install-MySQL-Server
|
||||
}
|
||||
}
|
||||
|
||||
function Check-Web {
|
||||
# 检查
|
||||
|
||||
}
|
||||
|
||||
function Check-SpringBoot {
|
||||
if (-not $env:JDK_21) {
|
||||
if (Test-Path "$MAIN_PATH\jre\bin\java.exe") {
|
||||
$env:JDK_21 = "$MAIN_PATH\jre"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ONESELF"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - JDK_21 环境变量不存在,默认生效: $env:JDK_21"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $env:JDK_21) {
|
||||
Usage-SpringBoot
|
||||
return
|
||||
}
|
||||
|
||||
if (-not $env:MODEL_MANAGE_DB_SERVER) {
|
||||
$env:MODEL_MANAGE_DB_SERVER = "127.0.0.1"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_SERVER 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_SERVER"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
if (-not $env:MODEL_MANAGE_DB_PORT) {
|
||||
$env:MODEL_MANAGE_DB_PORT = "3306"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_DB_PORT 环境变量不存在,默认生效: $env:MODEL_MANAGE_DB_PORT"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
}
|
||||
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
$env:MODEL_MANAGE_BIN = "$MAIN_PATH\bin\demo-0.0.1.jar"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - MODEL_MANAGE_BIN 环境变量不存在,默认生效: $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
if (-not $env:MODEL_MANAGE_BIN) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable jar"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 缺少可执行的 jar"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
|
||||
if($outputWriteHost) {
|
||||
Write-Host "jdk ok."
|
||||
Write-Host ""
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
|
||||
}
|
||||
|
||||
function Start-Web {
|
||||
|
||||
Set-Location "$MAIN_PATH\web"
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Web ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备Web启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
Get-Process -Name $NGINX_EXE.Replace(".exe", "") -ErrorAction SilentlyContinue | Stop-Process -Force
|
||||
|
||||
$NGINX_PATH = $NGINX_EXE
|
||||
if (-not $NGINX_PATH) {
|
||||
# $NGINX_PATH = "$MAIN_PATH\nginx.exe"
|
||||
$NGINX_PATH = "nginx.exe"
|
||||
if (-not $NGINX_PATH) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing executable web."
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_PATH"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web生效可执行器: $NGINX_PATH"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\web.conf"
|
||||
$NGINX_CONFIG = "conf\web.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
# $NGINX_CONFIG = "$MAIN_PATH\conf\nginx.conf"
|
||||
$NGINX_CONFIG = "conf\nginx.conf"
|
||||
if (-not $NGINX_CONFIG) {
|
||||
if($outputWriteHost) {
|
||||
Write-Host "ERROR: Missing web config"
|
||||
}
|
||||
pause
|
||||
Go-Home
|
||||
}
|
||||
}
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$NGINX_CONFIG"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - Web配置生效文件: $NGINX_CONFIG"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
$vbsContent = @"
|
||||
Set UAC = CreateObject("Shell.Application")
|
||||
Set WshShell = CreateObject("WScript.Shell")
|
||||
|
||||
On Error Resume Next
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
Set tempFile = fso.OpenTextFile("%SystemRoot%\System32\config\systemprofile", 1)
|
||||
If Err.Number = 0 Then
|
||||
WshShell.Run "$NGINX_PATH -c $NGINX_CONFIG", 0, False
|
||||
Else
|
||||
UAC.ShellExecute "$NGINX_PATH", "-c $NGINX_CONFIG", "", "runas", 0
|
||||
End If
|
||||
"@
|
||||
|
||||
# 以 ANSI 写入文件 temp.vbs,vbs 脚本不能使用 utf-8
|
||||
$vbsContent | Out-File -FilePath "$MAIN_PATH\web\temp.vbs" -Encoding ASCII
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Build temporary startup script web."
|
||||
}
|
||||
|
||||
# 运行 vbs 并等待结束
|
||||
# Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs" -Wait
|
||||
|
||||
# 不等待,执行下一条命令,Nginx 本身是持续性窗口,等待会导致阻塞
|
||||
Start-Process "cscript.exe" -ArgumentList "//nologo temp.vbs"
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
Remove-Item "temp.vbs" -Force
|
||||
|
||||
}
|
||||
|
||||
function Start-SpringBoot {
|
||||
|
||||
# 准备启动后台服务
|
||||
Set-Location $MAIN_PATH
|
||||
if($outputWriteHost) {
|
||||
Write-Host "Start Server ..."
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 准备SpringBoot启动..."
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# jvm启动参数
|
||||
# 指定环境变量 MODEL_MANAGE_DB_SERVER
|
||||
# 指定环境变量 MODEL_MANAGE_DB_PORT
|
||||
# 追加自定义JVM参数 MODEL_VM_PARAMS
|
||||
$arguments = "-Dspring.profiles.active=dev,mysql -Dmybatis-flex.datasource.ds1.password=Wfbke8!LeMY5Fwwe -Dproject.database-ip=$env:MODEL_MANAGE_DB_SERVER -Dproject.database-port=$env:MODEL_MANAGE_DB_PORT $env:MODEL_VM_PARAMS"
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动JVM参数: $arguments"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
$argumentList = $arguments -split " -"
|
||||
$argumentList = @($argumentList[0]) + ($argumentList[1..($argumentList.Length-1)] | ForEach-Object { "-$_" })
|
||||
if($outputWriteHost) {
|
||||
Write-Host "$($env:JDK_21)\bin\java.exe" $argumentList -jar "$env:MODEL_MANAGE_BIN"
|
||||
}
|
||||
$logMessage = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - 启动完整命令: $($env:JDK_21)\bin\java.exe $argumentList -jar $env:MODEL_MANAGE_BIN"
|
||||
Append-Utf8NoBomContent -FilePath $outputLogFile -Content $logMessage
|
||||
|
||||
# 启动 SpringBoot
|
||||
$argumentList += "-jar"
|
||||
$argumentList += "`"$env:MODEL_MANAGE_BIN`""
|
||||
$process = Start-Process `
|
||||
-FilePath "$($env:JDK_21)\bin\java.exe" `
|
||||
-ArgumentList $argumentList `
|
||||
-WindowStyle Hidden `
|
||||
-RedirectStandardOutput "NUL" `
|
||||
-RedirectStandardError "NUL_ERR" `
|
||||
-PassThru
|
||||
|
||||
if ($process) {
|
||||
Write-Host "进程已启动,PID: $($process.Id)"
|
||||
} else {
|
||||
Write-Host "进程启动失败!"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
# 检查并启动 MySQL 数据库
|
||||
Check-With-Start-MySQL
|
||||
|
||||
Start-Sleep -Seconds 2
|
||||
# 导入数据
|
||||
Import-Script "127.0.0.1" "33306" "root" "Root@2025"
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 Web 运行环境
|
||||
Check-Web
|
||||
# 启动 Nginx 服务
|
||||
Start-Web
|
||||
|
||||
Start-Sleep -Seconds 1
|
||||
# 检查 SpringBoot 运行环境
|
||||
Check-SpringBoot
|
||||
# 启动 SpringBoot 服务
|
||||
Start-SpringBoot
|
||||
|
||||
Write-Host "已启动模型"
|
||||
Start-Sleep -Seconds 3
|
@ -1,35 +0,0 @@
|
||||
|
||||
## 编译流程 783
|
||||
|
||||
- 1、 运行 `resources-initialize.bat` 初始化默认资源获取目录
|
||||
- 2、 Resource/database 存放数据库程序
|
||||
- 3、 Resource/dist 存放前端 build 内容
|
||||
- 4、 Resource/io 存放 MinIO 服务
|
||||
- 5、 Resource/java 存放 JDK21 内容
|
||||
- 6、 Resource/script 将按照数据库名称,存放SQL脚本
|
||||
- 7、 Resource/server 存放后端 jar
|
||||
- 8、 Resource/usr 存放脚本运行环境命令
|
||||
- 9、 Resource/web 存放 nginx 程序
|
||||
- 10、 Resource/ 存放一个 `icon.ico` 图标
|
||||
- 11、 Resource/ 存放一个 `model*.exe` 可执行程序,用于安装数据库、启动前后端服务
|
||||
- 12、 Resource/ 存放一个 `patch.exe` 可执行程序,用于运行库补丁
|
||||
- 13、 启动 `install-win10-model-783.iss` 进行编译,编译完成后 Release 文件夹中会出现编译后的安装包
|
||||
- 14、 配合 base 编译后安装程序,形成完整运行环境,支持 Windows 10 运行
|
||||
|
||||
|
||||
## 编译流程 203
|
||||
|
||||
- 1、 运行 `resources-initialize.bat` 初始化默认资源获取目录
|
||||
- 2、 Resource/database 存放数据库程序
|
||||
- 3、 Resource/dist 存放前端 build 内容
|
||||
- 4、 Resource/io 存放 MinIO 服务
|
||||
- 5、 Resource/java 存放 JDK21 内容
|
||||
- 6、 Resource/script 将按照数据库名称,存放SQL脚本
|
||||
- 7、 Resource/server 存放后端 jar
|
||||
- 8、 Resource/usr 存放脚本运行环境命令
|
||||
- 9、 Resource/web 存放 nginx 程序
|
||||
- 10、 Resource/ 存放一个 `icon.ico` 图标
|
||||
- 11、 Resource/ 存放一个 `model*.exe` 可执行程序,用于安装数据库、启动前后端服务
|
||||
- 12、 Resource/ 存放一个 `patch.exe` 可执行程序,用于运行库补丁
|
||||
- 13、 启动 `install-win10-model-203.iss` 进行编译,编译完成后 Release 文件夹中会出现编译后的安装包
|
||||
- 14、 配合 base 编译后安装程序,形成完整运行环境,支持 Windows 10 运行
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
{"version":"1","format":"xl-single","id":"336b01aa-5890-4b41-a360-4cc54cf00592","xl":{"version":"3","this":"20dd394e-1e16-4f61-81f7-e40bbe4768a0","sets":[["20dd394e-1e16-4f61-81f7-e40bbe4768a0"]],"distributionAlgo":"SIPMOD+PARITY"}}
|
Binary file not shown.
Binary file not shown.
@ -1,35 +0,0 @@
|
||||
@echo off
|
||||
chcp 65001 >nul
|
||||
title MinIO Quick Start
|
||||
|
||||
set MINIO_EXE=minio.exe
|
||||
set DATA_DIR=./data
|
||||
set CONSOLE_PORT=9001
|
||||
|
||||
:: 检查minio.exe是否存在
|
||||
if not exist "%MINIO_EXE%" (
|
||||
echo Error: %MINIO_EXE% 不存在!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: 设置MinIO凭据
|
||||
:: set MINIO_ROOT_USER=minio_FEaTQx
|
||||
:: set MINIO_ROOT_PASSWORD=minio_34KYwR
|
||||
|
||||
:: 检查数据目录是否存在,不存在则创建
|
||||
if not exist "%DATA_DIR%" (
|
||||
mkdir "%DATA_DIR%"
|
||||
)
|
||||
|
||||
|
||||
if exist "%MINIO_EXE%" (
|
||||
echo Starting MinIO server...
|
||||
start "Scenario Server" cmd /k "%MINIO_EXE% server ^"%DATA_DIR%^" --console-address ^":%CONSOLE_PORT%^""
|
||||
)
|
||||
|
||||
echo MinIO:
|
||||
echo - MinIO API (Port: 9000)
|
||||
echo - MinIO Web (Port: 9001)
|
||||
|
||||
pause
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,48 +0,0 @@
|
||||
server {
|
||||
listen 18680;
|
||||
server_name _;
|
||||
# gzip config
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_comp_level 9;
|
||||
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
root dist;
|
||||
include mime.types;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:28680/;
|
||||
client_max_body_size 100M;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /file/ {
|
||||
proxy_pass http://127.0.0.1:9000/;
|
||||
client_max_body_size 5000M;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
error_page 405 =200 $request_uri;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
worker_processes 1;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
include model-windows.conf;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 85 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
{"version":"1","format":"xl-single","id":"336b01aa-5890-4b41-a360-4cc54cf00592","xl":{"version":"3","this":"20dd394e-1e16-4f61-81f7-e40bbe4768a0","sets":[["20dd394e-1e16-4f61-81f7-e40bbe4768a0"]],"distributionAlgo":"SIPMOD+PARITY"}}
|
Binary file not shown.
Binary file not shown.
@ -1,35 +0,0 @@
|
||||
@echo off
|
||||
chcp 65001 >nul
|
||||
title MinIO Quick Start
|
||||
|
||||
set MINIO_EXE=minio.exe
|
||||
set DATA_DIR=./data
|
||||
set CONSOLE_PORT=9001
|
||||
|
||||
:: 检查minio.exe是否存在
|
||||
if not exist "%MINIO_EXE%" (
|
||||
echo Error: %MINIO_EXE% 不存在!
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: 设置MinIO凭据
|
||||
:: set MINIO_ROOT_USER=minio_FEaTQx
|
||||
:: set MINIO_ROOT_PASSWORD=minio_34KYwR
|
||||
|
||||
:: 检查数据目录是否存在,不存在则创建
|
||||
if not exist "%DATA_DIR%" (
|
||||
mkdir "%DATA_DIR%"
|
||||
)
|
||||
|
||||
|
||||
if exist "%MINIO_EXE%" (
|
||||
echo Starting MinIO server...
|
||||
start "Scenario Server" cmd /k "%MINIO_EXE% server ^"%DATA_DIR%^" --console-address ^":%CONSOLE_PORT%^""
|
||||
)
|
||||
|
||||
echo MinIO:
|
||||
echo - MinIO API (Port: 9000)
|
||||
echo - MinIO Web (Port: 9001)
|
||||
|
||||
pause
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,48 +0,0 @@
|
||||
server {
|
||||
listen 18680;
|
||||
server_name _;
|
||||
# gzip config
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_comp_level 9;
|
||||
gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml;
|
||||
gzip_vary on;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
root dist;
|
||||
include mime.types;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:28680/;
|
||||
client_max_body_size 100M;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
|
||||
location /file/ {
|
||||
proxy_pass http://127.0.0.1:9000/;
|
||||
client_max_body_size 5000M;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
error_page 405 =200 $request_uri;
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
worker_processes 1;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
include model-windows.conf;
|
||||
}
|
@ -1,379 +0,0 @@
|
||||
;iss
|
||||
|
||||
; 构建时间:1.0.20 => 2025-8-18 17:29:09
|
||||
#define MyAppName "模型管理"
|
||||
#define MyAppVersion "1.0.20"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "model"
|
||||
#define MyAppExeNameHump "Model"
|
||||
#define MyAppExeNameUpper "MODEL"
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources_203"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
; 默认配置
|
||||
[Setup]
|
||||
AppId={{7C6B5A4D-3E2F-1G0H-9I8J-7K6L5M4N3O2P}
|
||||
; 默认安装路径
|
||||
DefaultDirName={autopf}\{#MyAppFirstPath}
|
||||
; 安装密码
|
||||
Password={#InstallPassword}
|
||||
; 是否加密
|
||||
Encryption=yes
|
||||
; ICO图标
|
||||
;SetupIconFile={#MyAppResources}\icon.ico
|
||||
VersionInfoVersion={#MyAppVersion}
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
VersionInfoCompany=
|
||||
VersionInfoDescription={#MyAppName}服务
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
VersionInfoProductName={#MyAppName}
|
||||
|
||||
; 默认配置
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
ChangesAssociations=yes
|
||||
DisableDirPage=no
|
||||
DisableProgramGroupPage=yes
|
||||
Compression=lzma2
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
ChangesEnvironment=yes
|
||||
PrivilegesRequired=admin
|
||||
ArchitecturesAllowed=x64compatible
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
OutputDir=Release\
|
||||
OutputBaseFilename={#MyAppExeNameHump}Setup-{#MyAppVersion}-203
|
||||
UninstallFilesDir={app}\{#MyAppExeName}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}\{#MyAppExeName}.exe
|
||||
|
||||
|
||||
|
||||
; 语言选择
|
||||
[Languages]
|
||||
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
|
||||
|
||||
|
||||
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
; checkablealone 默认选中
|
||||
; unchecked 默认不选中
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
|
||||
|
||||
|
||||
|
||||
;; 程序 ICO
|
||||
[Icons]
|
||||
Name: "{autoprograms}\{#MyAppFirstPath}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}.exe"
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}.exe"; Tasks: desktopicon
|
||||
|
||||
|
||||
|
||||
;; 组件安装方式
|
||||
[Types]
|
||||
; 完整安装所有组件
|
||||
Name: full; Description: 完整组件安装
|
||||
Name: mini; Description: 最小安装;
|
||||
; 自定义安装
|
||||
Name: custom; Description: 自定义安装; Flags: iscustom
|
||||
|
||||
|
||||
|
||||
;; 组件列表选择项
|
||||
[Components]
|
||||
Name: Starter; Description: {#MyAppName} 启动; Types: full;
|
||||
Name: UI; Description: {#MyAppName} UI; Types: full mini;
|
||||
Name: Server; Description: {#MyAppName} Server; Types: full mini;
|
||||
|
||||
Name: MySQL_BIN; Description: MySQL数据库; Types: full; Flags: checkablealone
|
||||
Name: MySQL_DATA; Description: {#MyAppName} Data; Types: full;
|
||||
|
||||
Name: USR; Description: 运行时环境; Types: full mini; Flags: checkablealone
|
||||
Name: JDK21; Description: JDK 21 运行时环境; Types: full; Flags: checkablealone
|
||||
;Name: Redis; Description: 缓存; Types: full; Flags: checkablealone
|
||||
Name: IO; Description: 文件资源服务; Types: full; Flags: checkablealone
|
||||
|
||||
|
||||
|
||||
;; 安装包引入文件列表
|
||||
[Files]
|
||||
; 后端工程+启动器
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; DestName: "patch.exe"; Flags: ignoreversion; Components: Starter;
|
||||
|
||||
;Windows 10 环境,不提供 bat 启动
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server;
|
||||
|
||||
; 更新数据库脚本
|
||||
Source: "{#MyAppResources}\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Server;
|
||||
|
||||
; 前端工程 + Nginx
|
||||
Source: "{#MyAppResources}\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "{#MyAppResources}\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
; Linux 命令集(通用服务)
|
||||
Source: "{#MyAppResources}\usr\*"; DestDir: "{app}\usr\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: USR;
|
||||
|
||||
; 后端启动 JDK 依赖(通用服务)
|
||||
Source: "{#MyAppResources}\java\*"; DestDir: "{app}\jre"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: JDK21;
|
||||
|
||||
; 数据库依赖
|
||||
Source: "{#MyAppResources}\database\ProgramData\*"; DestDir: "{commonappdata}\MySQL"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: MySQL_DATA;
|
||||
Source: "{#MyAppResources}\database\ProgramFiles\*"; DestDir: "{pf}\MySQL"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: MySQL_BIN;
|
||||
|
||||
; MinIO 服务(通用服务)
|
||||
Source: "{#MyAppResources}\io\*"; DestDir: "{app}\io"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: IO;
|
||||
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
[Dirs]
|
||||
Name: "{app}\{#MyAppExeName}\web\logs"; Permissions: users-modify; Components: Starter;
|
||||
Name: "{app}\{#MyAppExeName}\web\temp"; Permissions: users-modify; Components: Starter;
|
||||
|
||||
|
||||
|
||||
;; 安装时注册表与环境变量列表
|
||||
[Registry]
|
||||
; 默认注册信息
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName}\{#MyAppExeName}.exe,0"
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}\{#MyAppExeName}.exe"" ""%1"""
|
||||
|
||||
|
||||
|
||||
; 配置JDK环境变量(通用服务)
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: JDK21; \
|
||||
ValueName: "JDK_21"; ValueData: "{app}\jre";
|
||||
|
||||
|
||||
|
||||
;; MinIO环境变量(通用服务)
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: IO; \
|
||||
ValueName: "X_MIO"; ValueData: "{app}\io";
|
||||
|
||||
|
||||
|
||||
;; Linux(通用服务)
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: USR; \
|
||||
ValueName: "X_COMMAND"; ValueData: "{app}\usr";
|
||||
; 追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Flags: preservestringtype; Components: USR; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%"; Check: NeedsAddPath('%X_COMMAND%');
|
||||
|
||||
|
||||
|
||||
;; MySQL环境变量(注册服务使用)
|
||||
; 可能存在多个服务打通,MySQL环境变量由此变为 X
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_MANAGE_DB_SC"; ValueData: "x_database";
|
||||
; 这两个值,将作为后续判断程序是否已经安装做依据
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_MANAGE_DB_EXE"; ValueData: "{pf}\MySQL\MySQL Server 8.4.5\bin\mysqld.exe";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_MANAGE_DB_COF"; ValueData: "{commonappdata}\MySQL\MySQL Server 8.4\my.ini";
|
||||
|
||||
;; MySQL(通用服务),导入脚本数据使用
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_COMMAND_MYSQL"; ValueData: "{pf}\MySQL\MySQL Server 8.4.5";
|
||||
; 追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Flags: preservestringtype; Components: MySQL_BIN; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND_MYSQL%\bin"; Check: NeedsAddPath('%X_COMMAND_MYSQL%\bin');
|
||||
|
||||
|
||||
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MAIN"; ValueData: "{app}\{#MyAppExeName}";
|
||||
|
||||
;; springboot启动变量(启动程序使用)
|
||||
; 可能存在多个服务打通,变量由lib变为服务名
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MANAGE_BIN"; ValueData: "{app}\{#MyAppExeName}\bin\demo-0.0.1.jar";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MANAGE_DB_SERVER"; ValueData: "127.0.0.1";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MANAGE_DB_PORT"; ValueData: "33306";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_VM_PARAMS"; ValueData: " \
|
||||
--enable-preview \
|
||||
-Dserver.port=28680 \
|
||||
-Dproject.database-name=model \
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
||||
;; 安装完运行的菜单与后续操作
|
||||
; [Run]
|
||||
;; 安装完成后运行 startup.exe
|
||||
; Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: postinstall runascurrentuser waituntilterminated skipifsilent hidewizard;
|
||||
; Filename: "timeout"; Parameters: "/t 2 /nobreak >nul && {app}\{#MyAppExeName}.exe"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: postinstall runascurrentuser waituntilterminated skipifsilent hidewizard;
|
||||
|
||||
|
||||
|
||||
|
||||
;; 自定义函数
|
||||
[Code]
|
||||
|
||||
const
|
||||
WM_SETTINGCHANGE = 26; // 0x001A 的十进制
|
||||
SMTO_ABORTIFHUNG = 2; // 0x0002 的十进制
|
||||
|
||||
// 定义 VC++ 2019 运行时的注册表检查路径
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
wParam: Integer;
|
||||
lParamStr: String;
|
||||
fuFlags: Integer;
|
||||
uTimeout: Integer;
|
||||
var lpdwResult: Integer
|
||||
): Integer;
|
||||
external 'SendMessageTimeoutW@user32.dll stdcall';
|
||||
|
||||
|
||||
// 给 Path 系统环境变量追加环境
|
||||
function NeedsAddPath(Param: string): boolean;
|
||||
var
|
||||
OrigPath: string;
|
||||
begin
|
||||
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
||||
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
||||
'Path', OrigPath)
|
||||
then begin
|
||||
Result := True;
|
||||
exit;
|
||||
end;
|
||||
// 检查路径是否已存在
|
||||
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
|
||||
if Result = True then
|
||||
Result := Pos(';' + Param + '\;', ';' + OrigPath + ';') = 0;
|
||||
end;
|
||||
|
||||
|
||||
// 刷新系统环境
|
||||
procedure RefreshEnvironment;
|
||||
var
|
||||
Res: Integer;
|
||||
begin
|
||||
SendMessageTimeout(
|
||||
HWND_BROADCAST,
|
||||
WM_SETTINGCHANGE,
|
||||
0,
|
||||
'Environment',
|
||||
SMTO_ABORTIFHUNG,
|
||||
5000,
|
||||
Res
|
||||
);
|
||||
end;
|
||||
|
||||
|
||||
// 检查环境变量,路径是否存在空格
|
||||
function CheckRegistryPath(Path: string): Boolean;
|
||||
begin
|
||||
if Pos(' ', Path) > 0 then
|
||||
begin
|
||||
SuppressibleMsgBox('安装程序错误: 检测到无效的注册表路径 "' + Path + '"。路径不能包含空格。', mbCriticalError, MB_OK, IDOK);
|
||||
Abort;
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
// 以 UTF-8 写入文件
|
||||
function SaveStringToUTF8File(const FileName, Content: String; Append: Boolean): Boolean;
|
||||
var
|
||||
UTF8Content: AnsiString;
|
||||
begin
|
||||
UTF8Content := UTF8Encode(Content);
|
||||
Result := SaveStringToFile(FileName, UTF8Content, Append);
|
||||
end;
|
||||
|
||||
|
||||
// 检查是否已安装 VC++ 2019 运行时
|
||||
function IsVC2019Installed: Boolean;
|
||||
var
|
||||
Version: String;
|
||||
begin
|
||||
// 检查64位版本
|
||||
Result := RegQueryStringValue(
|
||||
HKLM,
|
||||
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64',
|
||||
'Version',
|
||||
Version
|
||||
) or RegKeyExists(
|
||||
HKLM,
|
||||
'SOFTWARE\Classes\Installer\Dependencies\' + VC2019_REDIST_X64
|
||||
);
|
||||
|
||||
// 如果是32位系统或需要检查32位运行时
|
||||
if not Result and (not IsWin64) then
|
||||
Result := RegQueryStringValue(
|
||||
HKLM,
|
||||
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86',
|
||||
'Version',
|
||||
Version
|
||||
) or RegKeyExists(
|
||||
HKLM,
|
||||
'SOFTWARE\Classes\Installer\Dependencies\' + VC2019_REDIST_X86
|
||||
);
|
||||
end;
|
||||
|
||||
|
||||
// 在安装前检查
|
||||
function InitializeSetup: Boolean;
|
||||
begin
|
||||
// 默认允许安装继续
|
||||
Result := True;
|
||||
// 如果 VC++ 2019 未安装
|
||||
if not IsVC2019Installed then
|
||||
begin
|
||||
MsgBox('本程序需要 Microsoft Visual C++ 2019 运行时才能继续(1001)', mbError, MB_OK)
|
||||
// 中止安装
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-web.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-console.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-x86.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-x64.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
|
||||
|
||||
;; 卸载时删除的文件
|
||||
[UninstallDelete]
|
||||
Type: filesandordirs; Name: "{app}\{#MyAppExeName}\log"
|
||||
Type: filesandordirs; Name: "{app}\{#MyAppExeName}\script"
|
||||
Type: filesandordirs; Name: "{app}\{#MyAppExeName}\patch"
|
@ -1,379 +0,0 @@
|
||||
;iss
|
||||
|
||||
; 构建时间:2025-8-18 14:13:19
|
||||
#define MyAppName "模型管理"
|
||||
#define MyAppVersion "1.0.19"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "model"
|
||||
#define MyAppExeNameHump "Model"
|
||||
#define MyAppExeNameUpper "MODEL"
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources_783"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
; 默认配置
|
||||
[Setup]
|
||||
AppId={{7C6B5A4D-3E2F-1G0H-9I8J-7K6L5M4N3O2P}
|
||||
; 默认安装路径
|
||||
DefaultDirName={autopf}\{#MyAppFirstPath}
|
||||
; 安装密码
|
||||
Password={#InstallPassword}
|
||||
; 是否加密
|
||||
Encryption=yes
|
||||
; ICO图标
|
||||
SetupIconFile={#MyAppResources}\icon.ico
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
VersionInfoCompany=
|
||||
VersionInfoDescription={#MyAppName}服务
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
VersionInfoProductName={#MyAppName}
|
||||
|
||||
; 默认配置
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
ChangesAssociations=yes
|
||||
DisableDirPage=no
|
||||
DisableProgramGroupPage=yes
|
||||
Compression=lzma2
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
ChangesEnvironment=yes
|
||||
PrivilegesRequired=admin
|
||||
ArchitecturesAllowed=x64compatible
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
OutputDir=Release\
|
||||
OutputBaseFilename={#MyAppExeNameHump}Setup-{#MyAppVersion}-783
|
||||
UninstallFilesDir={app}\{#MyAppExeName}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}\{#MyAppExeName}.exe
|
||||
|
||||
|
||||
|
||||
; 语言选择
|
||||
[Languages]
|
||||
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
|
||||
|
||||
|
||||
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
; checkablealone 默认选中
|
||||
; unchecked 默认不选中
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
|
||||
|
||||
|
||||
|
||||
;; 程序 ICO
|
||||
[Icons]
|
||||
; ====================== ========================================================= 此处使用 console 显式console启动
|
||||
Name: "{autoprograms}\{#MyAppFirstPath}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}-console.exe"
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}-console.exe"; Tasks: desktopicon
|
||||
|
||||
|
||||
|
||||
;; 组件安装方式
|
||||
[Types]
|
||||
; 完整安装所有组件
|
||||
Name: full; Description: 完整组件安装
|
||||
Name: mini; Description: 最小安装;
|
||||
; 自定义安装
|
||||
Name: custom; Description: 自定义安装; Flags: iscustom
|
||||
|
||||
|
||||
|
||||
;; 组件列表选择项
|
||||
[Components]
|
||||
Name: Starter; Description: {#MyAppName} 启动; Types: full;
|
||||
Name: UI; Description: {#MyAppName} UI; Types: full mini;
|
||||
Name: Server; Description: {#MyAppName} Server; Types: full mini;
|
||||
|
||||
Name: MySQL_BIN; Description: MySQL数据库; Types: full; Flags: checkablealone
|
||||
Name: MySQL_DATA; Description: {#MyAppName} Data; Types: full;
|
||||
|
||||
Name: USR; Description: 运行时环境; Types: full mini; Flags: checkablealone
|
||||
Name: JDK21; Description: JDK 21 运行时环境; Types: full; Flags: checkablealone
|
||||
;Name: Redis; Description: 缓存; Types: full; Flags: checkablealone
|
||||
Name: IO; Description: 文件资源服务; Types: full; Flags: checkablealone
|
||||
|
||||
|
||||
|
||||
;; 安装包引入文件列表
|
||||
[Files]
|
||||
; 后端工程+启动器
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; DestName: "patch.exe"; Flags: ignoreversion; Components: Starter;
|
||||
|
||||
;Windows 10 环境,不提供 bat 启动
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter;
|
||||
Source: "{#MyAppResources}\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server;
|
||||
|
||||
; 更新数据库脚本
|
||||
Source: "{#MyAppResources}\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Server;
|
||||
|
||||
; 前端工程 + Nginx
|
||||
Source: "{#MyAppResources}\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "{#MyAppResources}\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
; Linux 命令集(通用服务)
|
||||
Source: "{#MyAppResources}\usr\*"; DestDir: "{app}\usr\"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: USR;
|
||||
|
||||
; 后端启动 JDK 依赖(通用服务)
|
||||
Source: "{#MyAppResources}\java\*"; DestDir: "{app}\jre"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: JDK21;
|
||||
|
||||
; 数据库依赖
|
||||
Source: "{#MyAppResources}\database\ProgramData\*"; DestDir: "{commonappdata}\MySQL"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: MySQL_DATA;
|
||||
Source: "{#MyAppResources}\database\ProgramFiles\*"; DestDir: "{pf}\MySQL"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: MySQL_BIN;
|
||||
|
||||
; MinIO 服务(通用服务)
|
||||
Source: "{#MyAppResources}\io\*"; DestDir: "{app}\io"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: IO;
|
||||
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
[Dirs]
|
||||
Name: "{app}\{#MyAppExeName}\web\logs"; Permissions: users-modify; Components: Starter;
|
||||
Name: "{app}\{#MyAppExeName}\web\temp"; Permissions: users-modify; Components: Starter;
|
||||
|
||||
|
||||
|
||||
;; 安装时注册表与环境变量列表
|
||||
[Registry]
|
||||
; 默认注册信息
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName}\{#MyAppExeName}.exe,0"
|
||||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}\{#MyAppExeName}.exe"" ""%1"""
|
||||
|
||||
|
||||
|
||||
; 配置JDK环境变量(通用服务)
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: JDK21; \
|
||||
ValueName: "JDK_21"; ValueData: "{app}\jre";
|
||||
|
||||
|
||||
|
||||
;; MinIO环境变量(通用服务)
|
||||
;Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: IO; \
|
||||
ValueName: "X_MIO"; ValueData: "{app}\io";
|
||||
|
||||
|
||||
|
||||
;; Linux(通用服务)
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: USR; \
|
||||
ValueName: "X_COMMAND"; ValueData: "{app}\usr";
|
||||
; 追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Flags: preservestringtype; Components: USR; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND%"; Check: NeedsAddPath('%X_COMMAND%');
|
||||
|
||||
|
||||
|
||||
;; MySQL环境变量(注册服务使用)
|
||||
; 可能存在多个服务打通,MySQL环境变量由此变为 X
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_MANAGE_DB_SC"; ValueData: "x_database";
|
||||
; 这两个值,将作为后续判断程序是否已经安装做依据
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_MANAGE_DB_EXE"; ValueData: "{pf}\MySQL\MySQL Server 8.4.5\bin\mysqld.exe";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_MANAGE_DB_COF"; ValueData: "{commonappdata}\MySQL\MySQL Server 8.4\my.ini";
|
||||
|
||||
;; MySQL(通用服务),导入脚本数据使用
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: MySQL_BIN; \
|
||||
ValueName: "X_COMMAND_MYSQL"; ValueData: "{pf}\MySQL\MySQL Server 8.4.5";
|
||||
; 追加到 PATH 变量
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; Flags: preservestringtype; Components: MySQL_BIN; AfterInstall: RefreshEnvironment; \
|
||||
ValueName: "Path"; ValueData: "{olddata};%X_COMMAND_MYSQL%\bin"; Check: NeedsAddPath('%X_COMMAND_MYSQL%\bin');
|
||||
|
||||
|
||||
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MAIN"; ValueData: "{app}\{#MyAppExeName}";
|
||||
|
||||
;; springboot启动变量(启动程序使用)
|
||||
; 可能存在多个服务打通,变量由lib变为服务名
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MANAGE_BIN"; ValueData: "{app}\{#MyAppExeName}\bin\demo-0.0.1.jar";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MANAGE_DB_SERVER"; ValueData: "127.0.0.1";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_MANAGE_DB_PORT"; ValueData: "33306";
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; Components: Server; \
|
||||
ValueName: "{#MyAppExeNameUpper}_VM_PARAMS"; ValueData: " \
|
||||
--enable-preview \
|
||||
-Dserver.port=28680 \
|
||||
-Dproject.database-name=model \
|
||||
";
|
||||
|
||||
|
||||
|
||||
|
||||
;; 安装完运行的菜单与后续操作
|
||||
; [Run]
|
||||
;; 安装完成后运行 startup.exe
|
||||
; Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: postinstall runascurrentuser waituntilterminated skipifsilent hidewizard;
|
||||
; Filename: "timeout"; Parameters: "/t 2 /nobreak >nul && {app}\{#MyAppExeName}.exe"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: postinstall runascurrentuser waituntilterminated skipifsilent hidewizard;
|
||||
|
||||
|
||||
|
||||
|
||||
;; 自定义函数
|
||||
[Code]
|
||||
|
||||
const
|
||||
WM_SETTINGCHANGE = 26; // 0x001A 的十进制
|
||||
SMTO_ABORTIFHUNG = 2; // 0x0002 的十进制
|
||||
|
||||
// 定义 VC++ 2019 运行时的注册表检查路径
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
wParam: Integer;
|
||||
lParamStr: String;
|
||||
fuFlags: Integer;
|
||||
uTimeout: Integer;
|
||||
var lpdwResult: Integer
|
||||
): Integer;
|
||||
external 'SendMessageTimeoutW@user32.dll stdcall';
|
||||
|
||||
|
||||
// 给 Path 系统环境变量追加环境
|
||||
function NeedsAddPath(Param: string): boolean;
|
||||
var
|
||||
OrigPath: string;
|
||||
begin
|
||||
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
||||
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
||||
'Path', OrigPath)
|
||||
then begin
|
||||
Result := True;
|
||||
exit;
|
||||
end;
|
||||
// 检查路径是否已存在
|
||||
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
|
||||
if Result = True then
|
||||
Result := Pos(';' + Param + '\;', ';' + OrigPath + ';') = 0;
|
||||
end;
|
||||
|
||||
|
||||
// 刷新系统环境
|
||||
procedure RefreshEnvironment;
|
||||
var
|
||||
Res: Integer;
|
||||
begin
|
||||
SendMessageTimeout(
|
||||
HWND_BROADCAST,
|
||||
WM_SETTINGCHANGE,
|
||||
0,
|
||||
'Environment',
|
||||
SMTO_ABORTIFHUNG,
|
||||
5000,
|
||||
Res
|
||||
);
|
||||
end;
|
||||
|
||||
|
||||
// 检查环境变量,路径是否存在空格
|
||||
function CheckRegistryPath(Path: string): Boolean;
|
||||
begin
|
||||
if Pos(' ', Path) > 0 then
|
||||
begin
|
||||
SuppressibleMsgBox('安装程序错误: 检测到无效的注册表路径 "' + Path + '"。路径不能包含空格。', mbCriticalError, MB_OK, IDOK);
|
||||
Abort;
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
// 以 UTF-8 写入文件
|
||||
function SaveStringToUTF8File(const FileName, Content: String; Append: Boolean): Boolean;
|
||||
var
|
||||
UTF8Content: AnsiString;
|
||||
begin
|
||||
UTF8Content := UTF8Encode(Content);
|
||||
Result := SaveStringToFile(FileName, UTF8Content, Append);
|
||||
end;
|
||||
|
||||
|
||||
// 检查是否已安装 VC++ 2019 运行时
|
||||
function IsVC2019Installed: Boolean;
|
||||
var
|
||||
Version: String;
|
||||
begin
|
||||
// 检查64位版本
|
||||
Result := RegQueryStringValue(
|
||||
HKLM,
|
||||
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64',
|
||||
'Version',
|
||||
Version
|
||||
) or RegKeyExists(
|
||||
HKLM,
|
||||
'SOFTWARE\Classes\Installer\Dependencies\' + VC2019_REDIST_X64
|
||||
);
|
||||
|
||||
// 如果是32位系统或需要检查32位运行时
|
||||
if not Result and (not IsWin64) then
|
||||
Result := RegQueryStringValue(
|
||||
HKLM,
|
||||
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86',
|
||||
'Version',
|
||||
Version
|
||||
) or RegKeyExists(
|
||||
HKLM,
|
||||
'SOFTWARE\Classes\Installer\Dependencies\' + VC2019_REDIST_X86
|
||||
);
|
||||
end;
|
||||
|
||||
|
||||
// 在安装前检查
|
||||
function InitializeSetup: Boolean;
|
||||
begin
|
||||
// 默认允许安装继续
|
||||
Result := True;
|
||||
// 如果 VC++ 2019 未安装
|
||||
if not IsVC2019Installed then
|
||||
begin
|
||||
MsgBox('本程序需要 Microsoft Visual C++ 2019 运行时才能继续(1001)', mbError, MB_OK)
|
||||
// 中止安装
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
[UninstallRun]
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-web.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-console.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-x86.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}-x64.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
Filename: "taskkill"; Parameters: "-f -im {#MyAppExeName}.exe"; Flags: runascurrentuser runhidden waituntilterminated
|
||||
|
||||
|
||||
;; 卸载时删除的文件
|
||||
[UninstallDelete]
|
||||
Type: filesandordirs; Name: "{app}\{#MyAppExeName}\log"
|
||||
Type: filesandordirs; Name: "{app}\{#MyAppExeName}\script"
|
||||
Type: filesandordirs; Name: "{app}\{#MyAppExeName}\patch"
|
@ -1,25 +0,0 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
chcp 65001 >nul
|
||||
title Initialization
|
||||
|
||||
set "BASE_PATH=Resources/"
|
||||
|
||||
echo [INFO] 正在创建 【模型】 初始化构建安装包目录结构
|
||||
for %%f in (
|
||||
"database"
|
||||
"dist"
|
||||
"io"
|
||||
"java"
|
||||
"script/model"
|
||||
"server"
|
||||
"usr"
|
||||
"web"
|
||||
) do (
|
||||
echo [INFO] 创建: %%~f
|
||||
mkdir "%BASE_PATH%/%%~f"
|
||||
echo.
|
||||
)
|
||||
|
||||
pause
|
||||
endlocal
|
@ -1,7 +1,7 @@
|
||||
;iss
|
||||
|
||||
#define MyAppName "想定筹划"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppVersion "v1.0.0"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "scenario"
|
||||
@ -10,24 +10,20 @@
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
|
||||
; 默认配置
|
||||
[Setup]
|
||||
AppId={{9C7D5E4F-2E1B-4A3F-8D9C-3A2F5B8C1D4E}
|
||||
; 默认安装路径
|
||||
DefaultDirName={localappdata}\{#MyAppFirstPath}
|
||||
DefaultDirName={localappdata}\XManage
|
||||
; 安装密码
|
||||
Password={#InstallPassword}
|
||||
Password=20250813
|
||||
; 是否加密
|
||||
Encryption=yes
|
||||
; ICO图标
|
||||
;SetupIconFile={#MyAppResources}\icon.ico
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
;SetupIconFile=Resources\icon.ico
|
||||
VersionInfoProductVersion=1.0.0
|
||||
VersionInfoCompany=
|
||||
VersionInfoDescription={#MyAppName}服务
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
@ -57,20 +53,17 @@ UninstallFilesDir={app}\{#MyAppExeName}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}\{#MyAppExeName}.bat
|
||||
|
||||
|
||||
|
||||
; 语言选择
|
||||
[Languages]
|
||||
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
|
||||
|
||||
|
||||
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
|
||||
|
||||
;; 程序 ICO
|
||||
[Icons]
|
||||
;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}.exe"
|
||||
@ -78,7 +71,6 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}.bat"; Tasks: desktopicon
|
||||
|
||||
|
||||
|
||||
;; 组件安装方式
|
||||
[Types]
|
||||
; 完整安装所有组件
|
||||
@ -88,7 +80,6 @@ Name: "mini"; Description: "最小安装";
|
||||
Name: custom; Description: 自定义安装; Flags: iscustom
|
||||
|
||||
|
||||
|
||||
;; 组件列表选择项
|
||||
[Components]
|
||||
Name: Starter; Description: {#MyAppName} 启动; Types: full;
|
||||
@ -97,26 +88,24 @@ Name: Server; Description: {#MyAppName} Server; Types: full mini;
|
||||
Name: Data; Description: {#MyAppName} Data; Types: full;
|
||||
|
||||
|
||||
|
||||
;; 安装包引入文件列表
|
||||
[Files]
|
||||
; 后端工程+启动器
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter
|
||||
Source: "{#MyAppResources}\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server
|
||||
Source: "Resources\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter
|
||||
Source: "Resources\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server
|
||||
|
||||
; 更新数据库脚本
|
||||
Source: "{#MyAppResources}\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Data
|
||||
Source: "Resources\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Data
|
||||
|
||||
; 前端工程 + Nginx
|
||||
Source: "{#MyAppResources}\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "{#MyAppResources}\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
Source: "Resources\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "Resources\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
@ -125,7 +114,6 @@ Name: "{app}\{#MyAppExeName}\web\logs"; Permissions: users-modify; Components: S
|
||||
Name: "{app}\{#MyAppExeName}\web\temp"; Permissions: users-modify; Components: Starter;
|
||||
|
||||
|
||||
|
||||
;; 安装时注册表与环境变量列表
|
||||
[Registry]
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; \
|
||||
@ -168,14 +156,6 @@ const
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
|
@ -1,7 +1,7 @@
|
||||
;iss
|
||||
|
||||
#define MyAppName "仿真实验"
|
||||
#define MyAppVersion "1.0.0"
|
||||
#define MyAppVersion "v1.0.0"
|
||||
#define MyAppPublisher "X"
|
||||
#define MyAppURL "~"
|
||||
#define MyAppExeName "simulation"
|
||||
@ -10,9 +10,6 @@
|
||||
#define MyAppAssocName MyAppName + " File"
|
||||
#define MyAppAssocExt ".myp"
|
||||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
|
||||
#define MyAppFirstPath "XManage"
|
||||
#define MyAppResources "Resources"
|
||||
#define InstallPassword GetDateTimeString('yyyymmdd', '', '')
|
||||
|
||||
|
||||
|
||||
@ -20,15 +17,15 @@
|
||||
[Setup]
|
||||
AppId={{550E8400-E29B-41D4-A716-446655440000}
|
||||
; 默认安装路径
|
||||
DefaultDirName={localappdata}\{#MyAppFirstPath}
|
||||
DefaultDirName={localappdata}\XManage
|
||||
; 安装密码
|
||||
Password={#InstallPassword}
|
||||
Password=20250813
|
||||
; 是否加密
|
||||
Encryption=yes
|
||||
; ICO图标
|
||||
;SetupIconFile={#MyAppResources}\icon.ico
|
||||
;SetupIconFile=Resources\icon.ico
|
||||
;UninstallDisplayIcon={app}\{#MyAppExeName}.exe
|
||||
VersionInfoProductVersion={#MyAppVersion}
|
||||
VersionInfoProductVersion=1.0.0
|
||||
VersionInfoCompany=
|
||||
VersionInfoDescription=仿真实验服务
|
||||
VersionInfoCopyright=CopyRight © 2025
|
||||
@ -57,20 +54,17 @@ UninstallFilesDir={app}\{#MyAppExeName}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}\{#MyAppExeName}.bat
|
||||
|
||||
|
||||
|
||||
; 语言选择
|
||||
[Languages]
|
||||
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
|
||||
|
||||
|
||||
|
||||
;; 任务
|
||||
[Tasks]
|
||||
; 是否创建桌面图标
|
||||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
||||
|
||||
|
||||
|
||||
;; 程序 ICO
|
||||
[Icons]
|
||||
;Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}.exe"
|
||||
@ -78,7 +72,6 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
|
||||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}\{#MyAppExeName}.bat"; Tasks: desktopicon
|
||||
|
||||
|
||||
|
||||
;; 组件安装方式
|
||||
[Types]
|
||||
; 完整安装所有组件
|
||||
@ -88,7 +81,6 @@ Name: "mini"; Description: "最小安装";
|
||||
Name: custom; Description: 自定义安装; Flags: iscustom
|
||||
|
||||
|
||||
|
||||
;; 组件列表选择项
|
||||
[Components]
|
||||
Name: Starter; Description: {#MyAppName} 启动; Types: full;
|
||||
@ -97,26 +89,24 @@ Name: Server; Description: {#MyAppName} Server; Types: full mini;
|
||||
Name: Data; Description: {#MyAppName} Data; Types: full;
|
||||
|
||||
|
||||
|
||||
;; 安装包引入文件列表
|
||||
[Files]
|
||||
; 后端工程+启动器
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "{#MyAppResources}\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-console.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-x64.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\{#MyAppExeName}-x86.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
;Source: "Resources\patch.exe"; DestDir: "{app}\{#MyAppExeName}"; Flags: ignoreversion; Components: Starter
|
||||
|
||||
Source: "{#MyAppResources}\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter
|
||||
Source: "{#MyAppResources}\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server
|
||||
Source: "Resources\{#MyAppExeName}.bat"; DestDir: "{app}\{#MyAppExeName}"; DestName: "{#MyAppExeName}.bat"; Flags: ignoreversion; Components: Starter
|
||||
Source: "Resources\server\demo-0.0.1.jar"; DestDir: "{app}\{#MyAppExeName}\bin"; Flags: ignoreversion; Components: Server
|
||||
|
||||
; 更新数据库脚本
|
||||
Source: "{#MyAppResources}\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Data
|
||||
Source: "Resources\script\*"; DestDir: "{app}\{#MyAppExeName}\script"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Data
|
||||
|
||||
; 前端工程 + Nginx
|
||||
Source: "{#MyAppResources}\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "{#MyAppResources}\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
Source: "Resources\web\*"; DestDir: "{app}\{#MyAppExeName}\web"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: Starter;
|
||||
Source: "Resources\dist\*"; DestDir: "{app}\{#MyAppExeName}\web\dist"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: UI;
|
||||
|
||||
|
||||
;; 创建必要目录
|
||||
@ -125,7 +115,6 @@ Name: "{app}\{#MyAppExeName}\web\logs"; Permissions: users-modify; Components: S
|
||||
Name: "{app}\{#MyAppExeName}\web\temp"; Permissions: users-modify; Components: Starter;
|
||||
|
||||
|
||||
|
||||
;; 安装时注册表与环境变量列表
|
||||
[Registry]
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; Flags: uninsdeletevalue; \
|
||||
@ -168,15 +157,7 @@ const
|
||||
// 定义 VC++ 2019 运行时的注册表检查路径
|
||||
VC2019_REDIST_X64 = '{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}';
|
||||
VC2019_REDIST_X86 = '{422B21A3-06FA-3F2F-A6C6-21BCC9B8E2F3}';
|
||||
|
||||
|
||||
// 获取安装密码
|
||||
function GetInstallPassword(): string;
|
||||
begin
|
||||
Result := GetDateTimeString('yyyymmdd', '', '');
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function SendMessageTimeout(
|
||||
hWnd: Integer;
|
||||
Msg: Integer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user