Merge branch 'notice_dev' into dev
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:
|
||||
"""合并指定数据统计信息文件"""
|
||||
|
||||
@@ -787,12 +793,16 @@ class GlobalConfig(QConfig):
|
||||
ui_location = ConfigItem("UI", "location", "100x100")
|
||||
ui_maximized = ConfigItem("UI", "maximized", False, BoolValidator())
|
||||
|
||||
notify_IfSendErrorOnly = ConfigItem(
|
||||
"Notify", "IfSendErrorOnly", False, BoolValidator()
|
||||
notify_SendTaskResultTime = OptionsConfigItem(
|
||||
"Notify",
|
||||
"SendTaskResultTime",
|
||||
"不推送",
|
||||
OptionsValidator(["不推送", "任何时刻", "仅失败时"]),
|
||||
)
|
||||
notify_IfSendStatistic = ConfigItem(
|
||||
"Notify", "IfSendStatistic", False, BoolValidator()
|
||||
)
|
||||
notify_IfSendSixStar = ConfigItem("Notify", "IfSendSixStar", False, BoolValidator())
|
||||
notify_IfPushPlyer = ConfigItem("Notify", "IfPushPlyer", False, BoolValidator())
|
||||
notify_IfSendMail = ConfigItem("Notify", "IfSendMail", False, BoolValidator())
|
||||
notify_SMTPServerAddress = ConfigItem("Notify", "SMTPServerAddress", "")
|
||||
|
||||
@@ -39,10 +39,7 @@ from app.services import System
|
||||
|
||||
class _MainTimer(QWidget):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
parent=None,
|
||||
):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.if_FailSafeException = False
|
||||
|
||||
@@ -34,6 +34,7 @@ import subprocess
|
||||
import shutil
|
||||
import time
|
||||
from pathlib import Path
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
from typing import Union, List
|
||||
|
||||
from app.core import Config
|
||||
@@ -291,7 +292,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 +303,19 @@ class MaaManager(QObject):
|
||||
/ f"history/{curdate}/{self.data[user[2]][0]}/{start_time.strftime("%H-%M-%S")}.json",
|
||||
)
|
||||
|
||||
if (
|
||||
Config.global_config.get(
|
||||
Config.global_config.notify_IfSendSixStar
|
||||
)
|
||||
and if_six_star
|
||||
):
|
||||
|
||||
self.push_notification(
|
||||
"公招六星",
|
||||
f"喜报:用户 {user[0]} 公招出六星啦!",
|
||||
{"user_name": self.data[user[2]][0]},
|
||||
)
|
||||
|
||||
# 成功完成代理的用户修改相关参数
|
||||
if run_book[0] and run_book[1]:
|
||||
if self.data[user[2]][14] == 0 and self.data[user[2]][3] != -1:
|
||||
@@ -321,6 +335,7 @@ class MaaManager(QObject):
|
||||
):
|
||||
|
||||
statistics = Config.merge_maa_logs("指定项", user_logs_list)
|
||||
statistics["user_info"] = user[0]
|
||||
statistics["start_time"] = user_start_time.strftime(
|
||||
"%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
@@ -468,7 +483,7 @@ class MaaManager(QObject):
|
||||
self.user_config_path.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy(self.maa_set_path, self.user_config_path)
|
||||
|
||||
end_log = ""
|
||||
result_text = ""
|
||||
|
||||
# 导出结果
|
||||
if self.mode in ["自动代理", "人工排查"]:
|
||||
@@ -491,28 +506,25 @@ class MaaManager(QObject):
|
||||
wait_index = [_[2] for _ in self.user_list if _[1] == "等待"]
|
||||
|
||||
# 保存运行日志
|
||||
end_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
end_log = (
|
||||
f"任务开始时间:{begin_time},结束时间:{end_time}\n"
|
||||
f"已完成数:{len(over_index)},未完成数:{len(error_index) + len(wait_index)}\n\n"
|
||||
)
|
||||
|
||||
if len(error_index) != 0:
|
||||
end_log += (
|
||||
f"{self.mode[2:4]}未成功的用户:\n"
|
||||
f"{"\n".join([self.data[_][0] for _ in error_index])}\n"
|
||||
)
|
||||
if len(wait_index) != 0:
|
||||
end_log += (
|
||||
f"\n未开始{self.mode[2:4]}的用户:\n"
|
||||
f"{"\n".join([self.data[_][0] for _ in wait_index])}\n"
|
||||
)
|
||||
|
||||
title = (
|
||||
f"{self.set["MaaSet"]["Name"]}的{self.mode[:4]}任务报告"
|
||||
if self.set["MaaSet"]["Name"] != ""
|
||||
else f"{self.mode[:4]}任务报告"
|
||||
)
|
||||
result = {
|
||||
"title": f"{self.mode[:4]}任务报告",
|
||||
"script_name": (
|
||||
self.set["MaaSet"]["Name"]
|
||||
if self.set["MaaSet"]["Name"] != ""
|
||||
else "空白"
|
||||
),
|
||||
"start_time": begin_time,
|
||||
"end_time": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"completed_count": len(over_index),
|
||||
"uncompleted_count": len(error_index) + len(wait_index),
|
||||
"failed_user": [self.data[_][0] for _ in error_index],
|
||||
"waiting_user": [self.data[_][0] for _ in wait_index],
|
||||
}
|
||||
# 推送代理结果通知
|
||||
Notify.push_plyer(
|
||||
title.replace("报告", "已完成!"),
|
||||
@@ -520,18 +532,23 @@ class MaaManager(QObject):
|
||||
f"已完成用户数:{len(over_index)},未完成用户数:{len(error_index) + len(wait_index)}",
|
||||
10,
|
||||
)
|
||||
if not Config.global_config.get(
|
||||
Config.global_config.notify_IfSendErrorOnly
|
||||
) or (
|
||||
Config.global_config.get(Config.global_config.notify_IfSendErrorOnly)
|
||||
if Config.global_config.get(
|
||||
Config.global_config.notify_SendTaskResultTime
|
||||
) == "任何时刻" or (
|
||||
Config.global_config.get(Config.global_config.notify_SendTaskResultTime)
|
||||
== "仅失败时"
|
||||
and len(error_index) + len(wait_index) != 0
|
||||
):
|
||||
self.push_notification("代理结果", title, end_log)
|
||||
result_text = self.push_notification("代理结果", title, result)
|
||||
else:
|
||||
result_text = self.push_notification(
|
||||
"代理结果", title, result, if_get_text_only=True
|
||||
)
|
||||
|
||||
self.agree_bilibili(False)
|
||||
self.log_monitor.deleteLater()
|
||||
self.log_monitor_timer.deleteLater()
|
||||
self.accomplish.emit({"Time": begin_time, "History": end_log})
|
||||
self.accomplish.emit({"Time": begin_time, "History": result_text})
|
||||
|
||||
def requestInterruption(self) -> None:
|
||||
logger.info(f"{self.name} | 收到任务中止申请")
|
||||
@@ -539,7 +556,7 @@ class MaaManager(QObject):
|
||||
if len(self.log_monitor.files()) != 0:
|
||||
self.interrupt.emit()
|
||||
|
||||
self.maa_result = "您中止了本次任务"
|
||||
self.maa_result = "任务被手动中止"
|
||||
self.isInterruptionRequested = True
|
||||
|
||||
def push_question(self, title: str, message: str) -> bool:
|
||||
@@ -619,6 +636,8 @@ class MaaManager(QObject):
|
||||
minutes=self.set["RunSet"][time_book[mode]]
|
||||
):
|
||||
self.maa_result = "检测到MAA进程超时"
|
||||
elif self.isInterruptionRequested:
|
||||
self.maa_result = "任务被手动中止"
|
||||
else:
|
||||
self.maa_result = "Wait"
|
||||
|
||||
@@ -632,6 +651,8 @@ class MaaManager(QObject):
|
||||
or ("MaaAssistantArknights GUI exited" in log)
|
||||
):
|
||||
self.maa_result = "检测到MAA进程异常"
|
||||
elif self.isInterruptionRequested:
|
||||
self.maa_result = "任务被手动中止"
|
||||
else:
|
||||
self.maa_result = "Wait"
|
||||
|
||||
@@ -1154,142 +1175,50 @@ class MaaManager(QObject):
|
||||
return dt.strftime("%Y-%m-%d")
|
||||
|
||||
def push_notification(
|
||||
self, mode: str, title: str, message: Union[str, dict]
|
||||
) -> None:
|
||||
self,
|
||||
mode: str,
|
||||
title: str,
|
||||
message: Union[str, dict],
|
||||
if_get_text_only: bool = False,
|
||||
) -> str:
|
||||
"""通过所有渠道推送通知"""
|
||||
|
||||
env = Environment(
|
||||
loader=FileSystemLoader(str(Config.app_path / "resources/html"))
|
||||
)
|
||||
|
||||
if mode == "代理结果":
|
||||
|
||||
Notify.send_mail(
|
||||
"文本",
|
||||
title,
|
||||
f"{message}\n\nAUTO_MAA 敬上\n\n我们根据您在 AUTO_MAA 中的设置发送了这封电子邮件,本邮件无需回复\n",
|
||||
# 生成文本通知内容
|
||||
message_text = (
|
||||
f"任务开始时间:{message["start_time"]},结束时间:{message["end_time"]}\n"
|
||||
f"已完成数:{message["completed_count"]},未完成数:{message["uncompleted_count"]}\n\n"
|
||||
)
|
||||
Notify.ServerChanPush(title, f"{message}\n\nAUTO_MAA 敬上")
|
||||
Notify.CompanyWebHookBotPush(title, f"{message}AUTO_MAA 敬上")
|
||||
|
||||
if len(message["failed_user"]) > 0:
|
||||
message_text += f"{self.mode[2:4]}未成功的用户:\n{"\n".join(message["failed_user"])}\n"
|
||||
if len(message["waiting_user"]) > 0:
|
||||
message_text += f"\n未开始{self.mode[2:4]}的用户:\n{"\n".join(message["waiting_user"])}\n"
|
||||
|
||||
if if_get_text_only:
|
||||
return message_text
|
||||
|
||||
# 生成HTML通知内容
|
||||
message["failed_user"] = "、".join(message["failed_user"])
|
||||
message["waiting_user"] = "、".join(message["waiting_user"])
|
||||
|
||||
template = env.get_template("MAA_result.html")
|
||||
message_html = template.render(message)
|
||||
|
||||
Notify.send_mail("网页", title, message_html)
|
||||
Notify.ServerChanPush(title, f"{message_text}\n\nAUTO_MAA 敬上")
|
||||
Notify.CompanyWebHookBotPush(title, f"{message_text}\n\nAUTO_MAA 敬上")
|
||||
|
||||
return message_text
|
||||
|
||||
elif mode == "统计信息":
|
||||
|
||||
# HTML模板
|
||||
html_template = """
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{title}</title>
|
||||
<style>
|
||||
body {{
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #f4f4f4;
|
||||
}}
|
||||
.container {{
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
overflow: hidden;
|
||||
padding: 20px;
|
||||
background-color: white;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}}
|
||||
h1.main-title {{
|
||||
text-align: center;
|
||||
color: #333;
|
||||
font-size: 2em;
|
||||
margin-bottom: 20px;
|
||||
}}
|
||||
p {{
|
||||
font-size: 16px;
|
||||
color: #555;
|
||||
}}
|
||||
table {{
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin: 25px 0;
|
||||
font-size: 18px;
|
||||
text-align: left;
|
||||
}}
|
||||
th, td {{
|
||||
padding: 12px 15px;
|
||||
}}
|
||||
th {{
|
||||
background-color: #007BFF;
|
||||
color: white;
|
||||
}}
|
||||
tr:nth-child(even) {{
|
||||
background-color: #f3f3f3;
|
||||
}}
|
||||
tr:hover {{
|
||||
background-color: #ddd;
|
||||
}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="main-title">{title}</h1>
|
||||
|
||||
<p><strong>开始时间:</strong> {start_time}</p>
|
||||
<p><strong>结束时间:</strong> {end_time}</p>
|
||||
<p><strong>MAA执行结果:</strong> {maa_result}</p>
|
||||
|
||||
<h2>招募统计</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>星级</th>
|
||||
<th>数量</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{recruit_rows}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{drop_tables}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
# 构建招募统计表格行
|
||||
recruit_rows = "".join(
|
||||
f"<tr><td>{star}</td><td>{count}</td></tr>"
|
||||
for star, count in message["recruit_statistics"].items()
|
||||
)
|
||||
|
||||
# 构建掉落统计数据表格
|
||||
drop_tables_html = ""
|
||||
for stage, items in message["drop_statistics"].items():
|
||||
drop_rows = "".join(
|
||||
f"<tr><td>{item}</td><td>{quantity}</td></tr>"
|
||||
for item, quantity in items.items()
|
||||
)
|
||||
drop_table = f"""
|
||||
<h2>掉落统计 ({stage})</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>物品</th>
|
||||
<th>数量</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{drop_rows}
|
||||
</tbody>
|
||||
</table>
|
||||
"""
|
||||
drop_tables_html += drop_table
|
||||
|
||||
# 填充HTML模板
|
||||
html_content = html_template.format(
|
||||
title=title,
|
||||
start_time=message["start_time"],
|
||||
end_time=message["end_time"],
|
||||
maa_result=message["maa_result"],
|
||||
recruit_rows=recruit_rows,
|
||||
drop_tables=drop_tables_html,
|
||||
)
|
||||
|
||||
# 生成文本通知内容
|
||||
formatted = []
|
||||
for stage, items in message["drop_statistics"].items():
|
||||
formatted.append(f"掉落统计({stage}):")
|
||||
@@ -1302,7 +1231,6 @@ class MaaManager(QObject):
|
||||
formatted.append(f" {star}: {count}")
|
||||
recruit_text = "\n".join(formatted)
|
||||
|
||||
# 构建通知消息
|
||||
message_text = (
|
||||
f"开始时间: {message['start_time']}\n"
|
||||
f"结束时间: {message['end_time']}\n"
|
||||
@@ -1311,6 +1239,20 @@ class MaaManager(QObject):
|
||||
f"{drop_text}"
|
||||
)
|
||||
|
||||
Notify.send_mail("网页", title, html_content)
|
||||
# 生成HTML通知内容
|
||||
template = env.get_template("MAA_statistics.html")
|
||||
message_html = template.render(message)
|
||||
|
||||
Notify.send_mail("网页", title, message_html)
|
||||
Notify.ServerChanPush(title, f"{message_text}\n\nAUTO_MAA 敬上")
|
||||
Notify.CompanyWebHookBotPush(title, f"{message_text}AUTO_MAA 敬上")
|
||||
Notify.CompanyWebHookBotPush(title, f"{message_text}\n\nAUTO_MAA 敬上")
|
||||
|
||||
elif mode == "公招六星":
|
||||
|
||||
# 生成HTML通知内容
|
||||
template = env.get_template("MAA_six_star.html")
|
||||
message_html = template.render(message)
|
||||
|
||||
Notify.send_mail("网页", title, message_html)
|
||||
Notify.ServerChanPush(title, "好羡慕~\n\nAUTO_MAA 敬上")
|
||||
Notify.CompanyWebHookBotPush(title, "好羡慕~\n\nAUTO_MAA 敬上")
|
||||
|
||||
@@ -24,9 +24,13 @@ AUTO_MAA通知服务
|
||||
v4.2
|
||||
作者:DLmaster_361
|
||||
"""
|
||||
|
||||
from PySide6.QtWidgets import QWidget
|
||||
from PySide6.QtCore import Signal
|
||||
import requests
|
||||
from loguru import logger
|
||||
from plyer import notification
|
||||
import re
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
@@ -35,11 +39,16 @@ from email.utils import formataddr
|
||||
|
||||
from serverchan_sdk import sc_send
|
||||
|
||||
from app.core import Config, MainInfoBar
|
||||
from app.core import Config
|
||||
from app.services.security import Crypto
|
||||
|
||||
|
||||
class Notification:
|
||||
class Notification(QWidget):
|
||||
|
||||
push_info_bar = Signal(str, str, str, int)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
def push_plyer(self, title, message, ticker, t):
|
||||
"""推送系统通知"""
|
||||
@@ -58,11 +67,44 @@ class Notification:
|
||||
|
||||
return True
|
||||
|
||||
def send_mail(self, mode, title, content):
|
||||
def send_mail(self, mode, title, content) -> None:
|
||||
"""推送邮件通知"""
|
||||
|
||||
if Config.global_config.get(Config.global_config.notify_IfSendMail):
|
||||
|
||||
if (
|
||||
Config.global_config.get(Config.global_config.notify_SMTPServerAddress)
|
||||
== ""
|
||||
or Config.global_config.get(
|
||||
Config.global_config.notify_AuthorizationCode
|
||||
)
|
||||
== ""
|
||||
or not bool(
|
||||
re.match(
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
|
||||
Config.global_config.get(
|
||||
Config.global_config.notify_FromAddress
|
||||
),
|
||||
)
|
||||
)
|
||||
or not bool(
|
||||
re.match(
|
||||
r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
|
||||
Config.global_config.get(Config.global_config.notify_ToAddress),
|
||||
)
|
||||
)
|
||||
):
|
||||
logger.error(
|
||||
"请正确设置邮件通知的SMTP服务器地址、授权码、发件人地址和收件人地址"
|
||||
)
|
||||
self.push_info_bar.emit(
|
||||
"error",
|
||||
"邮件通知推送异常",
|
||||
"请正确设置邮件通知的SMTP服务器地址、授权码、发件人地址和收件人地址",
|
||||
-1,
|
||||
)
|
||||
return None
|
||||
|
||||
try:
|
||||
# 定义邮件正文
|
||||
if mode == "文本":
|
||||
@@ -111,7 +153,7 @@ class Notification:
|
||||
logger.success("邮件发送成功")
|
||||
except Exception as e:
|
||||
logger.error(f"发送邮件时出错:\n{e}")
|
||||
MainInfoBar.push_info_bar("error", "发送邮件时出错", f"{e}", -1)
|
||||
self.push_info_bar.emit("error", "发送邮件时出错", f"{e}", -1)
|
||||
|
||||
def ServerChanPush(self, title, content):
|
||||
"""使用Server酱推送通知"""
|
||||
@@ -140,7 +182,7 @@ class Notification:
|
||||
else:
|
||||
option["tags"] = ""
|
||||
logger.warning("请正确设置Auto_MAA中ServerChan的Tag。")
|
||||
MainInfoBar.push_info_bar(
|
||||
self.push_info_bar.emit(
|
||||
"warning",
|
||||
"Server酱通知推送异常",
|
||||
"请正确设置Auto_MAA中ServerChan的Tag。",
|
||||
@@ -152,7 +194,7 @@ class Notification:
|
||||
else:
|
||||
option["channel"] = ""
|
||||
logger.warning("请正确设置Auto_MAA中ServerChan的Channel。")
|
||||
MainInfoBar.push_info_bar(
|
||||
self.push_info_bar.emit(
|
||||
"warning",
|
||||
"Server酱通知推送异常",
|
||||
"请正确设置Auto_MAA中ServerChan的Channel。",
|
||||
@@ -166,7 +208,7 @@ class Notification:
|
||||
else:
|
||||
logger.info("Server酱推送通知失败")
|
||||
logger.error(response)
|
||||
MainInfoBar.push_info_bar(
|
||||
self.push_info_bar.emit(
|
||||
"error",
|
||||
"Server酱通知推送失败",
|
||||
f'使用Server酱推送通知时出错:\n{response["data"]['error']}',
|
||||
@@ -191,7 +233,7 @@ class Notification:
|
||||
else:
|
||||
logger.info("企业微信群机器人推送通知失败")
|
||||
logger.error(response.json())
|
||||
MainInfoBar.push_info_bar(
|
||||
self.push_info_bar.emit(
|
||||
"error",
|
||||
"企业微信群机器人通知推送失败",
|
||||
f'使用企业微信群机器人推送通知时出错:\n{response.json()["errmsg"]}',
|
||||
|
||||
@@ -96,10 +96,7 @@ class HistoryCard(ExpandGroupSettingCard):
|
||||
|
||||
def __init__(self, date: str, user_list: List[Path], parent=None):
|
||||
super().__init__(
|
||||
FluentIcon.HISTORY,
|
||||
date,
|
||||
f"{date}的历史运行记录与统计信息",
|
||||
parent,
|
||||
FluentIcon.HISTORY, date, f"{date}的历史运行记录与统计信息", parent
|
||||
)
|
||||
|
||||
widget = QWidget()
|
||||
|
||||
@@ -149,8 +149,7 @@ class AUTO_MAA(MSFluentWindow):
|
||||
|
||||
# 创建系统托盘及其菜单
|
||||
self.tray = QSystemTrayIcon(
|
||||
QIcon(str(Config.app_path / "resources/icons/AUTO_MAA.ico")),
|
||||
self,
|
||||
QIcon(str(Config.app_path / "resources/icons/AUTO_MAA.ico")), self
|
||||
)
|
||||
self.tray.setToolTip("AUTO_MAA")
|
||||
self.tray_menu = SystemTrayMenu("AUTO_MAA", self)
|
||||
@@ -189,6 +188,7 @@ class AUTO_MAA(MSFluentWindow):
|
||||
|
||||
TaskManager.create_gui.connect(self.dispatch_center.add_board)
|
||||
TaskManager.connect_gui.connect(self.dispatch_center.connect_main_board)
|
||||
Notify.push_info_bar.connect(MainInfoBar.push_info_bar)
|
||||
self.setting.ui.card_IfShowTray.checkedChanged.connect(
|
||||
lambda: self.show_ui("配置托盘")
|
||||
)
|
||||
@@ -231,15 +231,16 @@ class AUTO_MAA(MSFluentWindow):
|
||||
# 检查密码
|
||||
self.setting.check_PASSWORD()
|
||||
|
||||
# 获取公告
|
||||
self.setting.show_notice(if_show=False)
|
||||
|
||||
# 获取主题图像
|
||||
if (
|
||||
Config.global_config.get(Config.global_config.function_HomeImageMode)
|
||||
== "主题图像"
|
||||
):
|
||||
self.home.get_home_image()
|
||||
|
||||
# 获取公告
|
||||
self.setting.show_notice(if_show=False)
|
||||
|
||||
# 检查更新
|
||||
if Config.global_config.get(Config.global_config.update_IfAutoUpdate):
|
||||
result = self.setting.get_update_info()
|
||||
|
||||
@@ -638,12 +638,7 @@ class MaaSettingBox(QWidget):
|
||||
class RunSetSettingCard(ExpandGroupSettingCard):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING,
|
||||
"运行",
|
||||
"MAA运行调控选项",
|
||||
parent,
|
||||
)
|
||||
super().__init__(FluentIcon.SETTING, "运行", "MAA运行调控选项", parent)
|
||||
|
||||
self.card_TaskTransitionMethod = ComboBoxSettingCard(
|
||||
configItem=Config.maa_config.RunSet_TaskTransitionMethod,
|
||||
|
||||
@@ -542,45 +542,82 @@ class NotifySettingCard(HeaderCardWidget):
|
||||
|
||||
self.setTitle("通知")
|
||||
|
||||
self.card_IfSendErrorOnly = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="仅推送异常信息",
|
||||
content="仅在任务出现异常时推送通知",
|
||||
configItem=Config.global_config.notify_IfSendErrorOnly,
|
||||
)
|
||||
self.caer_IfSendStatistic = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送统计信息",
|
||||
content="推送自动代理统计信息的通知",
|
||||
configItem=Config.global_config.notify_IfSendStatistic,
|
||||
)
|
||||
self.card_IfPushPlyer = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送系统通知",
|
||||
content="推送系统级通知,不会在通知中心停留",
|
||||
configItem=Config.global_config.notify_IfPushPlyer,
|
||||
)
|
||||
self.card_SendMail = self.SendMailSettingCard(self)
|
||||
self.card_NotifyContent = self.NotifyContentSettingCard(self)
|
||||
self.card_Plyer = self.PlyerSettingCard(self)
|
||||
self.card_EMail = self.EMailSettingCard(self)
|
||||
self.card_ServerChan = self.ServerChanSettingCard(self)
|
||||
self.card_CompanyWebhookBot = self.CompanyWechatPushSettingCard(self)
|
||||
|
||||
Layout = QVBoxLayout()
|
||||
Layout.addWidget(self.card_IfSendErrorOnly)
|
||||
Layout.addWidget(self.caer_IfSendStatistic)
|
||||
Layout.addWidget(self.card_IfPushPlyer)
|
||||
Layout.addWidget(self.card_SendMail)
|
||||
Layout.addWidget(self.card_NotifyContent)
|
||||
Layout.addWidget(self.card_Plyer)
|
||||
Layout.addWidget(self.card_EMail)
|
||||
Layout.addWidget(self.card_ServerChan)
|
||||
Layout.addWidget(self.card_CompanyWebhookBot)
|
||||
self.viewLayout.addLayout(Layout)
|
||||
|
||||
class SendMailSettingCard(ExpandGroupSettingCard):
|
||||
class NotifyContentSettingCard(ExpandGroupSettingCard):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING,
|
||||
"推送邮件通知",
|
||||
"通过电子邮箱推送任务结果",
|
||||
parent,
|
||||
FluentIcon.SETTING, "通知内容选项", "选择需要推送的通知内容", parent
|
||||
)
|
||||
|
||||
self.card_SendTaskResultTime = ComboBoxSettingCard(
|
||||
configItem=Config.global_config.notify_SendTaskResultTime,
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送任务结果选项",
|
||||
content="选择推送自动代理与人工排查任务结果的时机",
|
||||
texts=["不推送", "任何时刻", "仅失败时"],
|
||||
)
|
||||
self.card_IfSendStatistic = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送统计信息",
|
||||
content="推送自动代理统计信息的通知",
|
||||
configItem=Config.global_config.notify_IfSendStatistic,
|
||||
)
|
||||
self.card_IfSendSixStar = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送公招高资喜报",
|
||||
content="公招出现六星词条时推送喜报",
|
||||
configItem=Config.global_config.notify_IfSendSixStar,
|
||||
)
|
||||
|
||||
widget = QWidget()
|
||||
Layout = QVBoxLayout(widget)
|
||||
Layout.addWidget(self.card_SendTaskResultTime)
|
||||
Layout.addWidget(self.card_IfSendStatistic)
|
||||
Layout.addWidget(self.card_IfSendSixStar)
|
||||
self.viewLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.viewLayout.setSpacing(0)
|
||||
self.addGroupWidget(widget)
|
||||
|
||||
class PlyerSettingCard(ExpandGroupSettingCard):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING, "推送系统通知", "Plyer系统通知推送渠道", parent
|
||||
)
|
||||
|
||||
self.card_IfPushPlyer = SwitchSettingCard(
|
||||
icon=FluentIcon.PAGE_RIGHT,
|
||||
title="推送系统通知",
|
||||
content="使用Plyer推送系统级通知,不会在通知中心停留",
|
||||
configItem=Config.global_config.notify_IfPushPlyer,
|
||||
)
|
||||
|
||||
widget = QWidget()
|
||||
Layout = QVBoxLayout(widget)
|
||||
Layout.addWidget(self.card_IfPushPlyer)
|
||||
self.viewLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.viewLayout.setSpacing(0)
|
||||
self.addGroupWidget(widget)
|
||||
|
||||
class EMailSettingCard(ExpandGroupSettingCard):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING, "推送邮件通知", "电子邮箱通知推送渠道", parent
|
||||
)
|
||||
|
||||
self.card_IfSendMail = SwitchSettingCard(
|
||||
@@ -634,7 +671,7 @@ class NotifySettingCard(HeaderCardWidget):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING,
|
||||
"推送ServerChan通知",
|
||||
"通过ServerChan通知推送任务结果",
|
||||
"ServerChan通知推送渠道",
|
||||
parent,
|
||||
)
|
||||
|
||||
@@ -681,7 +718,7 @@ class NotifySettingCard(HeaderCardWidget):
|
||||
super().__init__(
|
||||
FluentIcon.SETTING,
|
||||
"推送企业微信机器人通知",
|
||||
"通过企业微信机器人Webhook通知推送任务结果",
|
||||
"企业微信机器人Webhook通知推送渠道",
|
||||
parent,
|
||||
)
|
||||
|
||||
|
||||
@@ -8,5 +8,6 @@ pywin32
|
||||
pyautogui
|
||||
pycryptodome
|
||||
requests
|
||||
Jinja2
|
||||
serverchan_sdk
|
||||
nuitka==2.6
|
||||
160
resources/html/MAA_result.html
Normal file
160
resources/html/MAA_result.html
Normal file
File diff suppressed because one or more lines are too long
129
resources/html/MAA_six_star.html
Normal file
129
resources/html/MAA_six_star.html
Normal file
File diff suppressed because one or more lines are too long
233
resources/html/MAA_statistics.html
Normal file
233
resources/html/MAA_statistics.html
Normal file
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"main_version": "4.2.4.7",
|
||||
"main_version": "4.2.5.0",
|
||||
"updater_version": "1.1.2.1",
|
||||
"announcement": "\n## 新增功能\n- 历史记录统计功能上线\n- 添加软件主页\n- 添加启动时直接最小化功能\n- 更新器拥有多网址测速功能\n- 添加统计信息通知功能\n## 修复BUG\n- RMA70-12不能正确统计的问题\n- 更新器修正`channel`\n## 程序优化\n- 添加MAA监测字段:`未检测到任何模拟器`\n- 取消MAA运行中自动更新",
|
||||
"announcement": "\n## 新增功能\n- 历史记录统计功能上线\n- 添加软件主页\n- 添加启动时直接最小化功能\n- 更新器拥有多网址测速功能\n- 添加统计信息通知功能(含六星监测)\n## 修复BUG\n- RMA70-12不能正确统计的问题\n- 更新器修正`channel`\n## 程序优化\n- 添加MAA监测字段:`未检测到任何模拟器`\n- 取消MAA运行中自动更新",
|
||||
"proxy_list": [
|
||||
"",
|
||||
"https://gitproxy.click/",
|
||||
|
||||
Reference in New Issue
Block a user