From 02c469a7bece682b427c2f6efeb28494e50bc945 Mon Sep 17 00:00:00 2001 From: qiaoyun680 Date: Wed, 23 Oct 2024 08:07:37 +0000 Subject: [PATCH] =?UTF-8?q?=E6=8C=89pr=E8=A6=81=E6=B1=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/services/notify.ts | 2 +- sample/notify.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/back/services/notify.ts b/back/services/notify.ts index e386bcf9..e76ea30f 100644 --- a/back/services/notify.ts +++ b/back/services/notify.ts @@ -156,7 +156,7 @@ export default class NotificationService { const url = matchResult && matchResult[1] ? `https://${matchResult[1]}.push.ft07.com/send/${serverChanKey}.send` : `https://sctapi.ftqq.com/${serverChanKey}.send`; - + try { const res: any = await got .post(url, { diff --git a/sample/notify.py b/sample/notify.py index 3dc9e1b4..a6cfaa1a 100644 --- a/sample/notify.py +++ b/sample/notify.py @@ -302,10 +302,14 @@ def serverJ(title: str, content: str) -> None: print("serverJ 服务启动") data = {"text": title, "desp": content.replace("\n", "\n\n")} - if push_config.get("PUSH_KEY").startswith("sctp"): - url = f'https://{push_config.get("PUSH_KEY")}.push.ft07.com/send' + + match = re.match(r'sctp(\d+)t', push_config.get("PUSH_KEY")) + if match: + num = match.group(1) + url = f'https://{num}.push.ft07.com/send/{push_config.get("PUSH_KEY")}.send' else: url = f'https://sctapi.ftqq.com/{push_config.get("PUSH_KEY")}.send' + response = requests.post(url, data=data).json() if response.get("errno") == 0 or response.get("code") == 0: @@ -780,6 +784,7 @@ def chronocat(title: str, content: str) -> None: else: print(f"QQ群消息:{ids}推送失败!") + def ntfy(title: str, content: str) -> None: """ 通过 Ntfy 推送消息