diff --git a/iMTShop.py b/iMTShop.py index 812b84c..2e3cb59 100644 --- a/iMTShop.py +++ b/iMTShop.py @@ -11,7 +11,7 @@ import json from notify import send from notify import sendEmail -# testssss微信公众号@爱上羊毛侠 二次开发 +# 微信公众号@爱上羊毛侠 二次开发 # 微信公众号@小白技术社首发 @@ -52,9 +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', "未知") + return '申购失败:' + response.json().get('message', "未知原因") @@ -308,7 +309,13 @@ if __name__ == '__main__': "小茅运:" + r + '\n' s += userName + '_' + mobile + "正常结束任务"+'\n \n' if "失败" in s: - sendEmail('茅台申购失败',s) + # 替换 申购失败:今天已申购 后再判断是否还有失败的文字 + replacedS = s.replace('申购失败:今天已申购', '-') + # 替换完今天已申购的文字后,如果还有失败的文字,说明才是真的失败 + if "失败" in replacedS: + sendEmail('茅台申购失败',s) + else: + sendEmail('茅台已申购',s) else : sendEmail('茅台申购成功',s) except Exception as e: