修正推送失效

This commit is contained in:
Night Glow 2024-11-23 20:16:57 +08:00
parent edec5018c3
commit f93abaceea
3 changed files with 45 additions and 26 deletions

24
SFSY.py
View File

@ -1639,13 +1639,22 @@ class RUN:
# self.DRAGONBOAT_2024_Game_init()
self.DRAGONBOAT_2024_coinStatus(True)
self.sendMsg()
# self.sendMsg()
self.send_notification_message('顺丰速运')
return True
def sendMsg(self, help=False):
if self.send_UID:
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
print(push_res)
# def sendMsg(self, help=False):
# if self.send_UID:
# push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
# print(push_res)
def send_notification_message(self,title):
try:
from notify import send
send(title, ''.join(send_msg))
except Exception as e:
if e:
print(f'发送通知消息失败!{e}')
def get_quarter_end_date():
@ -1716,7 +1725,7 @@ if __name__ == '__main__':
点击积分以下几种url之一
https://mcs-mimp-web.sf-express.com/mcs-mimp/share/weChat/shareGiftReceiveRedirect
https://mcs-mimp-web.sf-express.com/mcs-mimp/share/app/shareRedirect
多账号#、@、换行分割
多账号#、@、换行分割
设置青龙变量
export {ENV_NAME}='url'多账号#分割
@ -1734,11 +1743,10 @@ export {ENV_NAME}='url'多账号#分割
print(f'{ENV_NAME}变量')
#exit()
local_version = '2024.06.02'
# print(tokens)
if len(tokens) > 0:
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
for index, infos in enumerate(tokens):
run_result = RUN(infos, index).main()
if not run_result: continue

28
mtV1.py
View File

@ -28,9 +28,19 @@ else:
meituanCookie = ['']
print('无meituanCookie变量')
def send_notification_message(title):
try:
from sendNotify import send
send(title, ''.join(all_print_list))
except Exception as e:
if e:
print('发送通知消息失败!')
#外卖
def waim(ck):
cookie = f"token={ck};"
headers = {"Cookie": cookie,
"X-Requested-With":"com.tencent.mm",
@ -45,11 +55,11 @@ def waim(ck):
print(f"获得{len(b['data']['allCoupons'])}张优惠券")
for sj in b['data']['allCoupons']:
print(f"{sj['couponName']}-{sj['amountLimit']}-{sj['couponAmount']}元-{sj['amountLimit']}-{sj['etime']}")
#团购
def tuangou(ck):
cookie = f"token={ck};"
headers = {"Cookie": cookie,
"X-Requested-With":"com.tencent.mm",
@ -64,7 +74,7 @@ def tuangou(ck):
print(f"获得{len(b['data']['allCoupons'])}张优惠券")
for sj in b['data']['allCoupons']:
print(f"{sj['couponName']}-{sj['amountLimit']}-{sj['couponAmount']}元-{sj['amountLimit']}-{sj['etime']}")
def main():
@ -86,7 +96,7 @@ def main():
print('-------------')
except Exception as e:
print('错误')
print('----------------------')
z = z + 1
except Exception as e:
@ -97,7 +107,7 @@ if __name__ == '__main__':
main()
except Exception as e:
print('未知错误')
# try:
# send_notification_message(title='') # 发送通知
# except Exception as e:
# print('小错误')
try:
send_notification_message(title='') # 发送通知
except Exception as e:
print('小错误')

View File

@ -69,11 +69,11 @@ if "PUSH_PLUS_TOKEN" in os.environ:
if "QYWX_AM" in os.environ:
if len(os.environ["QYWX_AM"]) > 1:
QYWX_AM = os.environ["QYWX_AM"]
if "QYWX_KEY" in os.environ:
if len(os.environ["QYWX_KEY"]) > 1:
QYWX_KEY = os.environ["QYWX_KEY"]
QYWX_KEY = os.environ["QYWX_KEY"]
# print("已获取并使用Env环境 QYWX_AM")
#接入飞书webhook推送
@ -159,7 +159,8 @@ def serverJ(title, content):
"text": title,
"desp": content.replace("\n", "\n\n")
}
response = requests.post(f"https://sc.ftqq.com/{PUSH_KEY}.send", data=data).json()
response = requests.post(
f"https://sct.ftqq.com/{PUSH_KEY}.send", data=data).json()
if response['code'] == 0:
print('推送成功!')
else:
@ -267,13 +268,13 @@ def wecom_key(title, content):
print("QYWX_KEY服务启动")
print("content"+content)
headers = {'Content-Type': 'application/json'}
data = {
data = {
"msgtype":"text",
"text":{
"content":title+"\n"+content.replace("\n", "\n\n")
}
}
print(f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={QYWX_KEY}")
response = requests.post(f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={QYWX_KEY}", json=data,headers=headers).json()
print(response)
@ -287,13 +288,13 @@ def fs_key(title, content):
print("FS_KEY服务启动")
print("content"+content)
headers = {'Content-Type': 'application/json'}
data = {
data = {
"msg_type":"text",
"content":{
"text":title+"\n"+content.replace("\n", "\n\n")
}
}
print(f"https://open.feishu.cn/open-apis/bot/v2/hook/{FS_KEY}")
response = requests.post(f"https://open.feishu.cn/open-apis/bot/v2/hook/{FS_KEY}", json=data,headers=headers).json()
print(response)
@ -439,9 +440,9 @@ def send(title, content):
continue
elif i == 'wecom_key':
if QYWX_KEY:
for i in range(int(len(content)/2000)+1):
wecom_key(title=title, content=content[i*2000:(i+1)*2000])
wecom_key(title=title, content=content[i*2000:(i+1)*2000])
else:
print('未启用企业微信应用消息推送')
continue