feat(core): 添加公告功能
This commit is contained in:
@@ -186,6 +186,9 @@ class AUTO_MAA(MSFluentWindow):
|
||||
# 检查密码
|
||||
self.setting.check_PASSWORD()
|
||||
|
||||
# 获取公告
|
||||
self.setting.show_notice(if_show=False)
|
||||
|
||||
# 检查更新
|
||||
if Config.global_config.get(Config.global_config.update_IfAutoUpdate):
|
||||
result = self.setting.get_update_info()
|
||||
|
||||
@@ -43,6 +43,7 @@ from qfluentwidgets import (
|
||||
ExpandGroupSettingCard,
|
||||
PushSettingCard,
|
||||
)
|
||||
from datetime import datetime
|
||||
import json
|
||||
import subprocess
|
||||
import time
|
||||
@@ -385,41 +386,52 @@ class Setting(QWidget):
|
||||
self.close()
|
||||
QApplication.quit()
|
||||
|
||||
def show_notice(self):
|
||||
def show_notice(self, if_show: bool = True):
|
||||
"""显示公告"""
|
||||
|
||||
# 从远程服务器获取最新版本信息
|
||||
for _ in range(3):
|
||||
try:
|
||||
response = requests.get(
|
||||
"https://gitee.com/DLmaster_361/AUTO_MAA/raw/main/resources/version.json"
|
||||
"https://gitee.com/DLmaster_361/AUTO_MAA/raw/main/resources/notice.json"
|
||||
)
|
||||
version_remote = response.json()
|
||||
notice = response.json()
|
||||
break
|
||||
except Exception as e:
|
||||
err = e
|
||||
time.sleep(0.1)
|
||||
else:
|
||||
logger.warning(f"获取最新公告时出错:\n{err}")
|
||||
choice = Dialog(
|
||||
"网络错误",
|
||||
f"获取最新公告时出错:\n{err}",
|
||||
self,
|
||||
)
|
||||
if if_show:
|
||||
choice = Dialog(
|
||||
"网络错误",
|
||||
f"获取最新公告时出错:\n{err}",
|
||||
self,
|
||||
)
|
||||
choice.cancelButton.hide()
|
||||
choice.buttonLayout.insertStretch(1)
|
||||
choice.exec()
|
||||
return None
|
||||
|
||||
if (Config.app_path / "resources/notice.json").exists():
|
||||
with (Config.app_path / "resources/notice.json").open(
|
||||
mode="r", encoding="utf-8"
|
||||
) as f:
|
||||
notice_local = json.load(f)
|
||||
time_local = datetime.strptime(notice_local["time"], "%Y-%m-%d %H:%M")
|
||||
else:
|
||||
time_local = datetime.strptime("2000-01-01 00:00", "%Y-%m-%d %H:%M")
|
||||
|
||||
if if_show or datetime.strptime(notice["time"], "%Y-%m-%d %H:%M") > time_local:
|
||||
|
||||
choice = Dialog("公告", notice["content"], self)
|
||||
choice.cancelButton.hide()
|
||||
choice.buttonLayout.insertStretch(1)
|
||||
if choice.exec():
|
||||
return None
|
||||
|
||||
if "notice" in version_remote:
|
||||
notice = version_remote["notice"]
|
||||
else:
|
||||
notice = "暂无公告~"
|
||||
|
||||
choice = Dialog("公告", notice, self)
|
||||
choice.cancelButton.hide()
|
||||
choice.buttonLayout.insertStretch(1)
|
||||
choice.exec()
|
||||
with (Config.app_path / "resources/notice.json").open(
|
||||
mode="w", encoding="utf-8"
|
||||
) as f:
|
||||
json.dump(notice, f, ensure_ascii=False, indent=4)
|
||||
|
||||
|
||||
class FunctionSettingCard(HeaderCardWidget):
|
||||
|
||||
@@ -3,6 +3,7 @@ plyer
|
||||
PySide6
|
||||
PySide6-Fluent-Widgets[full]
|
||||
psutil
|
||||
opencv-python
|
||||
pywin32
|
||||
pyautogui
|
||||
pycryptodome
|
||||
|
||||
BIN
resources/audio/3星结束行动.wav
Normal file
BIN
resources/audio/3星结束行动.wav
Normal file
Binary file not shown.
BIN
resources/audio/交谈1.wav
Normal file
BIN
resources/audio/交谈1.wav
Normal file
Binary file not shown.
BIN
resources/audio/交谈2.wav
Normal file
BIN
resources/audio/交谈2.wav
Normal file
Binary file not shown.
BIN
resources/audio/交谈3.wav
Normal file
BIN
resources/audio/交谈3.wav
Normal file
Binary file not shown.
BIN
resources/audio/任命助理.wav
Normal file
BIN
resources/audio/任命助理.wav
Normal file
Binary file not shown.
BIN
resources/audio/任命队长.wav
Normal file
BIN
resources/audio/任命队长.wav
Normal file
Binary file not shown.
BIN
resources/audio/作战中1.wav
Normal file
BIN
resources/audio/作战中1.wav
Normal file
Binary file not shown.
BIN
resources/audio/作战中2.wav
Normal file
BIN
resources/audio/作战中2.wav
Normal file
Binary file not shown.
BIN
resources/audio/作战中3.wav
Normal file
BIN
resources/audio/作战中3.wav
Normal file
Binary file not shown.
BIN
resources/audio/作战中4.wav
Normal file
BIN
resources/audio/作战中4.wav
Normal file
Binary file not shown.
BIN
resources/audio/信赖提升后交谈1.wav
Normal file
BIN
resources/audio/信赖提升后交谈1.wav
Normal file
Binary file not shown.
BIN
resources/audio/信赖提升后交谈2.wav
Normal file
BIN
resources/audio/信赖提升后交谈2.wav
Normal file
Binary file not shown.
BIN
resources/audio/信赖提升后交谈3.wav
Normal file
BIN
resources/audio/信赖提升后交谈3.wav
Normal file
Binary file not shown.
BIN
resources/audio/信赖触摸.wav
Normal file
BIN
resources/audio/信赖触摸.wav
Normal file
Binary file not shown.
BIN
resources/audio/周年庆典.wav
Normal file
BIN
resources/audio/周年庆典.wav
Normal file
Binary file not shown.
BIN
resources/audio/完成高难行动.wav
Normal file
BIN
resources/audio/完成高难行动.wav
Normal file
Binary file not shown.
BIN
resources/audio/干员报到.wav
Normal file
BIN
resources/audio/干员报到.wav
Normal file
Binary file not shown.
BIN
resources/audio/戳一下.wav
Normal file
BIN
resources/audio/戳一下.wav
Normal file
Binary file not shown.
BIN
resources/audio/新年祝福.wav
Normal file
BIN
resources/audio/新年祝福.wav
Normal file
Binary file not shown.
BIN
resources/audio/晋升后交谈1.wav
Normal file
BIN
resources/audio/晋升后交谈1.wav
Normal file
Binary file not shown.
BIN
resources/audio/晋升后交谈2.wav
Normal file
BIN
resources/audio/晋升后交谈2.wav
Normal file
Binary file not shown.
BIN
resources/audio/标题.wav
Normal file
BIN
resources/audio/标题.wav
Normal file
Binary file not shown.
BIN
resources/audio/生日.wav
Normal file
BIN
resources/audio/生日.wav
Normal file
Binary file not shown.
BIN
resources/audio/精英化晋升1.wav
Normal file
BIN
resources/audio/精英化晋升1.wav
Normal file
Binary file not shown.
BIN
resources/audio/精英化晋升2.wav
Normal file
BIN
resources/audio/精英化晋升2.wav
Normal file
Binary file not shown.
BIN
resources/audio/编入队伍.wav
Normal file
BIN
resources/audio/编入队伍.wav
Normal file
Binary file not shown.
BIN
resources/audio/行动出发.wav
Normal file
BIN
resources/audio/行动出发.wav
Normal file
Binary file not shown.
BIN
resources/audio/行动失败.wav
Normal file
BIN
resources/audio/行动失败.wav
Normal file
Binary file not shown.
BIN
resources/audio/行动开始.wav
Normal file
BIN
resources/audio/行动开始.wav
Normal file
Binary file not shown.
BIN
resources/audio/观看作战记录.wav
Normal file
BIN
resources/audio/观看作战记录.wav
Normal file
Binary file not shown.
BIN
resources/audio/进驻设施.wav
Normal file
BIN
resources/audio/进驻设施.wav
Normal file
Binary file not shown.
BIN
resources/audio/选中干员1.wav
Normal file
BIN
resources/audio/选中干员1.wav
Normal file
Binary file not shown.
BIN
resources/audio/选中干员2.wav
Normal file
BIN
resources/audio/选中干员2.wav
Normal file
Binary file not shown.
BIN
resources/audio/部署1.wav
Normal file
BIN
resources/audio/部署1.wav
Normal file
Binary file not shown.
BIN
resources/audio/部署2.wav
Normal file
BIN
resources/audio/部署2.wav
Normal file
Binary file not shown.
BIN
resources/audio/问候.wav
Normal file
BIN
resources/audio/问候.wav
Normal file
Binary file not shown.
BIN
resources/audio/闲置.wav
Normal file
BIN
resources/audio/闲置.wav
Normal file
Binary file not shown.
BIN
resources/audio/非3星结束行动.wav
Normal file
BIN
resources/audio/非3星结束行动.wav
Normal file
Binary file not shown.
4
resources/notice.json
Normal file
4
resources/notice.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"content": "公告系统测试中~",
|
||||
"time": "2025-01-27 17:00"
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"main_version": "4.2.1.1",
|
||||
"updater_version": "1.1.0.1",
|
||||
"announcement": "\n## 新增功能\n- 调度队列上线,支持MAA多开\n## 修复BUG\n- 添加了一堆BUG(确信)\n## 程序优化\n- 界面重构,引入`QFluentWidgets`美化界面",
|
||||
"notice": "公告系统测试中~",
|
||||
"announcement": "\n## 新增功能\n- 调度队列上线,支持MAA多开\n- 公告系统上线\n## 修复BUG\n- 添加了一堆BUG(确信)\n## 程序优化\n- 界面重构,引入`QFluentWidgets`美化界面",
|
||||
"proxy_list": [
|
||||
"",
|
||||
"https://gitproxy.click/",
|
||||
|
||||
Reference in New Issue
Block a user