|
|
@@ -16,6 +16,8 @@ from app import login_account, run_threading_order, run_daily_job, run_manual_jo
|
|
|
from litter_helper import Ui_menu # 确保这个导入路径是正确的
|
|
|
from tools.utils import save_all_proxy_ip_v3
|
|
|
|
|
|
+import winreg
|
|
|
+
|
|
|
# 定义 Redis 安装程序路径
|
|
|
REDIS_INSTALLER_PATH = "Redis-x64-5.0.14.1.msi" # 替换为实际的安装程序路径
|
|
|
|
|
|
@@ -246,15 +248,12 @@ class MainWindow(QMainWindow, Ui_menu):
|
|
|
if system == "Windows":
|
|
|
# 检查 Redis 服务是否正在运行
|
|
|
try:
|
|
|
- # 使用 ctypes 库检查 Redis 服务是否正在运行
|
|
|
- service_manager = ctypes.windll.advapi32.OpenServiceA(None, b"Redis")
|
|
|
- print(f"service_manager: {service_manager}")
|
|
|
- if service_manager:
|
|
|
- ctypes.windll.advapi32.CloseServiceHandle(service_manager)
|
|
|
- print("Redis 服务已安装并正在运行")
|
|
|
- return
|
|
|
- except Exception as e:
|
|
|
- print(f"Redis 服务未安装或未运行: {e}")
|
|
|
+ key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SYSTEM\CurrentControlSet\Services\Redis")
|
|
|
+ winreg.CloseKey(key)
|
|
|
+ print("Redis 服务已安装并正在运行")
|
|
|
+ return
|
|
|
+ except FileNotFoundError as ex:
|
|
|
+ print(f"Redis 服务未安装或未运行")
|
|
|
|
|
|
# 如果 Redis 服务未安装,则启动安装程序
|
|
|
if REDIS_INSTALLER_PATH:
|