diff --git a/Mower0.py b/Mower0.py
index a94ccf385..f29051417 100644
--- a/Mower0.py
+++ b/Mower0.py
@@ -1226,7 +1226,7 @@ def 添加MAA任务(self, type):
def maa_plan_solver(self, 任务列表=['Fight'], one_time=False):
try:
- self.send_email('启动MAA')
+ self.send_message('启动MAA')
self.back_to_index()
# 任务及参数请参考 docs/集成文档.md
self.MAA初始化()
@@ -1257,7 +1257,7 @@ def maa_plan_solver(self, 任务列表=['Fight'], one_time=False):
hard_stop = True
else:
time.sleep(0)
- self.send_email('MAA 停止')
+ self.send_message('MAA 停止')
if hard_stop:
logger.info(f"由于 MAA 任务并未完成,等待3分钟重启软件")
time.sleep(180)
@@ -1315,7 +1315,7 @@ def maa_plan_solver(self, 任务列表=['Fight'], one_time=False):
context = f"下一次任务:{self.任务列表[0].plan if len(self.任务列表[0].plan) != 0 else '空任务' if self.任务列表[0].type == '' else self.任务列表[0].type}"
logger.info(context)
logger.info(subject)
- self.send_email(context, subject)
+ self.send_message(context, subject)
if remaining_time > 0:
time.sleep(remaining_time)
self.MAA = None
@@ -1329,7 +1329,7 @@ def maa_plan_solver(self, 任务列表=['Fight'], one_time=False):
time.sleep(remaining_time)
self.device.exit(self.服务器)
- def send_email(self, context=None, subject='', retry_time=3):
+ def send_message(self, context=None, subject='', retry_time=3):
global 任务
if not self.邮件设置['邮件提醒开关'] == '开':
logger.info('邮件功能未开启')
@@ -1459,7 +1459,7 @@ def Mower0(self):
当前项目.返回基建主界面()
任务间隔 = (当前项目.任务列表[0].time - datetime.now()).total_seconds()
if 任务间隔 > 0:
- 当前项目.send_email()
+ 当前项目.send_message()
任务提示 = str()
for i in range(len(任务列表)):
logger.warning(
diff --git a/arknights_mower/__main__.py b/arknights_mower/__main__.py
index b8e0ae507..618d12323 100644
--- a/arknights_mower/__main__.py
+++ b/arknights_mower/__main__.py
@@ -230,15 +230,20 @@ def initialize(tasks, scheduler=None):
base_scheduler.last_room = ""
logger.info("宿舍黑名单:" + str(plan_config.free_blacklist))
base_scheduler.MAA = None
- base_scheduler.email_config = {
- "mail_enable": conf["mail_enable"],
- "subject": conf["mail_subject"],
- "account": conf["account"],
- "pass_code": conf["pass_code"],
- "receipts": [conf["account"]],
- "notify": False,
+ base_scheduler.send_message_config = {
+ "email_config":{
+ "mail_enable": conf["mail_enable"],
+ "subject": conf["mail_subject"],
+ "account": conf["account"],
+ "pass_code": conf["pass_code"],
+ "receipts": [conf["account"]],
+ "notify": False,
+ },
+ "serverJang_push_config":{
+ "server_push_enable": conf["server_push_enable"],
+ "sendKey": conf["sendKey"],
+ }
}
-
set_maa_options(base_scheduler)
set_recruit_options(base_scheduler)
set_skland_options(base_scheduler)
@@ -338,7 +343,7 @@ def simulate():
obj.format(timezone_offset) for obj in base_scheduler.tasks
]
)
- base_scheduler.send_email(body, subject, "html")
+ base_scheduler.send_message(body, subject, "html")
base_scheduler.maa_plan_solver()
elif sleep_time > 0:
subject = f"休息 {format_time(remaining_time)},到{base_scheduler.tasks[0].time.strftime('%H:%M:%S')}开始工作"
@@ -357,7 +362,7 @@ def simulate():
obj.format(timezone_offset) for obj in base_scheduler.tasks
]
)
- base_scheduler.send_email(body, subject, "html")
+ base_scheduler.send_message(body, subject, "html")
time.sleep(sleep_time)
if conf["exit_game_when_idle"]:
restart_simulator(conf["simulator"], stop=False)
diff --git a/arknights_mower/command.py b/arknights_mower/command.py
index 27fdbe847..ed2729bd7 100644
--- a/arknights_mower/command.py
+++ b/arknights_mower/command.py
@@ -84,7 +84,7 @@ def shop(args: list[str] = [], device: Device = None):
ShopSolver(device).run(args)
-def recruit(args: list[str] = [], email_config={}, recruit_config={}, device: Device = None):
+def recruit(args: list[str] = [], send_message_config={}, recruit_config={}, device: Device = None):
"""
recruit [agents ...]
自动进行公共招募
@@ -93,9 +93,9 @@ def recruit(args: list[str] = [], email_config={}, recruit_config={}, device: De
choose = {}
result = {}
if len(args) == 0:
- choose, result = RecruitSolver(device).run(config.RECRUIT_PRIORITY, email_config, recruit_config)
+ choose, result = RecruitSolver(device).run(config.RECRUIT_PRIORITY, send_message_config, recruit_config)
else:
- choose, result = RecruitSolver(device).run(args, email_config,recruit_config)
+ choose, result = RecruitSolver(device).run(args, send_message_config,recruit_config)
return choose, result
diff --git a/arknights_mower/solvers/base_schedule.py b/arknights_mower/solvers/base_schedule.py
index d106a6774..2da5218fe 100644
--- a/arknights_mower/solvers/base_schedule.py
+++ b/arknights_mower/solvers/base_schedule.py
@@ -190,7 +190,7 @@ def overtake_room(self):
self.tasks.append(SchedulerTask(datetime.now(), task_plan=_plan))
else:
msg = f'无法完成 {self.task.meta_data} 的排班,请检查替换组是否被占用'
- self.send_email(msg)
+ self.send_message(msg)
else:
# 如果不满足,则找到并且执行最近一个type 包含 超过数量的high free 和low free 的 任务并且 干员没有 exaust_require 词条
task_index = -1
@@ -870,7 +870,7 @@ def get_resting_plan(self, agents, exist_replacement, plan, high_free, low_free)
if not low_agent.rest_in_full:
msg = f'同组干员{low_name}与{high_name}心情差值大于4,请注意!'
logger.warning(msg)
- self.send_email(msg)
+ self.send_message(msg)
return exist_replacement, plan, high_free - _high, low_free - _low
def initialize_operators(self):
@@ -1995,7 +1995,7 @@ def agent_arrange_room(self, new_plan, room, plan, skip_enter=False, get_time=Fa
else:
logger.info(f"检测到漏单")
self.recog.save_screencap("run_order_failure")
- self.send_email("检测到漏单!")
+ self.send_message("检测到漏单!")
raise Exception("检测到漏单!")
while self.find('arrange_order_options') is None:
if error_count > 3:
@@ -2282,9 +2282,9 @@ def maa_plan_solver(self, tasks='All', one_time=False):
"""测试公招用"""
if self.recruit_config['recruit_enable']:
- recruit([], self.email_config, self.recruit_config)
+ recruit([], self.send_message_config, self.recruit_config)
- self.send_email('启动MAA')
+ self.send_message('启动MAA')
self.back_to_index()
# 任务及参数请参考 docs/集成文档.md
self.initialize_maa()
@@ -2333,7 +2333,7 @@ def maa_plan_solver(self, tasks='All', one_time=False):
if hard_stop:
hard_stop_msg = "Maa任务未完成,等待3分钟关闭游戏"
logger.info(hard_stop_msg)
- self.send_email(hard_stop_msg)
+ self.send_message(hard_stop_msg)
time.sleep(180)
self.device.exit(self.package_name)
elif not one_time:
@@ -2346,7 +2346,7 @@ def maa_plan_solver(self, tasks='All', one_time=False):
logger.debug(stage_drop)
# 有掉落东西再发
if stage_drop["details"]:
- self.send_email(maa_template.render(stage_drop=stage_drop), "Maa停止", "html")
+ self.send_message(maa_template.render(stage_drop=stage_drop), "Maa停止", "html")
'''仅发送由maa选择的结果以及稀有tag'''
if recruit_results:
@@ -2354,15 +2354,15 @@ def maa_plan_solver(self, tasks='All', one_time=False):
# 稀有tag发送
if recruit_special_tags['tags']:
result = filter_result(recruit_special_tags['tags'], recruit_results["results"], 0)
- self.send_email(recruit_template.render(recruit_results=result), "出现稀有tag辣", "html")
+ self.send_message(recruit_template.render(recruit_results=result), "出现稀有tag辣", "html")
# 发送选择的tag
if recruit_tags_selected['tags']:
result = filter_result(recruit_tags_selected['tags'], recruit_results["results"], 1)
- self.send_email(recruit_template.render(recruit_results=result), "公招结果", "html")
+ self.send_message(recruit_template.render(recruit_results=result), "公招结果", "html")
else:
- self.send_email("Maa单次任务停止")
+ self.send_message("Maa单次任务停止")
now_time = datetime.now().time()
try:
min_time = datetime.strptime(self.maa_config['sleep_min'], "%H:%M").time()
@@ -2382,7 +2382,7 @@ def maa_plan_solver(self, tasks='All', one_time=False):
if (self.maa_config['roguelike'] or self.maa_config['reclamation_algorithm'] or self.maa_config[
'stationary_security_service']) and not rg_sleep:
logger.info(f'准备开始:肉鸽/保全/演算')
- self.send_email('启动 肉鸽/保全/演算')
+ self.send_message('启动 肉鸽/保全/演算')
while (self.tasks[0].time - datetime.now()).total_seconds() > 30:
self.MAA = None
self.initialize_maa()
@@ -2455,7 +2455,7 @@ def maa_plan_solver(self, tasks='All', one_time=False):
logger.exception(e)
self.MAA = None
self.device.exit(self.package_name)
- self.send_email(str(e), "Maa调用出错!")
+ self.send_message(str(e), "Maa调用出错!")
remaining_time = (self.tasks[0].time - datetime.now()).total_seconds()
if remaining_time > 0:
logger.info(f"休息 {format_time(remaining_time)},到{self.tasks[0].time.strftime('%H:%M:%S')}开始工作")
diff --git a/arknights_mower/solvers/recruit.py b/arknights_mower/solvers/recruit.py
index 1737fe17a..00d9a51b2 100644
--- a/arknights_mower/solvers/recruit.py
+++ b/arknights_mower/solvers/recruit.py
@@ -48,7 +48,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None:
self.recruit_pos = -1
- def run(self, priority: list[str] = None, email_config={}, recruit_config={}):
+ def run(self, priority: list[str] = None, send_message_config={}, recruit_config={}):
"""
:param priority: list[str], 优先考虑的公招干员,默认为高稀有度优先
"""
@@ -56,7 +56,7 @@ def run(self, priority: list[str] = None, email_config={}, recruit_config={}):
self.recruiting = 0
self.has_ticket = True # 默认含有招募票
self.can_refresh = True # 默认可以刷新
- self.email_config = email_config
+ self.send_message_config = send_message_config
# 调整公招参数
self.add_recruit_param(recruit_config)
@@ -83,7 +83,7 @@ def run(self, priority: list[str] = None, email_config={}, recruit_config={}):
if self.agent_choose:
logger.info(f'公招标签:{self.agent_choose}')
if self.agent_choose or self.result_agent:
- self.send_email(recruit_template.render(recruit_results=self.agent_choose,
+ self.send_message(recruit_template.render(recruit_results=self.agent_choose,
recruit_get_agent=self.result_agent,
title_text="公招汇总"), "公招汇总通知", "html")
@@ -189,7 +189,7 @@ def recruit_tags(self) -> bool:
# 刷新标签
if need_choose is False:
'''稀有tag或支援,不需要选'''
- self.send_email(recruit_rarity.render(recruit_results=best['possible'], title_text="稀有tag通知"), "出稀有标签辣",
+ self.send_message(recruit_rarity.render(recruit_results=best['possible'], title_text="稀有tag通知"), "出稀有标签辣",
"html")
logger.debug('稀有tag,发送邮件')
self.back()
diff --git a/arknights_mower/templates/conf.yml b/arknights_mower/templates/conf.yml
index 83bb190e5..767a0f602 100644
--- a/arknights_mower/templates/conf.yml
+++ b/arknights_mower/templates/conf.yml
@@ -244,4 +244,6 @@ sss:
copilot: ''
run_order_grandet_mode:
enable: true
- buffer_time: 30
\ No newline at end of file
+ buffer_time: 30
+server_push_enable: false
+sendKey: ''
\ No newline at end of file
diff --git a/arknights_mower/templates/email/recruit_template.html b/arknights_mower/templates/email/recruit_template.html
index c2f70e682..48f2aa5c5 100644
--- a/arknights_mower/templates/email/recruit_template.html
+++ b/arknights_mower/templates/email/recruit_template.html
@@ -1,4 +1,4 @@
-
+
@@ -14,47 +14,34 @@
-
- {% if recruit_results|length > 0 %}
-
- 位置 | 标签 | 预计干员 |
- {% for pos,value in recruit_results.items() %}
-
+
+ {% if recruit_results|length > 0 %}
+
+ 位置 |
+ 标签 |
+ 预计干员 |
+
+ {% for pos,value in recruit_results.items() %}
+
{{ pos }} |
- {% for key,value in value.items() %}
-
- {% for tag in key %}
- {% if tag != "" %}
- {{ tag }}
- {% else %}
- {{ "未选择" }}
- {% endif %}
- {% endfor %}
- |
- {% for agent in value.agent %}
- {{ agent.name }}
- {% endfor %}
- |
- {% endfor %}
-
- {% endfor %}
- {% endif %}
-
- {% if recruit_get_agent|length > 0 %}
- 上次公招干员 |
- {% for pos,value in recruit_get_agent.items() %}
-
- {{ pos }} |
- {{ value }} |
-
- {% endfor %}
-
-
-
- {% endif %}
-
-
+ {% for key,value in value.items() %}
+
+ {% for tag in key %} {% if tag != "" %} {{ tag }} {% else %} {{
+ "未选择" }} {% endif %} {% endfor %}
+ |
+ {% for agent in value.agent %} {{ agent.name }} {% endfor %} |
+ {% endfor %}
+
+ {% endfor %} {% endif %} {% if recruit_get_agent|length > 0 %}
+
+ 上次公招干员 |
+
+ {% for pos,value in recruit_get_agent.items() %}
+
+ {{ pos }} |
+ {{ value }} |
+
+ {% endfor %} {% endif %}
+
-
-
diff --git a/arknights_mower/utils/solver.py b/arknights_mower/utils/solver.py
index 3b6922682..c2fdbf8d9 100644
--- a/arknights_mower/utils/solver.py
+++ b/arknights_mower/utils/solver.py
@@ -6,6 +6,9 @@
import time
import traceback
+import requests
+
+from bs4 import BeautifulSoup
from abc import abstractmethod
from ..utils import typealias as tp
@@ -419,31 +422,149 @@ def wait_for_scene(self, scene, method, wait_count=10, sleep_time=1):
wait_count -= 1
raise Exception("等待超时")
- # 邮件发送 EightyDollars
- def send_email(self, body='', subject='', subtype='plain', retry_times=3):
- if 'mail_enable' in self.email_config.keys() and self.email_config['mail_enable'] == 0:
- logger.info('邮件功能未开启')
- return
-
- if subtype == 'plain' and subject == '':
- subject = body
-
- msg = MIMEMultipart()
- msg.attach(MIMEText(body, subtype))
- msg['Subject'] = self.email_config['subject'] + subject
- msg['From'] = self.email_config['account']
-
- while retry_times > 0:
+ # 将html表单转化为通用markdown格式(为了避免修改之前email内容,采用基于之前数据格式进行加工的方案)
+ def html_to_markdown(self, html_content):
+ soup = BeautifulSoup(html_content, 'html.parser')
+
+ markdown_output = ""
+
+ # 提取标题
+ title = soup.find('title')
+ if title:
+ markdown_output += f"## {title.get_text()}\n\n"
+
+ # 提取表格
+ for table in soup.find_all('table'):
+ rows = table.find_all('tr')
+ header_processed = False # 标记是否已经处理过列头
+ for row in rows:
+ columns = row.find_all(['td', 'th'])
+ line_data = []
+ for col in columns:
+ colspan = int(col.get('colspan', 1))
+ content = col.get_text().strip() + ' ' * (colspan - 1)
+ line_data.append(content)
+ markdown_output += "| " + " | ".join(line_data) + " |\n"
+
+ # 仅为首个列头添加分隔线
+ if any(cell.name == 'th' for cell in columns) and not header_processed:
+ line_separators = []
+ for col in columns:
+ colspan = int(col.get('colspan', 1))
+ line_separators.extend(['---'] * colspan)
+ markdown_output += "| " + " | ".join(line_separators) + " |\n"
+ header_processed = True
+
+ return markdown_output.strip()
+
+ # 指数退避策略逐渐增加等待时间
+ def exponential_backoff(self, initial_delay=1, max_retries=3, factor=2):
+ """ Implement exponential backoff for retries. """
+ delay = initial_delay
+ retries = 0
+ while retries < max_retries:
+ yield delay
+ delay *= factor
+ retries += 1
+
+ # QQ邮件异常处理
+ def handle_email_error(self, email_config, msg):
+ for delay in self.exponential_backoff():
try:
s = smtplib.SMTP_SSL("smtp.qq.com", 465, timeout=10.0)
- # 登录邮箱
- s.login(self.email_config['account'], self.email_config['pass_code'])
- # 开始发送
- s.sendmail(self.email_config['account'], self.email_config['receipts'], msg.as_string())
+ s.login(email_config['account'], email_config['pass_code'])
+ s.sendmail(email_config['account'], email_config.get('receipts', []), msg.as_string())
logger.info("邮件发送成功")
break
except Exception as e:
logger.error("邮件发送失败")
logger.exception(e)
- retry_times -= 1
- time.sleep(3)
+ time.sleep(delay)
+
+ # Server酱异常处理
+ def handle_serverJang_error(self, url, data):
+ for delay in self.exponential_backoff():
+ try:
+ response = requests.post(url, data=data)
+ json_data = response.json()
+ if json_data.get('code') == 0:
+ logger.info('Server酱通知发送成功')
+ break
+ else:
+ logger.error(f"Server酱通知发送失败,错误信息:{json_data.get('message')}")
+ time.sleep(delay)
+ except Exception as e:
+ logger.error("Server酱通知发送失败")
+ logger.exception(e)
+ time.sleep(delay)
+
+ # 消息发送 原Email发送 EightyDollars
+ def send_message(self, body='', subject='', subtype='plain', retry_times=3):
+ send_message_config = getattr(self, 'send_message_config', None)
+ if not send_message_config:
+ logger.error("send_message_config 未在配置中定义!")
+ return
+
+ failed_methods = []
+
+ if subtype == 'plain' and subject == '':
+ subject = body
+
+ # markdown格式的消息体
+ mkBody = body
+ # 如果body是HTML内容,转换为Markdown格式
+ if subtype == 'html':
+ mkBody = self.html_to_markdown(body)
+
+
+ # 获取QQ邮件配置
+ email_config = send_message_config.get('email_config')
+ # 获取Server酱配置
+ serverJang_push_config = send_message_config.get('serverJang_push_config')
+
+ # 邮件通知部分
+ if email_config and email_config.get('mail_enable', 0):
+ msg = MIMEMultipart()
+ msg.attach(MIMEText(body, subtype))
+ msg['Subject'] = email_config.get('subject', '') + subject
+ msg['From'] = email_config.get('account', '')
+
+ try:
+ self.handle_email_error(email_config, msg) # 第一次尝试
+ except Exception as e:
+ failed_methods.append(('email', email_config, msg))
+
+ # Server酱通知部分
+ if serverJang_push_config and serverJang_push_config.get('server_push_enable', False):
+ send_key = serverJang_push_config.get('sendKey')
+ if not send_key:
+ logger.error('Server酱的sendKey未配置')
+ return
+
+ url = f'https://sctapi.ftqq.com/{send_key}.send'
+ data = {
+ 'title': '[Mower通知]' + subject,
+ 'desp': mkBody
+ }
+
+ try:
+ self.handle_serverJang_error(url, data) # 第一次尝试
+ except Exception as e:
+ failed_methods.append(('serverJang', url, data))
+
+ # 处理失败的方法
+ for method, *args in failed_methods:
+ if method == 'email':
+ for _ in range(retry_times):
+ try:
+ self.handle_email_error(*args)
+ break
+ except:
+ time.sleep(1)
+ elif method == 'serverJang':
+ for _ in range(retry_times):
+ try:
+ self.handle_serverJang_error(*args)
+ break
+ except:
+ time.sleep(1)
diff --git a/diy.py b/diy.py
index 49d4ac1d9..8a5cdd123 100644
--- a/diy.py
+++ b/diy.py
@@ -19,17 +19,27 @@
from arknights_mower.utils.operators import Operators, Operator, Dormitory
from arknights_mower.utils.scheduler_task import SchedulerTask,TaskTypes
-email_config= {
- # 发信账户
- 'account':"xxx@qq.com",
- # 在QQ邮箱“帐户设置-账户-开启SMTP服务”中,按照指示开启服务获得授权码
- 'pass_code':'xxx',
- # 收件人邮箱
- 'receipts':['任何邮箱'],
- # 是否启用邮件提醒
- 'mail_enable':False,
- # 邮件主题
- 'subject': '任务数据'
+send_message_config= {
+ # QQ邮箱通知配置
+ "email_config":{
+ # 发信账户
+ 'account':"xxx@qq.com",
+ # 在QQ邮箱“帐户设置-账户-开启SMTP服务”中,按照指示开启服务获得授权码
+ 'pass_code':'xxx',
+ # 收件人邮箱
+ 'receipts':['任何邮箱'],
+ # 是否启用邮件提醒
+ 'mail_enable':False,
+ # 邮件主题
+ 'subject': '任务数据'
+ },
+ # Server酱通知配置
+ "serverJang_push_config":{
+ # 是否启用Server酱提示
+ "server_push_enable": False,
+ # Key值
+ "sendKey":'xxx'
+ }
}
maa_config = {
"maa_enable": True,
@@ -263,7 +273,7 @@ def inialize(tasks, scheduler=None):
base_scheduler.free_blacklist = free_blacklist
base_scheduler.resting_threshold = resting_threshold
base_scheduler.MAA = None
- base_scheduler.email_config = email_config
+ base_scheduler.send_message_config = send_message_config
base_scheduler.ADB_CONNECT = config.ADB_CONNECT[0]
base_scheduler.maa_config = maa_config
base_scheduler.error = False
@@ -357,7 +367,7 @@ def simulate():
(base_scheduler.tasks.sort(key=lambda x: x.time, reverse=False))
sleep_time = (base_scheduler.tasks[0].time - datetime.now()).total_seconds()
logger.info('||'.join([str(t) for t in base_scheduler.tasks]))
- base_scheduler.send_email(
+ base_scheduler.send_message(
task_template.render(tasks=[obj.format(timezone_offset) for obj in base_scheduler.tasks]), '',
'html')
# 如果任务间隔时间超过9分钟则启动MAA
diff --git a/menu.py b/menu.py
index de053c0ba..7df0878cd 100644
--- a/menu.py
+++ b/menu.py
@@ -196,6 +196,7 @@ def menu():
pass_code = sg.Input(conf['pass_code'], size=60, key='conf_pass_code', enable_events=True, password_char='*')
mail_frame = sg.Frame('邮件提醒',
[[mail_enable_1, mail_enable_0], [account_title, account], [pass_code_title, pass_code]])
+
# maa
maa_enable_1 = sg.Radio('启用', 'maa_enable', default=conf['maa_enable'] == 1,
diff --git a/server.py b/server.py
index e8976c29c..d7af6e2f2 100755
--- a/server.py
+++ b/server.py
@@ -282,6 +282,22 @@ def test_email():
return "邮件发送失败!\n" + str(e)
return "邮件发送成功!"
+@app.route("/test-serverJang-push")
+@require_token
+def test_serverJang_push():
+ try:
+ response = requests.get(f"https://sctapi.ftqq.com/{conf['sendKey']}.send", params={
+ "title": "arknights-mower推送测试",
+ "desp": "arknights-mower推送测试"
+ })
+
+ if response.status_code == 200 and response.json().get("code") == 0:
+ return "发送成功"
+ else:
+ return "发送失败 : " + response.json().get("message", "")
+ except Exception as e:
+ return "发送失败 : " + str(e)
+
@app.route("/check-skland")
@require_token
diff --git a/ui/components.d.ts b/ui/components.d.ts
index 2c48b986e..adb7d9249 100644
--- a/ui/components.d.ts
+++ b/ui/components.d.ts
@@ -62,6 +62,7 @@ declare module '@vue/runtime-core' {
Recruit: typeof import('./src/components/Recruit.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
+ ServerJang: typeof import('./src/components/ServerJang.vue')['default']
SKLand: typeof import('./src/components/SKLand.vue')['default']
}
}
diff --git a/ui/src/components/ServerJang.vue b/ui/src/components/ServerJang.vue
new file mode 100644
index 000000000..71e2bc2e5
--- /dev/null
+++ b/ui/src/components/ServerJang.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+ Server酱推送通知
+
+ 什么是Server酱?参考:
+
+ https://sct.ftqq.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
发送测试通知
+
{{ testPushResult }}
+
+
+
+
+
+
diff --git a/ui/src/pages/Settings.vue b/ui/src/pages/Settings.vue
index da7adea14..eece5e482 100644
--- a/ui/src/pages/Settings.vue
+++ b/ui/src/pages/Settings.vue
@@ -303,6 +303,7 @@ function render_label(option) {
+
diff --git a/ui/src/stores/config.js b/ui/src/stores/config.js
index 8eb7a9047..4cb002f0a 100644
--- a/ui/src/stores/config.js
+++ b/ui/src/stores/config.js
@@ -56,6 +56,8 @@ export const useConfigStore = defineStore('config', () => {
const recruitment_time = ref(false)
const recruit_robot = ref(true)
const run_order_grandet_mode = ref({})
+ const server_push_enable = ref(false) // Server酱通知开关
+ const sendKey = ref('') // Server酱Key值
async function load_shop() {
const response = await axios.get(`${import.meta.env.VITE_HTTP_URL}/shop`)
@@ -127,6 +129,9 @@ export const useConfigStore = defineStore('config', () => {
recruitment_time.value = response.data.recruitment_time
recruit_robot.value = response.data.recruit_robot
run_order_grandet_mode.value = response.data.run_order_grandet_mode
+ // 新增:加载Server酱的配置
+ server_push_enable.value = response.data.server_push_enable != 0
+ sendKey.value = response.data.sendKey
}
function build_config() {
@@ -186,7 +191,10 @@ export const useConfigStore = defineStore('config', () => {
recruit_only_4: recruit_only_4.value,
recruitment_time: recruitment_time.value,
recruit_robot: recruit_robot.value,
- run_order_grandet_mode: run_order_grandet_mode.value
+ run_order_grandet_mode: run_order_grandet_mode.value,
+ // 新增:Server酱的配置
+ server_push_enable: server_push_enable.value ? 1 : 0,
+ sendKey: sendKey.value
}
}
@@ -242,7 +250,9 @@ export const useConfigStore = defineStore('config', () => {
recruit_robot,
skland_enable,
skland_info,
- run_order_grandet_mode
+ run_order_grandet_mode,
+ server_push_enable,
+ sendKey
],
() => {
axios.post(`${import.meta.env.VITE_HTTP_URL}/conf`, build_config())
@@ -306,6 +316,8 @@ export const useConfigStore = defineStore('config', () => {
recruit_robot,
skland_enable,
skland_info,
- run_order_grandet_mode
+ run_order_grandet_mode,
+ server_push_enable,
+ sendKey
}
})