From d90aff3f06bb29985d50973eeabaa496b64b6f49 Mon Sep 17 00:00:00 2001 From: chickliu Date: Tue, 19 Nov 2024 11:34:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=8F=AE=E5=8F=AE?= =?UTF-8?q?=E8=81=94=E7=9B=9F=5Fapi.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 叮叮联盟_api.py | 70 ++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/叮叮联盟_api.py b/叮叮联盟_api.py index c112ebe..015c097 100644 --- a/叮叮联盟_api.py +++ b/叮叮联盟_api.py @@ -46,7 +46,6 @@ from functools import wraps import requests import time import os -from notify import send import json import hashlib import random @@ -58,6 +57,7 @@ from base64 import b64encode import uuid from datetime import datetime,timedelta import re +from notify import send logging.basicConfig(level=logging.INFO, format='[%(levelname)s] ===> %(message)s') code = "叮叮联盟_api版" ver = "1.8" @@ -537,47 +537,45 @@ class yuanshen: logging.info(f'当前账号[{name}]余额[{m}]') url = 'https://api.jiudingliliang.com/user/withdraw' r = requests.post(url,headers=self.h,json={}).json() - - if r['code'] == 10000: - lessmoney = r["result"]["transfer"][0]["m"] - - # 检查是否可以提现并发送提醒 - if m >= lessmoney: - send("叮叮可提现通知📢", f'当前账号[{name}]余额[{m}],可以提现啦') - - # 检查是否有推送设置 - if appToken and uid: + + if r['code'] == 10000: + lessmoney = r["result"]["transfer"][0]["m"] if m >= lessmoney: - # 尝试提现 - url = 'https://api.jiudingliliang.com/user/transfer' - data = {'amount': lessmoney, 'type': 'alipay'} - r = requests.post(url, json=data, headers=self.h).json() - if r['code'] == 10000: - logging.info(f'提现成功[{r}]') - kl = r["result"]["alipay_kl"] - data = { - "appToken": appToken, - "content": f'叮叮联盟提现成功,口令[{kl}]', - "summary": f'叮叮联盟提现成功,口令[{kl}]', - "contentType": 1, - "uids": [uid], - "verifyPayType": 0 - } - r = requests.post('https://wxpusher.zjiecode.com/api/send/message', json=data).json() - if r['code'] == 1000: - logging.info('通知已发送') + send("叮叮可提现通知📢",f'当前账号[{name}]余额[{m}],可以提现啦🎉') + if appToken and uid: + if m >= lessmoney: + send("叮叮可提现通知📢",f'当前账号[{name}]余额[{m}],可以提现啦🎉') + url = 'https://api.jiudingliliang.com/user/transfer' + data = {'amount':lessmoney, 'type':'alipay'} + r = requests.post(url,json=data,headers=self.h).json() + logging.info(r) + if r['code'] == 10000: + logging.info(f'提现成功[{r}]') + kl = r["result"]["alipay_kl"] + send(f"叮叮提现成功通知📢",f'当前账号[{name}]余额[{m}],提现成功🎉,支付宝口令:\n{kl}\n请速度兑换') + data = { + "appToken":appToken, + "content":f'叮叮联盟提现成功,口令[{kl}]', + "summary":f'叮叮联盟提现成功,口令[{kl}]', + "contentType":1, + "uids":[ + uid + ], + "verifyPayType":0 + } + r = requests.post('https://wxpusher.zjiecode.com/api/send/message',json=data).json() + if r['code'] == 1000: + logging.info('通知已发送') + else: + logging.error('通知发送失败') else: - logging.error('通知发送失败') + logging.error(f'提现失败[{r}]') else: - logging.error(f'提现失败[{r}]') + logging.info(f'余额不足,跳过提现') else: - logging.info(f'余额不足,跳过提现') - else: - logging.info(f'未设置wxpusher信息,跳过提现') + logging.info(f'未设置wxpusher信息,跳过提现') else: logging.error(f'获取用户信息失败[{r}]') - else: - logging.error(f'获取用户信息失败[{r}]') def main(self):