From 091f1c7e7b19502561df224c80d3028cc74ad219 Mon Sep 17 00:00:00 2001 From: gaoyuan Date: Thu, 18 Jan 2024 15:37:02 +0800 Subject: [PATCH] 11 --- aaiMTShop.py => iMTShop.py | 19 ++++++++++++++----- aanotify.py => notify.py | 0 2 files changed, 14 insertions(+), 5 deletions(-) rename aaiMTShop.py => iMTShop.py (92%) rename aanotify.py => notify.py (100%) diff --git a/aaiMTShop.py b/iMTShop.py similarity index 92% rename from aaiMTShop.py rename to iMTShop.py index c07e3cb..a55d5cc 100644 --- a/aaiMTShop.py +++ b/iMTShop.py @@ -8,7 +8,8 @@ import base64 import json -from aanotify import send +from notify import send +from notify import sendEmail # 微信公众号@爱上羊毛侠 二次开发 @@ -24,7 +25,7 @@ mt_r = 'clips_OlU6TmFRag5rCXwbNAQ/Tz1SKlN8THcecBp/' # res_map = {'10213': '贵州茅台酒(癸卯兔年)', '2476': '贵州茅台酒(壬寅虎年)', '2478': '贵州茅台酒(珍品)', # '10214': '贵州茅台酒(癸卯兔年)x2'} # 下面定义的是申请哪几个,想申请全部的话把上面注释删掉,把下面的注释掉 -res_map = {'10941': '贵州茅台酒(甲辰龙年)', +res_map = {'10941': '贵州茅台酒(甲辰龙年)', '10942': '贵州茅台酒(甲辰龙年)x2'} @@ -51,8 +52,10 @@ def mt_add(itemId, shopId, sessionId, userId, token, Device_ID): response = requests.post('https://app.moutai519.com.cn/xhr/front/mall/reservation/add', headers=headers, json=json_data) code = response.json().get('code', 0) + sendEmail('申购结束code:' + str(code) + ' ' + response.json().get('message', "未知原因"), '申购结束code:' + str(code) + ' ' + response.json().get('message', "未知原因")) if code == 2000: return response.json().get('data', {}).get('successDesc', "未知") + sendEmail('申购失败:' + response.json().get('message', "未知原因"), '申购失败:' + response.json().get('message', "未知原因")) return '申购失败:' + response.json().get('message', "未知原因") @@ -258,6 +261,7 @@ def login(phone, vCode, Device_ID): if __name__ == '__main__': + sendEmail('茅台申购开始','茅台申购开始') mt_tokens = os.getenv("MTTokenD") mt_version = os.getenv("Mt_Version") if not mt_tokens: @@ -288,7 +292,7 @@ if __name__ == '__main__': s += "第"+str(userCount)+"个用户token失效,请重新登录"+'\n' continue s += "第"+str(userCount)+"个用户----------------"+userName + '_' + \ - mobile + "开始任务" + "----------------"+'\n' + mobile + "开始任务" + "----------------"+'\n' for itemCode in itemCodes: name = res_map.get(str(itemCode)) if name: @@ -297,12 +301,17 @@ if __name__ == '__main__': res = mt_add(itemCode, str(shop_id), sessionId, user_id, token, device_id) s += itemCode + \ - '_' + name + '---------------' + res + '\n' + '_' + name + '---------------' + res + '\n' if not ck: r = getUserEnergyAward(device_id, ck) s += userName + '_' + mobile + '---------------' + \ - "小茅运:" + r + '\n' + "小茅运:" + r + '\n' s += userName + '_' + mobile + "正常结束任务"+'\n \n' + if "失败" in s: + sendEmail('茅台申购失败',s) + else : + sendEmail('茅台申购成功',s) except Exception as e: s += userName + '_' + mobile + "异常信息"+e + sendEmail('茅台申购异常结束',s) send("i茅台申购+小茅运", s) diff --git a/aanotify.py b/notify.py similarity index 100% rename from aanotify.py rename to notify.py