feat(notif): 通知增加理智剩余量和理智恢复时间

This commit is contained in:
Alirea
2025-09-26 23:18:32 +08:00
parent f04b7bf073
commit 4e44669695
3 changed files with 22 additions and 3 deletions

View File

@@ -2038,11 +2038,25 @@ class AppConfig(GlobalConfig):
data = {
"recruit_statistics": defaultdict(int),
"drop_statistics": defaultdict(dict),
"sanity": 0,
"sanity_full_at": "",
"maa_result": maa_result,
}
if_six_star = False
# 提取理智相关信息
for log_line in logs:
# 提取当前理智值:理智: 5/180
sanity_match = re.search(r"理智:\s*(\d+)/\d+", log_line)
if sanity_match:
data["sanity"] = int(sanity_match.group(1))
# 提取理智回满时间:理智将在 2025-09-26 18:57 回满
sanity_full_match = re.search(r"理智将在\s*(\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2})\s*回满", log_line)
if sanity_full_match:
data["sanity_full_at"] = sanity_full_match.group(1)
# 公招统计(仅统计招募到的)
confirmed_recruit = False
current_star_level = None
@@ -2151,6 +2165,7 @@ class AppConfig(GlobalConfig):
log_path.parent.mkdir(parents=True, exist_ok=True)
with log_path.open("w", encoding="utf-8") as f:
f.writelines(logs)
# 保存统计数据
with log_path.with_suffix(".json").open("w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=4)

View File

@@ -1933,6 +1933,8 @@ class MaaManager:
message_text = (
f"开始时间: {message['start_time']}\n"
f"结束时间: {message['end_time']}\n"
f"理智剩余: {message['sanity']}\n"
f"回复时间: {message['sanity_full_at']}\n"
f"MAA执行结果: {message['maa_result']}\n\n"
f"{recruit_text}\n"
f"{drop_text}"

View File

@@ -166,9 +166,11 @@
</div>
<div class="content">
<p><strong>用户代理信息:</strong>{{ user_info }}</p>
<p><strong>任务开始时间:</strong>{{ start_time }}</p>
<p><strong>任务结束时间:</strong>{{ end_time }}</p>
<p><strong>用户信息:</strong>{{ user_info }}</p>
<p><strong>开始时间:</strong>{{ start_time }}</p>
<p><strong>结束时间:</strong>{{ end_time }}</p>
<p><strong>理智剩余:</strong>{{ sanity }}</p>
<p><strong>回复时间:</strong>{{ sanity_full_at }}</p>
<p><strong>MAA执行结果</strong>
{% if maa_result == '代理任务全部完成' %}
<span class="greenhighlight">{{ maa_result }}</span>