diff --git a/README.md b/README.md index 6588849..bfe57be 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,7 @@ ## 快速安装 -Windows 下载最新的release文件 [下载链接](https://github.com/mikumifa/cppTickerBuy/releases) - - +Windows 下载最新的release文件 (cppTickerBuy.zip) [下载链接](https://github.com/mikumifa/cppTickerBuy/releases) > **NOTE** > > 如果你对Github一点也不了解, 不知道在哪下载 @@ -48,6 +46,14 @@ Running on local URL: http://127.0.0.1:xxx 反馈程序BUG或者提新功能建议: [点此链接向项目提出反馈BUG](https://github.com/mikumifa/cppTickerBuy/issues/new/choose) +## 其他可用脚本 + +| 链接 | 主要特色 | +| --------------------------------------------------------- | ---------------------- | +| https://github.com/Koileo/ticket_for_allcpp | 能同时开多张票 | + + + ## 项目贡献者 @@ -60,6 +66,13 @@ Running on local URL: http://127.0.0.1:xxx
mikumifa + + + + WittF +
+ W1ttF +
diff --git a/tab/go.py b/tab/go.py index aa354c6..a433d8b 100644 --- a/tab/go.py +++ b/tab/go.py @@ -18,7 +18,8 @@ from requests import HTTPError, RequestException from config import global_cookieManager, main_request, configDB, time_service -from util import PlusUtil +from util import PushPlusUtil +from util import ServerChanUtil from util.error import ERRNO_DICT, withTimeString @@ -241,9 +242,14 @@ def inner_request(): gr.update(visible=False), gr.update(value=qr_gen_image.get_image(), visible=True) ] - plusToken = configDB.get("plusToken") - if plusToken is not None and plusToken != "": - PlusUtil.send_message(plusToken, "抢票成功", "付款吧") + pushplusToken = configDB.get("pushplusToken") + if pushplusToken is not None and pushplusToken != "": + PushPlusUtil.send_message(pushplusToken, "抢票成功", "付款吧") + serverchanKey = configDB.get("serverchanKey") + if serverchanKey is not None and serverchanKey != "": + ServerChanUtil.send_message(serverchanKey, "抢票成功", "付款吧") + + if audio_path is not None and audio_path != "": def play_sound_in_loop(file_path): while True: diff --git a/tab/login.py b/tab/login.py index 4c56963..04b1a46 100644 --- a/tab/login.py +++ b/tab/login.py @@ -69,21 +69,33 @@ def add(): inputs=None, outputs=[info_ui, username_ui, gr_file_ui] ) - gr.Markdown(""" - > **微信消息推送功能如何添加** - > 参考 https://cloud.tencent.com/developer/article/2139538 - > 粘贴token到下面即可 - > 关闭的方式是直接删除token即可 - """) + gr.Markdown( + """ + 🗨️ 抢票成功提醒 + > 你需要去对应的网站获取key或token,然后填入下面的输入框 + > [Server酱](https://sct.ftqq.com/sendkey) | [pushplus](https://www.pushplus.plus/uc.html) + > 留空以不启用提醒功能 + """) with gr.Row(): - plus_ui = gr.Textbox( - value=configDB.get("plusToken") if configDB.get("plusToken") is not None else "", - label="PlusPlus的Token", + serverchan_ui = gr.Textbox( + value=configDB.get("serverchanKey") if configDB.get("serverchanKey") is not None else "", + label="Server酱的SendKey", interactive=True, - info="留空则表示不使用PlusPlus的提醒功能", + info="https://sct.ftqq.com/", ) - def inner_input(x): - return configDB.insert("plusToken", x) + pushplus_ui = gr.Textbox( + value=configDB.get("pushplusToken") if configDB.get("pushplusToken") is not None else "", + label="PushPlus的Token", + interactive=True, + info="https://www.pushplus.plus/", + ) + + def inner_input_serverchan(x): + return configDB.insert("serverchanKey", x) + def inner_input_pushplus(x): + return configDB.insert("pushplusToken", x) + + serverchan_ui.change(fn=inner_input_serverchan, inputs=serverchan_ui) - plus_ui.change(fn=inner_input, inputs=plus_ui) + pushplus_ui.change(fn=inner_input_pushplus, inputs=pushplus_ui) diff --git a/util/PlusUtil.py b/util/PushPlusUtil.py similarity index 91% rename from util/PlusUtil.py rename to util/PushPlusUtil.py index 618074a..c599ee3 100644 --- a/util/PlusUtil.py +++ b/util/PushPlusUtil.py @@ -22,7 +22,7 @@ def send_message(token, content, title): } requests.post(url, headers=headers, data=json.dumps(data)) except Exception as e: - loguru.logger.info("PlusPlus消息发送失败") + loguru.logger.info("PushPlus消息发送失败") diff --git a/util/ServerChanUtil.py b/util/ServerChanUtil.py new file mode 100644 index 0000000..38d7388 --- /dev/null +++ b/util/ServerChanUtil.py @@ -0,0 +1,31 @@ +import json + +import loguru +import requests +import playsound +import os + +from config import get_application_tmp_path + + +def send_message(token, desp, title): + try: + url = f"https://sctapi.ftqq.com/{token}.send" + headers = { + "Content-Type": "application/json" + } + + data = { + "desp": desp, + "title": title + } + requests.post(url, headers=headers, data=json.dumps(data)) + except Exception as e: + loguru.logger.info("ServerChan消息发送失败") + + + + + +if __name__ == '__main__': + playsound.playsound(os.path.join(get_application_tmp_path(), "default.mp3"))