gaoyuan 8 months ago
parent d0e3f8609f
commit 091f1c7e7b

@ -8,7 +8,8 @@ import base64
import json 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': '贵州茅台酒(珍品)', # res_map = {'10213': '贵州茅台酒(癸卯兔年)', '2476': '贵州茅台酒(壬寅虎年)', '2478': '贵州茅台酒(珍品)',
# '10214': '贵州茅台酒癸卯兔年x2'} # '10214': '贵州茅台酒癸卯兔年x2'}
# 下面定义的是申请哪几个,想申请全部的话把上面注释删掉,把下面的注释掉 # 下面定义的是申请哪几个,想申请全部的话把上面注释删掉,把下面的注释掉
res_map = {'10941': '贵州茅台酒(甲辰龙年)', res_map = {'10941': '贵州茅台酒(甲辰龙年)',
'10942': '贵州茅台酒甲辰龙年x2'} '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, response = requests.post('https://app.moutai519.com.cn/xhr/front/mall/reservation/add', headers=headers,
json=json_data) json=json_data)
code = response.json().get('code', 0) code = response.json().get('code', 0)
sendEmail('申购结束code:' + str(code) + ' ' + response.json().get('message', "未知原因"), '申购结束code:' + str(code) + ' ' + response.json().get('message', "未知原因"))
if code == 2000: if code == 2000:
return response.json().get('data', {}).get('successDesc', "未知") return response.json().get('data', {}).get('successDesc', "未知")
sendEmail('申购失败:' + response.json().get('message', "未知原因"), '申购失败:' + response.json().get('message', "未知原因"))
return '申购失败:' + response.json().get('message', "未知原因") return '申购失败:' + response.json().get('message', "未知原因")
@ -258,6 +261,7 @@ def login(phone, vCode, Device_ID):
if __name__ == '__main__': if __name__ == '__main__':
sendEmail('茅台申购开始','茅台申购开始')
mt_tokens = os.getenv("MTTokenD") mt_tokens = os.getenv("MTTokenD")
mt_version = os.getenv("Mt_Version") mt_version = os.getenv("Mt_Version")
if not mt_tokens: if not mt_tokens:
@ -288,7 +292,7 @@ if __name__ == '__main__':
s += ""+str(userCount)+"个用户token失效请重新登录"+'\n' s += ""+str(userCount)+"个用户token失效请重新登录"+'\n'
continue continue
s += ""+str(userCount)+"个用户----------------"+userName + '_' + \ s += ""+str(userCount)+"个用户----------------"+userName + '_' + \
mobile + "开始任务" + "----------------"+'\n' mobile + "开始任务" + "----------------"+'\n'
for itemCode in itemCodes: for itemCode in itemCodes:
name = res_map.get(str(itemCode)) name = res_map.get(str(itemCode))
if name: if name:
@ -297,12 +301,17 @@ if __name__ == '__main__':
res = mt_add(itemCode, str(shop_id), sessionId, res = mt_add(itemCode, str(shop_id), sessionId,
user_id, token, device_id) user_id, token, device_id)
s += itemCode + \ s += itemCode + \
'_' + name + '---------------' + res + '\n' '_' + name + '---------------' + res + '\n'
if not ck: if not ck:
r = getUserEnergyAward(device_id, ck) r = getUserEnergyAward(device_id, ck)
s += userName + '_' + mobile + '---------------' + \ s += userName + '_' + mobile + '---------------' + \
"小茅运:" + r + '\n' "小茅运:" + r + '\n'
s += userName + '_' + mobile + "正常结束任务"+'\n \n' s += userName + '_' + mobile + "正常结束任务"+'\n \n'
if "失败" in s:
sendEmail('茅台申购失败',s)
else :
sendEmail('茅台申购成功',s)
except Exception as e: except Exception as e:
s += userName + '_' + mobile + "异常信息"+e s += userName + '_' + mobile + "异常信息"+e
sendEmail('茅台申购异常结束',s)
send("i茅台申购+小茅运", s) send("i茅台申购+小茅运", s)
Loading…
Cancel
Save