From 4b746870720811030a5ca0191353bd7e80a2a82d Mon Sep 17 00:00:00 2001 From: chickliu Date: Tue, 19 Nov 2024 09:34:34 +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 | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/叮叮联盟_api.py b/叮叮联盟_api.py index 17a7777..c112ebe 100644 --- a/叮叮联盟_api.py +++ b/叮叮联盟_api.py @@ -538,46 +538,46 @@ class yuanshen: url = 'https://api.jiudingliliang.com/user/withdraw' r = requests.post(url,headers=self.h,json={}).json() - if r['code'] == 10000: + if r['code'] == 10000: lessmoney = r["result"]["transfer"][0]["m"] + # 检查是否可以提现并发送提醒 if m >= lessmoney: send("叮叮可提现通知📢", f'当前账号[{name}]余额[{m}],可以提现啦') - - if r['code'] == 10000: - if appToken and uid: - 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() - logging.info(r) - 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('通知已发送') - else: - logging.error('通知发送失败') + + # 检查是否有推送设置 + if appToken and uid: + 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('通知已发送') else: - logging.error(f'提现失败[{r}]') + logging.error('通知发送失败') else: - logging.info(f'余额不足,跳过提现') + logging.error(f'提现失败[{r}]') else: - logging.info(f'未设置wxpusher信息,跳过提现') + logging.info(f'余额不足,跳过提现') + else: + logging.info(f'未设置wxpusher信息,跳过提现') else: logging.error(f'获取用户信息失败[{r}]') + else: + logging.error(f'获取用户信息失败[{r}]') def main(self):