feat(core): 初步完成六星公招通知
This commit is contained in:
@@ -466,7 +466,7 @@ class AppConfig:
|
||||
cur.close()
|
||||
db.close()
|
||||
|
||||
def save_maa_log(self, log_path: Path, logs: list, maa_result: str) -> None:
|
||||
def save_maa_log(self, log_path: Path, logs: list, maa_result: str) -> bool:
|
||||
"""保存MAA日志"""
|
||||
|
||||
data: Dict[str, Union[str, Dict[str, Union[int, dict]]]] = {
|
||||
@@ -475,6 +475,8 @@ class AppConfig:
|
||||
"maa_result": maa_result,
|
||||
}
|
||||
|
||||
if_six_star = False
|
||||
|
||||
# 公招统计(仅统计招募到的)
|
||||
confirmed_recruit = False
|
||||
current_star_level = None
|
||||
@@ -490,6 +492,8 @@ class AppConfig:
|
||||
star_match = re.search(r"(\d+)\s*★ Tags", logs[i])
|
||||
if star_match:
|
||||
current_star_level = f"{star_match.group(1)}★"
|
||||
if current_star_level == "6★":
|
||||
if_six_star = True
|
||||
|
||||
if "已确认招募" in logs[i]: # 只有确认招募后才统计
|
||||
confirmed_recruit = True
|
||||
@@ -553,6 +557,8 @@ class AppConfig:
|
||||
|
||||
self.merge_maa_logs("所有项", log_path.parent)
|
||||
|
||||
return if_six_star
|
||||
|
||||
def merge_maa_logs(self, mode: str, logs_path: Union[Path, List[Path]]) -> dict:
|
||||
"""合并指定数据统计信息文件"""
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ class MaaManager(QObject):
|
||||
Config.silence_list.remove(self.emulator_path)
|
||||
|
||||
# 保存运行日志以及统计信息
|
||||
Config.save_maa_log(
|
||||
if_six_star = Config.save_maa_log(
|
||||
Config.app_path
|
||||
/ f"history/{curdate}/{self.data[user[2]][0]}/{start_time.strftime("%H-%M-%S")}.log",
|
||||
self.check_maa_log(start_time, mode_book[j]),
|
||||
@@ -302,6 +302,14 @@ class MaaManager(QObject):
|
||||
/ f"history/{curdate}/{self.data[user[2]][0]}/{start_time.strftime("%H-%M-%S")}.json",
|
||||
)
|
||||
|
||||
if if_six_star:
|
||||
|
||||
self.push_notification(
|
||||
"公招六星",
|
||||
f"喜报:用户 {user[0]} 公招出六星啦!",
|
||||
"好羡慕~",
|
||||
)
|
||||
|
||||
# 成功完成代理的用户修改相关参数
|
||||
if run_book[0] and run_book[1]:
|
||||
if self.data[user[2]][14] == 0 and self.data[user[2]][3] != -1:
|
||||
@@ -1314,3 +1322,13 @@ class MaaManager(QObject):
|
||||
Notify.send_mail("网页", title, html_content)
|
||||
Notify.ServerChanPush(title, f"{message_text}\n\nAUTO_MAA 敬上")
|
||||
Notify.CompanyWebHookBotPush(title, f"{message_text}AUTO_MAA 敬上")
|
||||
|
||||
elif mode == "公招六星":
|
||||
|
||||
Notify.send_mail(
|
||||
"文本",
|
||||
title,
|
||||
f"{message}\n\nAUTO_MAA 敬上\n\n我们根据您在 AUTO_MAA 中的设置发送了这封电子邮件,本邮件无需回复\n",
|
||||
)
|
||||
Notify.ServerChanPush(title, f"{message}\n\nAUTO_MAA 敬上")
|
||||
Notify.CompanyWebHookBotPush(title, f"{message}AUTO_MAA 敬上")
|
||||
|
||||
Reference in New Issue
Block a user