This commit is contained in:
jxxghp 2023-06-15 13:44:49 +08:00
parent 9efb2007fc
commit b6421d4f17
2 changed files with 10 additions and 11 deletions

View File

@ -96,7 +96,7 @@ class AutoSignIn(_PluginBase):
if status: if status:
logger.info("站点签到任务完成!") logger.info("站点签到任务完成!")
# 发送通知 # 发送通知
self.chain.run_module("post_message", title="站点自动签到", text="\n".join(status)) self.chain.post_message(title="站点自动签到", text="\n".join(status))
else: else:
logger.error("站点签到任务失败!") logger.error("站点签到任务失败!")
@ -118,7 +118,7 @@ class AutoSignIn(_PluginBase):
try: try:
status, msg = site_module().signin(site_info) status, msg = site_module().signin(site_info)
# 特殊站点直接返回签到信息,防止仿真签到、模拟登陆有歧义 # 特殊站点直接返回签到信息,防止仿真签到、模拟登陆有歧义
return msg return msg or ""
except Exception as e: except Exception as e:
return f"{site_info.get('name')}】签到失败:{str(e)}" return f"{site_info.get('name')}】签到失败:{str(e)}"
else: else:

View File

@ -128,10 +128,10 @@ class SiteStatistic(_PluginBase):
i = html_text.find("window.location") i = html_text.find("window.location")
if i == -1: if i == -1:
return None return None
tmp_url = url + html_text[i:html_text.find(";")]\ tmp_url = url + html_text[i:html_text.find(";")] \
.replace("\"", "")\ .replace("\"", "") \
.replace("+", "")\ .replace("+", "") \
.replace(" ", "")\ .replace(" ", "") \
.replace("window.location=", "") .replace("window.location=", "")
res = RequestUtils(cookies=site_cookie, res = RequestUtils(cookies=site_cookie,
session=session, session=session,
@ -244,11 +244,10 @@ class SiteStatistic(_PluginBase):
for head, date, content in site_user_info.message_unread_contents: for head, date, content in site_user_info.message_unread_contents:
msg_title = f"【站点 {site_user_info.site_name} 消息】" msg_title = f"【站点 {site_user_info.site_name} 消息】"
msg_text = f"时间:{date}\n标题:{head}\n内容:\n{content}" msg_text = f"时间:{date}\n标题:{head}\n内容:\n{content}"
self.chain.run_module("post_message", title=msg_title, text=msg_text) self.chain.post_message(title=msg_title, text=msg_text)
else: else:
self.chain.run_module("post_message", self.chain.post_message(title=f"站点 {site_user_info.site_name} 收到 "
title=f"站点 {site_user_info.site_name} 收到 " f"{site_user_info.message_unread} 条新消息,请登陆查看")
f"{site_user_info.message_unread} 条新消息,请登陆查看")
@eventmanager.register(EventType.SiteStatistic) @eventmanager.register(EventType.SiteStatistic)
def refresh(self, event: Event): def refresh(self, event: Event):
@ -330,6 +329,6 @@ class SiteStatistic(_PluginBase):
f"总上传:{StringUtils.str_filesize(incUploads)}\n" f"总上传:{StringUtils.str_filesize(incUploads)}\n"
f"总下载:{StringUtils.str_filesize(incDownloads)}\n" f"总下载:{StringUtils.str_filesize(incDownloads)}\n"
f"————————————") f"————————————")
self.chain.run_module("post_message", title="站点数据统计", text="\n".join(messages)) self.chain.post_message(title="站点数据统计", text="\n".join(messages))
logger.info("站点数据刷新完成") logger.info("站点数据刷新完成")