feat(core): 添加公告功能
This commit is contained in:
@@ -186,6 +186,9 @@ class AUTO_MAA(MSFluentWindow):
|
|||||||
# 检查密码
|
# 检查密码
|
||||||
self.setting.check_PASSWORD()
|
self.setting.check_PASSWORD()
|
||||||
|
|
||||||
|
# 获取公告
|
||||||
|
self.setting.show_notice(if_show=False)
|
||||||
|
|
||||||
# 检查更新
|
# 检查更新
|
||||||
if Config.global_config.get(Config.global_config.update_IfAutoUpdate):
|
if Config.global_config.get(Config.global_config.update_IfAutoUpdate):
|
||||||
result = self.setting.get_update_info()
|
result = self.setting.get_update_info()
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ from qfluentwidgets import (
|
|||||||
ExpandGroupSettingCard,
|
ExpandGroupSettingCard,
|
||||||
PushSettingCard,
|
PushSettingCard,
|
||||||
)
|
)
|
||||||
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
@@ -385,22 +386,23 @@ class Setting(QWidget):
|
|||||||
self.close()
|
self.close()
|
||||||
QApplication.quit()
|
QApplication.quit()
|
||||||
|
|
||||||
def show_notice(self):
|
def show_notice(self, if_show: bool = True):
|
||||||
"""显示公告"""
|
"""显示公告"""
|
||||||
|
|
||||||
# 从远程服务器获取最新版本信息
|
# 从远程服务器获取最新版本信息
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
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
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
err = e
|
err = e
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
else:
|
else:
|
||||||
logger.warning(f"获取最新公告时出错:\n{err}")
|
logger.warning(f"获取最新公告时出错:\n{err}")
|
||||||
|
if if_show:
|
||||||
choice = Dialog(
|
choice = Dialog(
|
||||||
"网络错误",
|
"网络错误",
|
||||||
f"获取最新公告时出错:\n{err}",
|
f"获取最新公告时出错:\n{err}",
|
||||||
@@ -408,18 +410,28 @@ class Setting(QWidget):
|
|||||||
)
|
)
|
||||||
choice.cancelButton.hide()
|
choice.cancelButton.hide()
|
||||||
choice.buttonLayout.insertStretch(1)
|
choice.buttonLayout.insertStretch(1)
|
||||||
if choice.exec():
|
choice.exec()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if "notice" in version_remote:
|
if (Config.app_path / "resources/notice.json").exists():
|
||||||
notice = version_remote["notice"]
|
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:
|
else:
|
||||||
notice = "暂无公告~"
|
time_local = datetime.strptime("2000-01-01 00:00", "%Y-%m-%d %H:%M")
|
||||||
|
|
||||||
choice = Dialog("公告", notice, self)
|
if if_show or datetime.strptime(notice["time"], "%Y-%m-%d %H:%M") > time_local:
|
||||||
|
|
||||||
|
choice = Dialog("公告", notice["content"], self)
|
||||||
choice.cancelButton.hide()
|
choice.cancelButton.hide()
|
||||||
choice.buttonLayout.insertStretch(1)
|
choice.buttonLayout.insertStretch(1)
|
||||||
choice.exec()
|
if 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):
|
class FunctionSettingCard(HeaderCardWidget):
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ plyer
|
|||||||
PySide6
|
PySide6
|
||||||
PySide6-Fluent-Widgets[full]
|
PySide6-Fluent-Widgets[full]
|
||||||
psutil
|
psutil
|
||||||
|
opencv-python
|
||||||
pywin32
|
pywin32
|
||||||
pyautogui
|
pyautogui
|
||||||
pycryptodome
|
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",
|
"main_version": "4.2.1.1",
|
||||||
"updater_version": "1.1.0.1",
|
"updater_version": "1.1.0.1",
|
||||||
"announcement": "\n## 新增功能\n- 调度队列上线,支持MAA多开\n## 修复BUG\n- 添加了一堆BUG(确信)\n## 程序优化\n- 界面重构,引入`QFluentWidgets`美化界面",
|
"announcement": "\n## 新增功能\n- 调度队列上线,支持MAA多开\n- 公告系统上线\n## 修复BUG\n- 添加了一堆BUG(确信)\n## 程序优化\n- 界面重构,引入`QFluentWidgets`美化界面",
|
||||||
"notice": "公告系统测试中~",
|
|
||||||
"proxy_list": [
|
"proxy_list": [
|
||||||
"",
|
"",
|
||||||
"https://gitproxy.click/",
|
"https://gitproxy.click/",
|
||||||
|
|||||||
Reference in New Issue
Block a user