diff --git a/app/core/config.py b/app/core/config.py index 25d8460..30f8417 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -52,7 +52,7 @@ from typing import Union, Dict, List, Tuple class AppConfig: - VERSION = "4.2.5.7" + VERSION = "4.2.5.8" def __init__(self) -> None: diff --git a/app/core/task_manager.py b/app/core/task_manager.py index 4790a18..41acd51 100644 --- a/app/core/task_manager.py +++ b/app/core/task_manager.py @@ -66,6 +66,7 @@ class Task(QThread): self.question_response.connect(lambda: print("response")) + @logger.catch def run(self): if "设置MAA" in self.mode: diff --git a/app/models/MAA.py b/app/models/MAA.py index 8fb9e6f..461717c 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -213,8 +213,16 @@ class MaaManager(QObject): break # j == 0 剿灭模式;满足条件跳过剿灭 - if j == 0 and self.set["RunSet"].get("RunSet_AnnihilationWeeklyLimit", True) and self.weekly_annihilation_limit_reached: - logger.info(f"{self.name} | 用户: {self.current_user} - 本周剿灭模式已达上限,跳过执行剿灭任务") + if ( + j == 0 + and self.set["RunSet"].get( + "RunSet_AnnihilationWeeklyLimit", True + ) + and self.weekly_annihilation_limit_reached + ): + logger.info( + f"{self.name} | 用户: {self.current_user} - 本周剿灭模式已达上限,跳过执行剿灭任务" + ) run_book[j] = True continue diff --git a/app/services/notification.py b/app/services/notification.py index 6e4178e..0b0a315 100644 --- a/app/services/notification.py +++ b/app/services/notification.py @@ -159,9 +159,24 @@ class Notification(QWidget): """使用Server酱推送通知""" if Config.global_config.get(Config.global_config.notify_IfServerChan): - send_key = Config.global_config.get( - Config.global_config.notify_ServerChanKey - ) + + if ( + Config.global_config.get(Config.global_config.notify_ServerChanKey) + == "" + ): + logger.error("请正确设置Server酱的SendKey") + self.push_info_bar.emit( + "error", + "Server酱通知推送异常", + "请正确设置Server酱的SendKey", + -1, + ) + return None + else: + send_key = Config.global_config.get( + Config.global_config.notify_ServerChanKey + ) + option = {} is_valid = lambda s: s == "" or ( s == "|".join(s.split("|")) and (s.count("|") == 0 or all(s.split("|"))) @@ -170,11 +185,17 @@ class Notification(QWidget): is_valid => True, 如果启用的话需要正确设置Tag和Channel。 允许空的Tag和Channel即不启用,但不允许例如a||b,|a|b,a|b|,|||| """ - send_tag = Config.global_config.get( - Config.global_config.notify_ServerChanTag + send_tag = "|".join( + _.strip() + for _ in Config.global_config.get( + Config.global_config.notify_ServerChanTag + ).split("|") ) - send_channel = Config.global_config.get( - Config.global_config.notify_ServerChanChannel + send_channel = "|".join( + _.strip() + for _ in Config.global_config.get( + Config.global_config.notify_ServerChanChannel + ).split("|") ) if is_valid(send_tag): @@ -219,6 +240,22 @@ class Notification(QWidget): def CompanyWebHookBotPush(self, title, content): """使用企业微信群机器人推送通知""" if Config.global_config.get(Config.global_config.notify_IfCompanyWebHookBot): + + if ( + Config.global_config.get( + Config.global_config.notify_CompanyWebHookBotUrl + ) + == "" + ): + logger.error("请正确设置企业微信群机器人的WebHook地址") + self.push_info_bar.emit( + "error", + "企业微信群机器人通知推送异常", + "请正确设置企业微信群机器人的WebHook地址", + -1, + ) + return None + content = f"{title}\n{content}" data = {"msgtype": "text", "text": {"content": content}} response = requests.post( @@ -258,21 +295,21 @@ class Notification(QWidget): self.send_mail( "文本", "AUTO_MAA测试通知", - "这是 AUTO_MAA 外部通知测试信息。如果你看到了这段内容,说明 AUTO_MAA 的通知功能已经正确配置且可以正常工作!" + "这是 AUTO_MAA 外部通知测试信息。如果你看到了这段内容,说明 AUTO_MAA 的通知功能已经正确配置且可以正常工作!", ) # 发送Server酱通知 if Config.global_config.get(Config.global_config.notify_IfServerChan): self.ServerChanPush( "AUTO_MAA测试通知", - "这是 AUTO_MAA 外部通知测试信息。如果你看到了这段内容,说明 AUTO_MAA 的通知功能已经正确配置且可以正常工作!" + "这是 AUTO_MAA 外部通知测试信息。如果你看到了这段内容,说明 AUTO_MAA 的通知功能已经正确配置且可以正常工作!", ) # 发送企业微信机器人通知 if Config.global_config.get(Config.global_config.notify_IfCompanyWebHookBot): self.CompanyWebHookBotPush( "AUTO_MAA测试通知", - "这是 AUTO_MAA 外部通知测试信息。如果你看到了这段内容,说明 AUTO_MAA 的通知功能已经正确配置且可以正常工作!" + "这是 AUTO_MAA 外部通知测试信息。如果你看到了这段内容,说明 AUTO_MAA 的通知功能已经正确配置且可以正常工作!", ) return True diff --git a/resources/version.json b/resources/version.json index a668a91..5a01106 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,8 +1,14 @@ { - "main_version": "4.2.5.7", + "main_version": "4.2.5.8", "updater_version": "1.2.0.2", "announcement": "\n## 新增功能\n- 屏蔽MuMu模拟器开屏广告功能上线\n- 更新器支持多线程下载\n- 添加强制关闭ADB与模拟器等增强任务项\n## 修复BUG\n- 修复统计信息HTML模板公招匹配错误\n- 修复密码显示按钮动画异常\n- 修复`检测到MAA未能实际执行任务`报错被异常屏蔽\n- 修复MAA超时判定异常失效\n## 程序优化\n- 关机等电源操作添加100s倒计时\n- 人工排查弹窗方法优化\n- 人工排查时自动屏蔽静默操作\n- 公告样式优化", "version_info": { + "4.2.5.8":{ + "程序优化": [ + "loguru开始捕获子线程异常", + "通知服务添加校验项" + ] + }, "4.2.5.7":{ "新增功能": [ "添加每周剿灭模式上限功能"