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):