mirror of
https://github.com/linbailo/zyqinglong.git
synced 2026-01-11 18:50:43 +08:00
加入通知
This commit is contained in:
parent
6103d27332
commit
230b73e5cf
228
dddc.py
228
dddc.py
@ -20,38 +20,67 @@ import os
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
all_print_list = [] # 用于记录所有 myprint 输出的字符串
|
||||||
|
|
||||||
|
|
||||||
|
# 用于记录所有 print 输出的字符串,暂时实现 print 函数的sep和end
|
||||||
|
def myprint(*args, sep=' ', end='\n', **kwargs):
|
||||||
|
global all_print_list
|
||||||
|
output = ""
|
||||||
|
# 构建输出字符串
|
||||||
|
for index, arg in enumerate(args):
|
||||||
|
if index == len(args) - 1:
|
||||||
|
output += str(arg)
|
||||||
|
continue
|
||||||
|
output += str(arg) + sep
|
||||||
|
output = output + end
|
||||||
|
all_print_list.append(output)
|
||||||
|
# 调用内置的 print 函数打印字符串
|
||||||
|
print(*args, sep=sep, end=end, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
# 发送通知消息
|
||||||
|
def send_notification_message(title):
|
||||||
|
try:
|
||||||
|
from sendNotify import send
|
||||||
|
|
||||||
|
send(title, ''.join(all_print_list))
|
||||||
|
except Exception as e:
|
||||||
|
if e:
|
||||||
|
print('发送通知消息失败!')
|
||||||
|
|
||||||
|
|
||||||
#初始化
|
#初始化
|
||||||
print('============📣初始化📣============')
|
myprint('============📣初始化📣============')
|
||||||
#版本
|
#版本
|
||||||
banappversion = '1.1.1'
|
banappversion = '1.1.1'
|
||||||
try:
|
try:
|
||||||
m = requests.get('https://gitee.com/guadu6464/test/raw/master/banbeng.json').json()
|
m = requests.get('https://gitee.com/guadu6464/test/raw/master/banbeng.json').json()
|
||||||
if banappversion == m['didi']:
|
if banappversion == m['didi']:
|
||||||
print(f"无版本更新:{banappversion}")
|
myprint(f"无版本更新:{banappversion}")
|
||||||
else:
|
else:
|
||||||
print('📣📣📣📣📣📣📣📣📣📣📣📣📣')
|
myprint('📣📣📣📣📣📣📣📣📣📣📣📣📣')
|
||||||
print(f"📣📣📣最新版本:{m['didi']}📣📣📣📣")
|
myprint(f"📣📣📣最新版本:{m['didi']}📣📣📣📣")
|
||||||
print('📣📣📣请更新版本:📣📣📣📣📣📣')
|
myprint('📣📣📣请更新版本:📣📣📣📣📣📣')
|
||||||
print('📣https://raw.githubusercontent.com/linbailo/zyqinglong/main/dddc.py📣')
|
myprint('📣https://raw.githubusercontent.com/linbailo/zyqinglong/main/dddc.py📣')
|
||||||
print('📣📣📣📣📣📣📣📣📣📣📣📣📣')
|
myprint('📣📣📣📣📣📣📣📣📣📣📣📣📣')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('无法检查版本更新')
|
myprint('无法检查版本更新')
|
||||||
|
|
||||||
appversion = '6.6.20'
|
appversion = '6.6.20'
|
||||||
print(f'小程序版本:{appversion}')
|
myprint(f'小程序版本:{appversion}')
|
||||||
if 'didijw' in os.environ:
|
if 'didijw' in os.environ:
|
||||||
lng,lat = os.environ.get("didijw").split("&")
|
lng,lat = os.environ.get("didijw").split("&")
|
||||||
print('已经填写经纬度')
|
myprint('已经填写经纬度')
|
||||||
else:
|
else:
|
||||||
print('使用内置经纬度')
|
myprint('使用内置经纬度')
|
||||||
lat = '39.852399823026097' #纬度
|
lat = '39.852399823026097' #纬度
|
||||||
lng = '116.32055410011579' #经度
|
lng = '116.32055410011579' #经度
|
||||||
print(f'经纬度默认设置:{lat},{lng}')
|
myprint(f'经纬度默认设置:{lat},{lng}')
|
||||||
print('==================================')
|
myprint('==================================')
|
||||||
print(m['didigg'])
|
myprint(m['didigg'])
|
||||||
|
|
||||||
print('==================================')
|
myprint('==================================')
|
||||||
#设置api
|
#设置api
|
||||||
fuli ='https://ut.xiaojukeji.com/ut/welfare/api/action/dailySign'
|
fuli ='https://ut.xiaojukeji.com/ut/welfare/api/action/dailySign'
|
||||||
youhui = 'https://union.didi.cn/api/v1.0/reward/receive'
|
youhui = 'https://union.didi.cn/api/v1.0/reward/receive'
|
||||||
@ -85,43 +114,46 @@ yanquan8 = 'https://game.xiaojukeji.com/api/game/coaster/hall'
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main(uid,token):
|
def main(uid,token):
|
||||||
print(f'正在执行账号:{uid}')
|
myprint(f'正在执行账号:{uid}')
|
||||||
chaxun(uid,token)
|
chaxun(uid,token)
|
||||||
try:
|
try:
|
||||||
diyi(uid,token)
|
diyi(uid,token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
myprint(e)
|
||||||
guafen(uid,token)
|
guafen(uid,token)
|
||||||
|
|
||||||
|
|
||||||
def diyi(uid,token):
|
def diyi(uid,token):
|
||||||
print('--------领取优惠券--------')
|
myprint('--------领取优惠券--------')
|
||||||
yq(uid,token)
|
yq(uid,token)
|
||||||
#data = {"lang":"zh-CN","token":token,"access_key_id":9,"appversion":appversion,"channel":1100000009,"_ds":"","xpsid":"d04ccc4ce0c844e38c164ecc30711458","xpsid_root":"d04ccc4ce0c844e38c164ecc30711458","dsi":"877e066d7ce22ef07762fa42992227567393hvn1","source_id":"31806556232355840DT124787708487929856DT","product_type":"didi","city_id":33,"lng":"","lat":"","source_.from":"","env":{"dchn":"r2mda3z","newTicket":token,"latitude":"","longitude":"","model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1037","isHitButton":True,"isOpenWeb":False,"timeCost":19908,"cityId":"33","xAxes":"167.60003662109375","yAxes":"480.0857849121094"},"req_env":"wx","dunion_callback":""}
|
#data = {"lang":"zh-CN","token":token,"access_key_id":9,"appversion":appversion,"channel":1100000009,"_ds":"","xpsid":"d04ccc4ce0c844e38c164ecc30711458","xpsid_root":"d04ccc4ce0c844e38c164ecc30711458","dsi":"877e066d7ce22ef07762fa42992227567393hvn1","source_id":"31806556232355840DT124787708487929856DT","product_type":"didi","city_id":33,"lng":"","lat":"","source_.from":"","env":{"dchn":"r2mda3z","newTicket":token,"latitude":"","longitude":"","model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1037","isHitButton":True,"isOpenWeb":False,"timeCost":19908,"cityId":"33","xAxes":"167.60003662109375","yAxes":"480.0857849121094"},"req_env":"wx","dunion_callback":""}
|
||||||
data = {"xbiz":"240101","prod_key":"ut-dunion-wyc","xpsid":"6dc1173059e04e57ab5c51689827af8c","dchn":"Qm0wKR1","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"none.none.none.none","xpsid_root":"6dc1173059e04e57ab5c51689827af8c","xpsid_from":"","xpsid_share":"","env":{"dchn":"Qm0wKR1","newTicket":token,"cityId":"33","userAgent":"","fromChannel":"2","newAppid":"30012","openId":"","openIdType":"1","isHitButton":False,"isOpenWeb":True,"timeCost":4667},"req_env":"wx","dsi":"e674ac10376e717aeac76c7510243b76410u18sh","source_id":"4a871f6eb9e4ee5568f0","product_type":"didi","lng":"","lat":"","token":token,"uid":"","phone":"","city_id":33,"source_from":""}
|
data = {"xbiz":"240101","prod_key":"ut-dunion-wyc","xpsid":"6dc1173059e04e57ab5c51689827af8c","dchn":"Qm0wKR1","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"none.none.none.none","xpsid_root":"6dc1173059e04e57ab5c51689827af8c","xpsid_from":"","xpsid_share":"","env":{"dchn":"Qm0wKR1","newTicket":token,"cityId":"33","userAgent":"","fromChannel":"2","newAppid":"30012","openId":"","openIdType":"1","isHitButton":False,"isOpenWeb":True,"timeCost":4667},"req_env":"wx","dsi":"e674ac10376e717aeac76c7510243b76410u18sh","source_id":"4a871f6eb9e4ee5568f0","product_type":"didi","lng":"","lat":"","token":token,"uid":"","phone":"","city_id":33,"source_from":""}
|
||||||
tijiao = requests.post(url=youhui, json=data).json()
|
tijiao = requests.post(url=youhui, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
for yh in tijiao['data']['rewards']:
|
for yh in tijiao['data']['rewards']:
|
||||||
print(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
myprint(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
try:
|
try:
|
||||||
didiyouc(uid,token)
|
didiyouc(uid,token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('小错误')
|
myprint('小错误')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
didiqc(uid,token)
|
didiqc(uid,token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('小错误')
|
myprint('小错误')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
yanquan(uid,token)
|
yanquan(uid,token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('小错误')
|
myprint('小错误')
|
||||||
|
|
||||||
print('--------福利中心签到------')
|
myprint('--------福利中心签到------')
|
||||||
data = {
|
data = {
|
||||||
'lang' : 'zh-CN',
|
'lang' : 'zh-CN',
|
||||||
'token' : token,
|
'token' : token,
|
||||||
@ -135,18 +167,18 @@ def diyi(uid,token):
|
|||||||
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30012\",\"fromChannel\":\"2\",\"wxScene\":1089,\"sceneId\":1089,\"openId\":\"\"}',
|
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30012\",\"fromChannel\":\"2\",\"wxScene\":1089,\"sceneId\":1089,\"openId\":\"\"}',
|
||||||
'dchn' : 'W0dzOxO'
|
'dchn' : 'W0dzOxO'
|
||||||
}
|
}
|
||||||
#print(data)
|
#myprint(data)
|
||||||
tijiao = requests.post(url=fuli, json=data).json()
|
tijiao = requests.post(url=fuli, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"签到成功:获得 {tijiao['data']['subsidy_state']['subsidy_amount']} 福利金")
|
myprint(f"签到成功:获得 {tijiao['data']['subsidy_state']['subsidy_amount']} 福利金")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fuliwei(uid,token)
|
fuliwei(uid,token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('小错误')
|
myprint('小错误')
|
||||||
print('--------天天领券签到------')
|
myprint('--------天天领券签到------')
|
||||||
headers = {'didi-ticket': token,'content-type':'application/json'}
|
headers = {'didi-ticket': token,'content-type':'application/json'}
|
||||||
data = {
|
data = {
|
||||||
'lang' : 'zh-CN',
|
'lang' : 'zh-CN',
|
||||||
@ -160,14 +192,14 @@ def diyi(uid,token):
|
|||||||
'city_id': 33,
|
'city_id': 33,
|
||||||
'env': {'isHitButton': True,'newAppid': 35009,'userAgent': '','openId': '','model': '2201122C','wifi': 2,'timeCost': 222318}
|
'env': {'isHitButton': True,'newAppid': 35009,'userAgent': '','openId': '','model': '2201122C','wifi': 2,'timeCost': 222318}
|
||||||
}
|
}
|
||||||
#print(data)
|
#myprint(data)
|
||||||
tijiao = requests.post(url=ttfuli, json=data, headers=headers).json()
|
tijiao = requests.post(url=ttfuli, json=data, headers=headers).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"获取id成功:{tijiao['data']['activity_id']},{tijiao['data']['instance_id']}")
|
myprint(f"获取id成功:{tijiao['data']['activity_id']},{tijiao['data']['instance_id']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
|
|
||||||
#print(tijiao)
|
#myprint(tijiao)
|
||||||
data = {
|
data = {
|
||||||
'lang' : 'zh-CN',
|
'lang' : 'zh-CN',
|
||||||
'token' : token,
|
'token' : token,
|
||||||
@ -182,15 +214,15 @@ def diyi(uid,token):
|
|||||||
'city_id': 33,
|
'city_id': 33,
|
||||||
'env': {'isHitButton': True,'newAppid': 35009,'userAgent': '','openId': '','model': '2201122C','wifi': 2}
|
'env': {'isHitButton': True,'newAppid': 35009,'userAgent': '','openId': '','model': '2201122C','wifi': 2}
|
||||||
}
|
}
|
||||||
#print(data)
|
#myprint(data)
|
||||||
tijiao = requests.post(url=ttfuli1, json=data, headers=headers).json()
|
tijiao = requests.post(url=ttfuli1, json=data, headers=headers).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"天天领券签到:{tijiao['errmsg']}")
|
myprint(f"天天领券签到:{tijiao['errmsg']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
|
|
||||||
#天天领券限时抢
|
#天天领券限时抢
|
||||||
print('----领点券使使----')
|
myprint('----领点券使使----')
|
||||||
data = {"lang":"zh-CN","access_key_id":9,"appversion":appversion,"channel":1100000002,"_ds":"","xpsid":"28a361bf9f2e456f9867be3cad4877e4","xpsid_root":"0fa1ac9f38d24e43a4a2616319942c88","root_xpsid":"0fa1ac9f38d24e43a4a2616319942c88","f_xpsid":"41345c97bc744b27a30c0dda8fbdfcba","xbiz":"240000","prod_key":"ut-coupon-center","dchn":"wE7poOA","xoid":"26243a0a-b1b9-44d3-b2ed-046016031b38","xenv":"wxmp","xpsid_from":"2e5ded46d7114ac4b0cf490619f5592d","xpsid_share":"","xspm_from":"ut-aggre-homepage.none.c460.none","xpos_from":{"pk":"ut-aggre-homepage"},"args":[{"dchn":"kkXgpzO","prod_key":"ut-limited-seckill","runtime_args":{"token":token,"lat":lat,"lng":lng,"env":{"dchn":"wE7poOA","newTicket":token,"model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1089","isHitButton":False,"isOpenWeb":False,"timeCost":70665,"latitude":lat,"longitude":lng,"cityId":"","fromPage":"ut-coupon-center/views/index/index","xAxes":"","yAxes":""},"content-type":"application/json","Didi-Ticket":token,"ptf":"mp","city_id":33,"platform":"mp","x_test_user":{"key":281475120025923}}},{"dchn":"gL3E8qZ","prod_key":"ut-support-coupon","runtime_args":{"token":token,"lat":lat,"lng":lng,"env":{"dchn":"wE7poOA","newTicket":token,"model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1089","isHitButton":False,"isOpenWeb":False,"timeCost":70666,"latitude":lat,"longitude":lng,"cityId":"","fromPage":"ut-coupon-center/views/index/index","xAxes":"","yAxes":""},"content-type":"application/json","Didi-Ticket":token,"ptf":"mp","city_id":33,"platform":"mp","x_test_user":{"key": 281475120025923}}}]}
|
data = {"lang":"zh-CN","access_key_id":9,"appversion":appversion,"channel":1100000002,"_ds":"","xpsid":"28a361bf9f2e456f9867be3cad4877e4","xpsid_root":"0fa1ac9f38d24e43a4a2616319942c88","root_xpsid":"0fa1ac9f38d24e43a4a2616319942c88","f_xpsid":"41345c97bc744b27a30c0dda8fbdfcba","xbiz":"240000","prod_key":"ut-coupon-center","dchn":"wE7poOA","xoid":"26243a0a-b1b9-44d3-b2ed-046016031b38","xenv":"wxmp","xpsid_from":"2e5ded46d7114ac4b0cf490619f5592d","xpsid_share":"","xspm_from":"ut-aggre-homepage.none.c460.none","xpos_from":{"pk":"ut-aggre-homepage"},"args":[{"dchn":"kkXgpzO","prod_key":"ut-limited-seckill","runtime_args":{"token":token,"lat":lat,"lng":lng,"env":{"dchn":"wE7poOA","newTicket":token,"model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1089","isHitButton":False,"isOpenWeb":False,"timeCost":70665,"latitude":lat,"longitude":lng,"cityId":"","fromPage":"ut-coupon-center/views/index/index","xAxes":"","yAxes":""},"content-type":"application/json","Didi-Ticket":token,"ptf":"mp","city_id":33,"platform":"mp","x_test_user":{"key":281475120025923}}},{"dchn":"gL3E8qZ","prod_key":"ut-support-coupon","runtime_args":{"token":token,"lat":lat,"lng":lng,"env":{"dchn":"wE7poOA","newTicket":token,"model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1089","isHitButton":False,"isOpenWeb":False,"timeCost":70666,"latitude":lat,"longitude":lng,"cityId":"","fromPage":"ut-coupon-center/views/index/index","xAxes":"","yAxes":""},"content-type":"application/json","Didi-Ticket":token,"ptf":"mp","city_id":33,"platform":"mp","x_test_user":{"key": 281475120025923}}}]}
|
||||||
tijiao = requests.post(url="https://api.didi.cn/webx/chapter/page/batch/config", json=data, headers=headers).json()
|
tijiao = requests.post(url="https://api.didi.cn/webx/chapter/page/batch/config", json=data, headers=headers).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
@ -202,12 +234,12 @@ def diyi(uid,token):
|
|||||||
coupon_conf_id = xu['coupon_conf_id']
|
coupon_conf_id = xu['coupon_conf_id']
|
||||||
data = {"lang":"zh-CN","token":token,"access_key_id":9,"appversion":appversion,"channel":1100000002,"_ds":"","xpsid":"d51af08a62ef4b43b1eb41deaae30379","xpsid_root":"0fa1ac9f38d24e43a4a2616319942c88","activity_id":activity_id,"group_id":group_id,"group_date":group_date,"coupon_conf_id":coupon_conf_id,"dchn":"wE7poOA","platform":"mp","city_id":33,"env":{"isHitButton":True,"newAppid":35009,"userAgent":"","openId":"","model":"2201122C","wifi":2,"timeCost":""}}
|
data = {"lang":"zh-CN","token":token,"access_key_id":9,"appversion":appversion,"channel":1100000002,"_ds":"","xpsid":"d51af08a62ef4b43b1eb41deaae30379","xpsid_root":"0fa1ac9f38d24e43a4a2616319942c88","activity_id":activity_id,"group_id":group_id,"group_date":group_date,"coupon_conf_id":coupon_conf_id,"dchn":"wE7poOA","platform":"mp","city_id":33,"env":{"isHitButton":True,"newAppid":35009,"userAgent":"","openId":"","model":"2201122C","wifi":2,"timeCost":""}}
|
||||||
ju = requests.post(url="https://ut.xiaojukeji.com/ut/janitor/api/action/coupon/bind", json=data, headers=headers).json()
|
ju = requests.post(url="https://ut.xiaojukeji.com/ut/janitor/api/action/coupon/bind", json=data, headers=headers).json()
|
||||||
print(f"{xu['name']}({xu['threshold_desc']}):{ju['errmsg']}")
|
myprint(f"{xu['name']}({xu['threshold_desc']}):{ju['errmsg']}")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print('------------------')
|
myprint('------------------')
|
||||||
|
|
||||||
def guafen(uid,token):
|
def guafen(uid,token):
|
||||||
print('--------瓜瓜乐打卡--------')
|
myprint('--------瓜瓜乐打卡--------')
|
||||||
headers = {'didi-ticket': token,'content-type':'application/json'}
|
headers = {'didi-ticket': token,'content-type':'application/json'}
|
||||||
"""
|
"""
|
||||||
#没用的
|
#没用的
|
||||||
@ -241,12 +273,12 @@ def guafen(uid,token):
|
|||||||
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30012\",\"fromChannel\":\"2\",\"wxScene\":1089,\"sceneId\":1089,\"openId\":\"\"}'
|
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30012\",\"fromChannel\":\"2\",\"wxScene\":1089,\"sceneId\":1089,\"openId\":\"\"}'
|
||||||
}
|
}
|
||||||
shuju = requests.post(url=guafen1, json=data).json()
|
shuju = requests.post(url=guafen1, json=data).json()
|
||||||
#print(shuju)
|
#myprint(shuju)
|
||||||
rqi = list(shuju['data']['divide_data']['divide'])
|
rqi = list(shuju['data']['divide_data']['divide'])
|
||||||
zs = len(rqi) - 1
|
zs = len(rqi) - 1
|
||||||
activity_id = shuju['data']['divide_data']['divide'][rqi[zs]]['activity_id']
|
activity_id = shuju['data']['divide_data']['divide'][rqi[zs]]['activity_id']
|
||||||
task_id = shuju['data']['divide_data']['divide'][rqi[zs]]['task_id']
|
task_id = shuju['data']['divide_data']['divide'][rqi[zs]]['task_id']
|
||||||
print(f'获取到日期数据:{rqi}\n需要的日期:{rqi[zs]}\n报名瓜分activity_id数据:{activity_id}')
|
myprint(f'获取到日期数据:{rqi}\n需要的日期:{rqi[zs]}\n报名瓜分activity_id数据:{activity_id}')
|
||||||
#报名瓜分
|
#报名瓜分
|
||||||
data = {
|
data = {
|
||||||
'lang' : 'zh-CN',
|
'lang' : 'zh-CN',
|
||||||
@ -265,14 +297,14 @@ def guafen(uid,token):
|
|||||||
}
|
}
|
||||||
tijiao = requests.post(url=guafen2, json=data).json()
|
tijiao = requests.post(url=guafen2, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"报名瓜分:{tijiao['errmsg']}")
|
myprint(f"报名瓜分:{tijiao['errmsg']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
#参加瓜分
|
#参加瓜分
|
||||||
|
|
||||||
activity_id = shuju['data']['divide_data']['divide'][rqi[0]]['activity_id']
|
activity_id = shuju['data']['divide_data']['divide'][rqi[0]]['activity_id']
|
||||||
task_id = shuju['data']['divide_data']['divide'][rqi[0]]['task_id']
|
task_id = shuju['data']['divide_data']['divide'][rqi[0]]['task_id']
|
||||||
print(f'获取到日期数据:{rqi}\n需要的日期:{rqi[0]}\n参加瓜分activity_id数据:{activity_id}')
|
myprint(f'获取到日期数据:{rqi}\n需要的日期:{rqi[0]}\n参加瓜分activity_id数据:{activity_id}')
|
||||||
data = {
|
data = {
|
||||||
'lang' : 'zh-CN',
|
'lang' : 'zh-CN',
|
||||||
'token' : token,
|
'token' : token,
|
||||||
@ -289,10 +321,10 @@ def guafen(uid,token):
|
|||||||
}
|
}
|
||||||
tijiao = requests.post(url='https://ut.xiaojukeji.com/ut/welfare/api/action/divideReward', json=data).json()
|
tijiao = requests.post(url='https://ut.xiaojukeji.com/ut/welfare/api/action/divideReward', json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"参加瓜分:{tijiao['errmsg']}")
|
myprint(f"参加瓜分:{tijiao['errmsg']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
#print(tijiao)
|
#myprint(tijiao)
|
||||||
#获取数据
|
#获取数据
|
||||||
data = {
|
data = {
|
||||||
'lang' : 'zh-CN',
|
'lang' : 'zh-CN',
|
||||||
@ -307,32 +339,32 @@ def guafen(uid,token):
|
|||||||
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30012\",\"fromChannel\":\"2\",\"wxScene\":1089,\"sceneId\":1089,\"openId\":\"\"}'
|
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30012\",\"fromChannel\":\"2\",\"wxScene\":1089,\"sceneId\":1089,\"openId\":\"\"}'
|
||||||
}
|
}
|
||||||
shuju = requests.post(url=guafen1, json=data).json()
|
shuju = requests.post(url=guafen1, json=data).json()
|
||||||
#print(shuju)
|
#myprint(shuju)
|
||||||
print('------')
|
myprint('------')
|
||||||
if '14点自动开奖' == shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']:
|
if '14点自动开奖' == shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']:
|
||||||
print(f"参加今日瓜分状态:成功-{shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']}")
|
myprint(f"参加今日瓜分状态:成功-{shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']}")
|
||||||
elif '发奖了' == shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']:
|
elif '发奖了' == shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']:
|
||||||
print(f"参加今日瓜分状态:成功-{shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']}")
|
myprint(f"参加今日瓜分状态:成功-{shuju['data']['divide_data']['divide'][rqi[0]]['button']['text']}")
|
||||||
else:
|
else:
|
||||||
print(f"参加今日瓜分状态:失败")
|
myprint(f"参加今日瓜分状态:失败")
|
||||||
|
|
||||||
if '明天14点前访问' == shuju['data']['divide_data']['divide'][rqi[zs]]['button']['text']:
|
if '明天14点前访问' == shuju['data']['divide_data']['divide'][rqi[zs]]['button']['text']:
|
||||||
print(f"参加今日瓜分状态:成功-{shuju['data']['divide_data']['divide'][rqi[zs]]['button']['text']}")
|
myprint(f"参加今日瓜分状态:成功-{shuju['data']['divide_data']['divide'][rqi[zs]]['button']['text']}")
|
||||||
else:
|
else:
|
||||||
print(f"参加明日瓜分状态:失败")
|
myprint(f"参加明日瓜分状态:失败")
|
||||||
print('------')
|
myprint('------')
|
||||||
|
|
||||||
|
|
||||||
def chaxun(uid,token):
|
def chaxun(uid,token):
|
||||||
print('--------福利金查询--------')
|
myprint('--------福利金查询--------')
|
||||||
cx = requests.get(url=f'https://rewards.xiaojukeji.com/loyalty_credit/bonus/getWelfareUsage4Wallet?token={token}&city_id=0').json()
|
cx = requests.get(url=f'https://rewards.xiaojukeji.com/loyalty_credit/bonus/getWelfareUsage4Wallet?token={token}&city_id=0').json()
|
||||||
if '成功' == cx['errmsg']:
|
if '成功' == cx['errmsg']:
|
||||||
print(f"账号{uid}现在有福利金:{cx['data']['worth']}(可抵扣{cx['data']['worth']/100}元)\n{cx['data']['recent_expire_time']}过期福利金:{cx['data']['recent_expire_amount']}")
|
myprint(f"账号{uid}现在有福利金:{cx['data']['worth']}(可抵扣{cx['data']['worth']/100}元)\n{cx['data']['recent_expire_time']}过期福利金:{cx['data']['recent_expire_amount']}")
|
||||||
else:
|
else:
|
||||||
print('查询失败')
|
myprint('查询失败')
|
||||||
|
|
||||||
def fuliwei(uid,token):
|
def fuliwei(uid,token):
|
||||||
print('--------福利中心未领取查询------')
|
myprint('--------福利中心未领取查询------')
|
||||||
data = {
|
data = {
|
||||||
'xbiz' : 240000,
|
'xbiz' : 240000,
|
||||||
'prod_key': 'welfare-center',
|
'prod_key': 'welfare-center',
|
||||||
@ -350,11 +382,11 @@ def fuliwei(uid,token):
|
|||||||
'platform' : 'na',
|
'platform' : 'na',
|
||||||
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30004\",\"fromChannel\":\"1\",\"deviceId\":\"\",\"ddfp\":\"\",\"appVersion\":\"6.7.4\",\"userAgent\":\"Mozilla/5.0 (Linux; Android 14; 2201122C Build/UKQ1.230804.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.0.0 Mobile Safari/537.36 didi.passenger/6.7.4 FusionKit/2.0.0 OffMode/0\"}'
|
'env' : r'{\"cityId\":\"33\",\"token\":\"\",\"longitude\":\"\",\"latitude\":\"\",\"appid\":\"30004\",\"fromChannel\":\"1\",\"deviceId\":\"\",\"ddfp\":\"\",\"appVersion\":\"6.7.4\",\"userAgent\":\"Mozilla/5.0 (Linux; Android 14; 2201122C Build/UKQ1.230804.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.0.0 Mobile Safari/537.36 didi.passenger/6.7.4 FusionKit/2.0.0 OffMode/0\"}'
|
||||||
}
|
}
|
||||||
#print(data)
|
#myprint(data)
|
||||||
tijiao = requests.post(url=fulijingchax, json=data).json()
|
tijiao = requests.post(url=fulijingchax, json=data).json()
|
||||||
print(f"存在{len(tijiao['data']['bubble_list'])}个未领取")
|
myprint(f"存在{len(tijiao['data']['bubble_list'])}个未领取")
|
||||||
if len(tijiao['data']['bubble_list']) > 0:
|
if len(tijiao['data']['bubble_list']) > 0:
|
||||||
print('进行领取')
|
myprint('进行领取')
|
||||||
for lin in tijiao['data']['bubble_list']:
|
for lin in tijiao['data']['bubble_list']:
|
||||||
data = {
|
data = {
|
||||||
'xbiz' : 240000,
|
'xbiz' : 240000,
|
||||||
@ -375,39 +407,39 @@ def fuliwei(uid,token):
|
|||||||
'bubble_type' : 'yangliu_sign'}
|
'bubble_type' : 'yangliu_sign'}
|
||||||
tijiao1 = requests.post(url=liqu, json=data).json()
|
tijiao1 = requests.post(url=liqu, json=data).json()
|
||||||
if tijiao1['errmsg'] == 'success':
|
if tijiao1['errmsg'] == 'success':
|
||||||
print(f"领取{tijiao1['errmsg']}")
|
myprint(f"领取{tijiao1['errmsg']}")
|
||||||
else:
|
else:
|
||||||
print('领取失败')
|
myprint('领取失败')
|
||||||
|
|
||||||
|
|
||||||
def didiyouc(uid,token):
|
def didiyouc(uid,token):
|
||||||
print('--------领取代驾、洗车优惠券--------')
|
myprint('--------领取代驾、洗车优惠券--------')
|
||||||
data = {"lang":"zh-CN","token":token,"access_key_id":9,"appversion":appversion,"channel":1100000009,"_ds":"","xpsid":"d590d5aec0884e1e8b56ee04b1b3122e","xpsid_root":"d590d5aec0884e1e8b56ee04b1b3122e","dsi":"80dda490be5cfc6506bf4cbf7b01aa36410odlfg","source_id":"b08d62bd22133278c810","product_type":"didi","dchn":"DZdQqlE","city_id":33,"lng":lng,"lat":lat,"env":{"dchn":"DZdQqlE","newTicket":token,"latitude":lat,"longitude":lng,"model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1037","isHitButton":True,"isOpenWeb":False,"timeCost":6851,"cityId":"33","xAxes":"275.02850341796875","yAxes":"387.0284729003906"},"req_env":"wx","dunion_callback":""}
|
data = {"lang":"zh-CN","token":token,"access_key_id":9,"appversion":appversion,"channel":1100000009,"_ds":"","xpsid":"d590d5aec0884e1e8b56ee04b1b3122e","xpsid_root":"d590d5aec0884e1e8b56ee04b1b3122e","dsi":"80dda490be5cfc6506bf4cbf7b01aa36410odlfg","source_id":"b08d62bd22133278c810","product_type":"didi","dchn":"DZdQqlE","city_id":33,"lng":lng,"lat":lat,"env":{"dchn":"DZdQqlE","newTicket":token,"latitude":lat,"longitude":lng,"model":"2201122C","fromChannel":"2","newAppid":"35009","openId":"","openIdType":"1","sceneId":"1037","isHitButton":True,"isOpenWeb":False,"timeCost":6851,"cityId":"33","xAxes":"275.02850341796875","yAxes":"387.0284729003906"},"req_env":"wx","dunion_callback":""}
|
||||||
tijiao = requests.post(url=youhui, json=data).json()
|
tijiao = requests.post(url=youhui, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
for yh in tijiao['data']['rewards']:
|
for yh in tijiao['data']['rewards']:
|
||||||
print(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
myprint(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
print('--------------')
|
myprint('--------------')
|
||||||
data = {"xbiz":"240101","prod_key":"ut-dunion-dj","xpsid":"8c6b4325867d42198a2fe78c5b037475","dchn":"aqj1Xk5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"none.none.none.none","xpsid_root":"8c6b4325867d42198a2fe78c5b037475","xpsid_from":"","xpsid_share":"","dsi":"622554f9d87e57040413526a116ac629410nk8lu","source_id":"b08d62bd22133278c810","product_type":"didi","token":token,"city_id":33,"env":{"dchn":"aqj1Xk5","newTicket":token,"userAgent":"","fromChannel":"2","newAppid":"30012","openId":"","openIdType":"1","isHitButton":True,"isOpenWeb":True,"timeCost":13722,"cityId":"33","xAxes":"260.6571044921875","yAxes":"455.3142395019531"},"req_env":"wx","dunion_callback":""}
|
data = {"xbiz":"240101","prod_key":"ut-dunion-dj","xpsid":"8c6b4325867d42198a2fe78c5b037475","dchn":"aqj1Xk5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"none.none.none.none","xpsid_root":"8c6b4325867d42198a2fe78c5b037475","xpsid_from":"","xpsid_share":"","dsi":"622554f9d87e57040413526a116ac629410nk8lu","source_id":"b08d62bd22133278c810","product_type":"didi","token":token,"city_id":33,"env":{"dchn":"aqj1Xk5","newTicket":token,"userAgent":"","fromChannel":"2","newAppid":"30012","openId":"","openIdType":"1","isHitButton":True,"isOpenWeb":True,"timeCost":13722,"cityId":"33","xAxes":"260.6571044921875","yAxes":"455.3142395019531"},"req_env":"wx","dunion_callback":""}
|
||||||
tijiao = requests.post(url=youhui, json=data).json()
|
tijiao = requests.post(url=youhui, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
for yh in tijiao['data']['rewards']:
|
for yh in tijiao['data']['rewards']:
|
||||||
print(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
myprint(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
|
|
||||||
|
|
||||||
def didiqc(uid,token):
|
def didiqc(uid,token):
|
||||||
print('--------滴滴打车新城活动--------')
|
myprint('--------滴滴打车新城活动--------')
|
||||||
data = {"xbiz":"240101","prod_key":"ut-dunion-wyc","xpsid":"d0765ac98e624e28920d626e87a26fc6","dchn":"o2vw2nM","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"none.none.none.none","xpsid_root":"d0765ac98e624e28920d626e87a26fc6","xpsid_from":"","xpsid_share":"","env":{"dchn":"o2vw2nM","newTicket":token,"latitude":lat,"longitude":lng,"userAgent":"","fromChannel":"2","newAppid":"30012","openId":"","openIdType":"1","isHitButton":False,"isOpenWeb":True,"timeCost":7047},"req_env":"wx","dsi":"a4ce24f7e82060f61cb3ea252e2a35e8919kd2r2","source_id":"b08d62bd22133278c810","product_type":"didi","lng":lng,"lat":lat,"token":token,"uid":"","phone":""}
|
data = {"xbiz":"240101","prod_key":"ut-dunion-wyc","xpsid":"d0765ac98e624e28920d626e87a26fc6","dchn":"o2vw2nM","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"none.none.none.none","xpsid_root":"d0765ac98e624e28920d626e87a26fc6","xpsid_from":"","xpsid_share":"","env":{"dchn":"o2vw2nM","newTicket":token,"latitude":lat,"longitude":lng,"userAgent":"","fromChannel":"2","newAppid":"30012","openId":"","openIdType":"1","isHitButton":False,"isOpenWeb":True,"timeCost":7047},"req_env":"wx","dsi":"a4ce24f7e82060f61cb3ea252e2a35e8919kd2r2","source_id":"b08d62bd22133278c810","product_type":"didi","lng":lng,"lat":lat,"token":token,"uid":"","phone":""}
|
||||||
tijiao = requests.post(url=youhui, json=data).json()
|
tijiao = requests.post(url=youhui, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
for yh in tijiao['data']['rewards']:
|
for yh in tijiao['data']['rewards']:
|
||||||
print(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
myprint(f"获取到{yh['coupon']['max_benefit_capacity']['value']}{yh['coupon']['max_benefit_capacity']['unit']} {yh['coupon']['name']} {yh['coupon']['remark']}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
|
|
||||||
def yq(uid,token):
|
def yq(uid,token):
|
||||||
headers = {'content-type':'application/json'}
|
headers = {'content-type':'application/json'}
|
||||||
@ -419,16 +451,16 @@ def yq(uid,token):
|
|||||||
|
|
||||||
#养券大师
|
#养券大师
|
||||||
def yanquan(uid,token):
|
def yanquan(uid,token):
|
||||||
print('--------养券大师--------')
|
myprint('--------养券大师--------')
|
||||||
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"9996f669b85446069201ba6f066ac757","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"660616ee6da44f2a83c6bad2b2e08f50","xpsid_from":"c4f1e647068a4f5d86c62f7327780548","xpsid_share":"","platform":1,"token":token}
|
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"9996f669b85446069201ba6f066ac757","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"660616ee6da44f2a83c6bad2b2e08f50","xpsid_from":"c4f1e647068a4f5d86c62f7327780548","xpsid_share":"","platform":1,"token":token}
|
||||||
tijiao = requests.post(url=yanquan1, json=data).json()
|
tijiao = requests.post(url=yanquan1, json=data).json()
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"9996f669b85446069201ba6f066ac757","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"660616ee6da44f2a83c6bad2b2e08f50","xpsid_from":"c4f1e647068a4f5d86c62f7327780548","xpsid_share":"","platform":1,"token":token}
|
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"9996f669b85446069201ba6f066ac757","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"660616ee6da44f2a83c6bad2b2e08f50","xpsid_from":"c4f1e647068a4f5d86c62f7327780548","xpsid_share":"","platform":1,"token":token}
|
||||||
tijiao = requests.post(url=yanquan2, json=data).json()
|
tijiao = requests.post(url=yanquan2, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"{tijiao['data']['rewards'][0]}")
|
myprint(f"{tijiao['data']['rewards'][0]}")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
tijiao = requests.get(url=f'{yanquan3}{token}').json()
|
tijiao = requests.get(url=f'{yanquan3}{token}').json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
for rw in tijiao['data']['missions']:
|
for rw in tijiao['data']['missions']:
|
||||||
@ -436,57 +468,61 @@ def yanquan(uid,token):
|
|||||||
zuorw = requests.post(url=yanquan4, json=data).json()
|
zuorw = requests.post(url=yanquan4, json=data).json()
|
||||||
linrw = requests.post(url=yanquan5, json=data).json()
|
linrw = requests.post(url=yanquan5, json=data).json()
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
try:
|
try:
|
||||||
yanquancj(uid,token)
|
yanquancj(uid,token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('--------抽奖结束--------')
|
myprint('--------抽奖结束--------')
|
||||||
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"23f60c5c42c2454cafc8edbb09f6c8ac","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"4def26a78cd6460aab0d7268501c1ab8","xpsid_from":"e276b0683755450e851dbdc59e6ea927","xpsid_share":"","platform":1,"token":token}
|
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"23f60c5c42c2454cafc8edbb09f6c8ac","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"4def26a78cd6460aab0d7268501c1ab8","xpsid_from":"e276b0683755450e851dbdc59e6ea927","xpsid_share":"","platform":1,"token":token}
|
||||||
tijiao = requests.post(url=yanquan7, json=data).json()
|
tijiao = requests.post(url=yanquan7, json=data).json()
|
||||||
print(f"升级:{tijiao['errmsg']}")
|
myprint(f"升级:{tijiao['errmsg']}")
|
||||||
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"5179b7a9bd884fe18a6988a1b176321e","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"3d3b3b2ddf2f45c9ad3805805c5359f4","xpsid_from":"988f69329773413c98f3cae569a95483","xpsid_share":"","token":token,"platform":1}
|
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"5179b7a9bd884fe18a6988a1b176321e","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"3d3b3b2ddf2f45c9ad3805805c5359f4","xpsid_from":"988f69329773413c98f3cae569a95483","xpsid_share":"","token":token,"platform":1}
|
||||||
tijiao = requests.post(url=yanquan8, json=data).json()
|
tijiao = requests.post(url=yanquan8, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"金币:{tijiao['data']['coin']}")
|
myprint(f"金币:{tijiao['data']['coin']}")
|
||||||
print(f"优惠券:满{tijiao['data']['coupon']['available']/100}抵扣{tijiao['data']['coupon']['amount']/100}元")
|
myprint(f"优惠券:满{tijiao['data']['coupon']['available']/100}抵扣{tijiao['data']['coupon']['amount']/100}元")
|
||||||
else:
|
else:
|
||||||
print(tijiao['errmsg'])
|
myprint(tijiao['errmsg'])
|
||||||
|
|
||||||
#养券大师
|
#养券大师
|
||||||
def yanquancj(uid,token):
|
def yanquancj(uid,token):
|
||||||
print('--------养券大师抽奖--------')
|
myprint('--------养券大师抽奖--------')
|
||||||
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"9996f669b85446069201ba6f066ac757","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"660616ee6da44f2a83c6bad2b2e08f50","xpsid_from":"c4f1e647068a4f5d86c62f7327780548","xpsid_share":"","platform":1,"token":token}
|
data = {"xbiz":"240301","prod_key":"ut-coupon-master","xpsid":"9996f669b85446069201ba6f066ac757","dchn":"BnGadK5","xoid":"c5f5aeb5-19a4-4e60-9305-d45c37e48a27","xenv":"wxmp","xspm_from":"welfare-center.none.c1324.none","xpsid_root":"660616ee6da44f2a83c6bad2b2e08f50","xpsid_from":"c4f1e647068a4f5d86c62f7327780548","xpsid_share":"","platform":1,"token":token}
|
||||||
tijiao = requests.post(url=yanquan6, json=data).json()
|
tijiao = requests.post(url=yanquan6, json=data).json()
|
||||||
if tijiao['errmsg'] == 'success':
|
if tijiao['errmsg'] == 'success':
|
||||||
print(f"存在抽奖次数:{tijiao['data']['power']}")
|
myprint(f"存在抽奖次数:{tijiao['data']['power']}")
|
||||||
for x in range(tijiao['data']['power']):
|
for x in range(tijiao['data']['power']):
|
||||||
xx = x + 1
|
xx = x + 1
|
||||||
print(f"正在执行第{xx}次抽奖")
|
myprint(f"正在执行第{xx}次抽奖")
|
||||||
time.sleep(2)
|
time.sleep(3)
|
||||||
tijiao1 = requests.post(url=yanquan6, json=data).json()
|
tijiao1 = requests.post(url=yanquan6, json=data).json()
|
||||||
print('--------抽奖结束--------')
|
myprint('--------抽奖结束--------')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
uid = 1
|
uid = 1
|
||||||
token = ""
|
token = ""
|
||||||
if 'ddgyToken' in os.environ:
|
if 'ddgyToken' in os.environ:
|
||||||
fen = os.environ.get("ddgyToken").split("@")
|
fen = os.environ.get("ddgyToken").split("@")
|
||||||
print(f'查找到{len(fen)}个账号')
|
myprint(f'查找到{len(fen)}个账号')
|
||||||
print('==================================')
|
myprint('==================================')
|
||||||
for duo in fen:
|
for duo in fen:
|
||||||
uid,token = duo.split("&")
|
uid,token = duo.split("&")
|
||||||
try:
|
try:
|
||||||
main(uid,token)
|
main(uid,token)
|
||||||
print('============📣结束📣============')
|
myprint('============📣结束📣============')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('小错误')
|
myprint('小错误')
|
||||||
else:
|
else:
|
||||||
print('不存在青龙变量,本地运行')
|
myprint('不存在青龙变量,本地运行')
|
||||||
if uid == '' or token == '':
|
if uid == '' or token == '':
|
||||||
print('本地账号密码为空')
|
myprint('本地账号密码为空')
|
||||||
exit()
|
exit()
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
main(uid,token)
|
main(uid,token)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('小错误')
|
myprint('小错误')
|
||||||
|
try:
|
||||||
|
send_notification_message(title='滴滴出行') # 发送通知
|
||||||
|
except Exception as e:
|
||||||
|
print('小错误')
|
||||||
464
sendNotify.py
Normal file
464
sendNotify.py
Normal file
@ -0,0 +1,464 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# _*_ coding:utf-8 _*_
|
||||||
|
|
||||||
|
#Modify: Kirin
|
||||||
|
|
||||||
|
from curses.ascii import FS
|
||||||
|
import sys
|
||||||
|
import os, re
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
import hmac
|
||||||
|
import hashlib
|
||||||
|
import base64
|
||||||
|
import urllib.parse
|
||||||
|
from requests.adapters import HTTPAdapter
|
||||||
|
from urllib3.util import Retry
|
||||||
|
|
||||||
|
cur_path = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
root_path = os.path.split(cur_path)[0]
|
||||||
|
sys.path.append(root_path)
|
||||||
|
|
||||||
|
# 通知服务
|
||||||
|
BARK = '' # bark服务,自行搜索; secrets可填;
|
||||||
|
BARK_PUSH='' # bark自建服务器,要填完整链接,结尾的/不要
|
||||||
|
PUSH_KEY = '' # Server酱的PUSH_KEY; secrets可填
|
||||||
|
TG_BOT_TOKEN = '' # tg机器人的TG_BOT_TOKEN; secrets可填1407203283:AAG9rt-6RDaaX0HBLZQq0laNOh898iFYaRQ
|
||||||
|
TG_USER_ID = '' # tg机器人的TG_USER_ID; secrets可填 1434078534
|
||||||
|
TG_API_HOST='' # tg 代理api
|
||||||
|
TG_PROXY_IP = '' # tg机器人的TG_PROXY_IP; secrets可填
|
||||||
|
TG_PROXY_PORT = '' # tg机器人的TG_PROXY_PORT; secrets可填
|
||||||
|
DD_BOT_TOKEN = '' # 钉钉机器人的DD_BOT_TOKEN; secrets可填
|
||||||
|
DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填
|
||||||
|
QQ_SKEY = '' # qq机器人的QQ_SKEY; secrets可填
|
||||||
|
QQ_MODE = '' # qq机器人的QQ_MODE; secrets可填
|
||||||
|
QYWX_AM = '' # 企业微信
|
||||||
|
QYWX_KEY = '' # 企业微信BOT
|
||||||
|
PUSH_PLUS_TOKEN = '' # 微信推送Plus+
|
||||||
|
FS_KEY = '' #飞书群BOT
|
||||||
|
|
||||||
|
notify_mode = []
|
||||||
|
|
||||||
|
message_info = ''''''
|
||||||
|
|
||||||
|
# GitHub action运行需要填写对应的secrets
|
||||||
|
if "BARK" in os.environ and os.environ["BARK"]:
|
||||||
|
BARK = os.environ["BARK"]
|
||||||
|
if "BARK_PUSH" in os.environ and os.environ["BARK_PUSH"]:
|
||||||
|
BARK_PUSH = os.environ["BARK_PUSH"]
|
||||||
|
if "PUSH_KEY" in os.environ and os.environ["PUSH_KEY"]:
|
||||||
|
PUSH_KEY = os.environ["PUSH_KEY"]
|
||||||
|
if "TG_BOT_TOKEN" in os.environ and os.environ["TG_BOT_TOKEN"] and "TG_USER_ID" in os.environ and os.environ["TG_USER_ID"]:
|
||||||
|
TG_BOT_TOKEN = os.environ["TG_BOT_TOKEN"]
|
||||||
|
TG_USER_ID = os.environ["TG_USER_ID"]
|
||||||
|
if "TG_API_HOST" in os.environ and os.environ["TG_API_HOST"]:
|
||||||
|
TG_API_HOST = os.environ["TG_API_HOST"]
|
||||||
|
if "DD_BOT_TOKEN" in os.environ and os.environ["DD_BOT_TOKEN"] and "DD_BOT_SECRET" in os.environ and os.environ["DD_BOT_SECRET"]:
|
||||||
|
DD_BOT_TOKEN = os.environ["DD_BOT_TOKEN"]
|
||||||
|
DD_BOT_SECRET = os.environ["DD_BOT_SECRET"]
|
||||||
|
if "QQ_SKEY" in os.environ and os.environ["QQ_SKEY"] and "QQ_MODE" in os.environ and os.environ["QQ_MODE"]:
|
||||||
|
QQ_SKEY = os.environ["QQ_SKEY"]
|
||||||
|
QQ_MODE = os.environ["QQ_MODE"]
|
||||||
|
# 获取pushplus+ PUSH_PLUS_TOKEN
|
||||||
|
if "PUSH_PLUS_TOKEN" in os.environ:
|
||||||
|
if len(os.environ["PUSH_PLUS_TOKEN"]) > 1:
|
||||||
|
PUSH_PLUS_TOKEN = os.environ["PUSH_PLUS_TOKEN"]
|
||||||
|
# print("已获取并使用Env环境 PUSH_PLUS_TOKEN")
|
||||||
|
# 获取企业微信应用推送 QYWX_AM
|
||||||
|
if "QYWX_AM" in os.environ:
|
||||||
|
if len(os.environ["QYWX_AM"]) > 1:
|
||||||
|
QYWX_AM = os.environ["QYWX_AM"]
|
||||||
|
|
||||||
|
|
||||||
|
if "QYWX_KEY" in os.environ:
|
||||||
|
if len(os.environ["QYWX_KEY"]) > 1:
|
||||||
|
QYWX_KEY = os.environ["QYWX_KEY"]
|
||||||
|
# print("已获取并使用Env环境 QYWX_AM")
|
||||||
|
|
||||||
|
#接入飞书webhook推送
|
||||||
|
if "FS_KEY" in os.environ:
|
||||||
|
if len(os.environ["FS_KEY"]) > 1:
|
||||||
|
FS_KEY = os.environ["FS_KEY"]
|
||||||
|
|
||||||
|
|
||||||
|
if BARK:
|
||||||
|
notify_mode.append('bark')
|
||||||
|
# print("BARK 推送打开")
|
||||||
|
if BARK_PUSH:
|
||||||
|
notify_mode.append('bark')
|
||||||
|
# print("BARK 推送打开")
|
||||||
|
if PUSH_KEY:
|
||||||
|
notify_mode.append('sc_key')
|
||||||
|
# print("Server酱 推送打开")
|
||||||
|
if TG_BOT_TOKEN and TG_USER_ID:
|
||||||
|
notify_mode.append('telegram_bot')
|
||||||
|
# print("Telegram 推送打开")
|
||||||
|
if DD_BOT_TOKEN and DD_BOT_SECRET:
|
||||||
|
notify_mode.append('dingding_bot')
|
||||||
|
# print("钉钉机器人 推送打开")
|
||||||
|
if QQ_SKEY and QQ_MODE:
|
||||||
|
notify_mode.append('coolpush_bot')
|
||||||
|
# print("QQ机器人 推送打开")
|
||||||
|
|
||||||
|
if PUSH_PLUS_TOKEN:
|
||||||
|
notify_mode.append('pushplus_bot')
|
||||||
|
# print("微信推送Plus机器人 推送打开")
|
||||||
|
if QYWX_AM:
|
||||||
|
notify_mode.append('wecom_app')
|
||||||
|
# print("企业微信机器人 推送打开")
|
||||||
|
|
||||||
|
if QYWX_KEY:
|
||||||
|
notify_mode.append('wecom_key')
|
||||||
|
# print("企业微信机器人 推送打开")
|
||||||
|
|
||||||
|
if FS_KEY:
|
||||||
|
notify_mode.append('fs_key')
|
||||||
|
# print("飞书机器人 推送打开")
|
||||||
|
|
||||||
|
def message(str_msg):
|
||||||
|
global message_info
|
||||||
|
print(str_msg)
|
||||||
|
message_info = "{}\n{}".format(message_info, str_msg)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def bark(title, content):
|
||||||
|
print("\n")
|
||||||
|
if BARK:
|
||||||
|
try:
|
||||||
|
response = requests.get(
|
||||||
|
f"""https://api.day.app/{BARK}/{title}/{urllib.parse.quote_plus(content)}""").json()
|
||||||
|
if response['code'] == 200:
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!')
|
||||||
|
except:
|
||||||
|
print('推送失败!')
|
||||||
|
if BARK_PUSH:
|
||||||
|
try:
|
||||||
|
response = requests.get(
|
||||||
|
f"""{BARK_PUSH}/{title}/{urllib.parse.quote_plus(content)}""").json()
|
||||||
|
if response['code'] == 200:
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!')
|
||||||
|
except:
|
||||||
|
print('推送失败!')
|
||||||
|
print("bark服务启动")
|
||||||
|
if BARK=='' and BARK_PUSH=='':
|
||||||
|
print("bark服务的bark_token未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
|
||||||
|
def serverJ(title, content):
|
||||||
|
print("\n")
|
||||||
|
if not PUSH_KEY:
|
||||||
|
print("server酱服务的PUSH_KEY未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
print("serverJ服务启动")
|
||||||
|
data = {
|
||||||
|
"text": title,
|
||||||
|
"desp": content.replace("\n", "\n\n")
|
||||||
|
}
|
||||||
|
response = requests.post(f"https://sc.ftqq.com/{PUSH_KEY}.send", data=data).json()
|
||||||
|
if response['code'] == 0:
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!')
|
||||||
|
|
||||||
|
# tg通知
|
||||||
|
def telegram_bot(title, content):
|
||||||
|
try:
|
||||||
|
print("\n")
|
||||||
|
bot_token = TG_BOT_TOKEN
|
||||||
|
user_id = TG_USER_ID
|
||||||
|
if not bot_token or not user_id:
|
||||||
|
print("tg服务的bot_token或者user_id未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
print("tg服务启动")
|
||||||
|
if TG_API_HOST:
|
||||||
|
if 'http' in TG_API_HOST:
|
||||||
|
url = f"{TG_API_HOST}/bot{TG_BOT_TOKEN}/sendMessage"
|
||||||
|
else:
|
||||||
|
url = f"https://{TG_API_HOST}/bot{TG_BOT_TOKEN}/sendMessage"
|
||||||
|
else:
|
||||||
|
url = f"https://api.telegram.org/bot{TG_BOT_TOKEN}/sendMessage"
|
||||||
|
|
||||||
|
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
|
||||||
|
payload = {'chat_id': str(TG_USER_ID), 'text': f'{title}\n\n{content}', 'disable_web_page_preview': 'true'}
|
||||||
|
proxies = None
|
||||||
|
if TG_PROXY_IP and TG_PROXY_PORT:
|
||||||
|
proxyStr = "http://{}:{}".format(TG_PROXY_IP, TG_PROXY_PORT)
|
||||||
|
proxies = {"http": proxyStr, "https": proxyStr}
|
||||||
|
try:
|
||||||
|
response = requests.post(url=url, headers=headers, params=payload, proxies=proxies).json()
|
||||||
|
except:
|
||||||
|
print('推送失败!')
|
||||||
|
if response['ok']:
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def dingding_bot(title, content):
|
||||||
|
timestamp = str(round(time.time() * 1000)) # 时间戳
|
||||||
|
secret_enc = DD_BOT_SECRET.encode('utf-8')
|
||||||
|
string_to_sign = '{}\n{}'.format(timestamp, DD_BOT_SECRET)
|
||||||
|
string_to_sign_enc = string_to_sign.encode('utf-8')
|
||||||
|
hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest()
|
||||||
|
sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) # 签名
|
||||||
|
print('开始使用 钉钉机器人 推送消息...', end='')
|
||||||
|
url = f'https://oapi.dingtalk.com/robot/send?access_token={DD_BOT_TOKEN}×tamp={timestamp}&sign={sign}'
|
||||||
|
headers = {'Content-Type': 'application/json;charset=utf-8'}
|
||||||
|
data = {
|
||||||
|
'msgtype': 'text',
|
||||||
|
'text': {'content': f'{title}\n\n{content}'}
|
||||||
|
}
|
||||||
|
response = requests.post(url=url, data=json.dumps(data), headers=headers, timeout=15).json()
|
||||||
|
if not response['errcode']:
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!')
|
||||||
|
|
||||||
|
def coolpush_bot(title, content):
|
||||||
|
print("\n")
|
||||||
|
if not QQ_SKEY or not QQ_MODE:
|
||||||
|
print("qq服务的QQ_SKEY或者QQ_MODE未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
print("qq服务启动")
|
||||||
|
url=f"https://qmsg.zendee.cn/{QQ_MODE}/{QQ_SKEY}"
|
||||||
|
payload = {'msg': f"{title}\n\n{content}".encode('utf-8')}
|
||||||
|
response = requests.post(url=url, params=payload).json()
|
||||||
|
if response['code'] == 0:
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!')
|
||||||
|
# push推送
|
||||||
|
def pushplus_bot(title, content):
|
||||||
|
try:
|
||||||
|
print("\n")
|
||||||
|
if not PUSH_PLUS_TOKEN:
|
||||||
|
print("PUSHPLUS服务的token未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
print("PUSHPLUS服务启动")
|
||||||
|
url = 'http://www.pushplus.plus/send'
|
||||||
|
data = {
|
||||||
|
"token": PUSH_PLUS_TOKEN,
|
||||||
|
"title": title,
|
||||||
|
"content": content
|
||||||
|
}
|
||||||
|
body = json.dumps(data).encode(encoding='utf-8')
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
response = requests.post(url=url, data=body, headers=headers).json()
|
||||||
|
if response['code'] == 200:
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def wecom_key(title, content):
|
||||||
|
print("\n")
|
||||||
|
if not QYWX_KEY:
|
||||||
|
print("QYWX_KEY未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
print("QYWX_KEY服务启动")
|
||||||
|
print("content"+content)
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
data = {
|
||||||
|
"msgtype":"text",
|
||||||
|
"text":{
|
||||||
|
"content":title+"\n"+content.replace("\n", "\n\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print(f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={QYWX_KEY}")
|
||||||
|
response = requests.post(f"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key={QYWX_KEY}", json=data,headers=headers).json()
|
||||||
|
print(response)
|
||||||
|
|
||||||
|
# 飞书机器人推送
|
||||||
|
def fs_key(title, content):
|
||||||
|
print("\n")
|
||||||
|
if not FS_KEY:
|
||||||
|
print("FS_KEY未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
print("FS_KEY服务启动")
|
||||||
|
print("content"+content)
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
data = {
|
||||||
|
"msg_type":"text",
|
||||||
|
"content":{
|
||||||
|
"text":title+"\n"+content.replace("\n", "\n\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print(f"https://open.feishu.cn/open-apis/bot/v2/hook/{FS_KEY}")
|
||||||
|
response = requests.post(f"https://open.feishu.cn/open-apis/bot/v2/hook/{FS_KEY}", json=data,headers=headers).json()
|
||||||
|
print(response)
|
||||||
|
|
||||||
|
|
||||||
|
# 企业微信 APP 推送
|
||||||
|
def wecom_app(title, content):
|
||||||
|
try:
|
||||||
|
if not QYWX_AM:
|
||||||
|
print("QYWX_AM 并未设置!!\n取消推送")
|
||||||
|
return
|
||||||
|
QYWX_AM_AY = re.split(',', QYWX_AM)
|
||||||
|
if 4 < len(QYWX_AM_AY) > 5:
|
||||||
|
print("QYWX_AM 设置错误!!\n取消推送")
|
||||||
|
return
|
||||||
|
corpid = QYWX_AM_AY[0]
|
||||||
|
corpsecret = QYWX_AM_AY[1]
|
||||||
|
touser = QYWX_AM_AY[2]
|
||||||
|
agentid = QYWX_AM_AY[3]
|
||||||
|
try:
|
||||||
|
media_id = QYWX_AM_AY[4]
|
||||||
|
except:
|
||||||
|
media_id = ''
|
||||||
|
wx = WeCom(corpid, corpsecret, agentid)
|
||||||
|
# 如果没有配置 media_id 默认就以 text 方式发送
|
||||||
|
if not media_id:
|
||||||
|
message = title + '\n\n' + content
|
||||||
|
response = wx.send_text(message, touser)
|
||||||
|
else:
|
||||||
|
response = wx.send_mpnews(title, content, media_id, touser)
|
||||||
|
if response == 'ok':
|
||||||
|
print('推送成功!')
|
||||||
|
else:
|
||||||
|
print('推送失败!错误信息如下:\n', response)
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
class WeCom:
|
||||||
|
def __init__(self, corpid, corpsecret, agentid):
|
||||||
|
self.CORPID = corpid
|
||||||
|
self.CORPSECRET = corpsecret
|
||||||
|
self.AGENTID = agentid
|
||||||
|
|
||||||
|
def get_access_token(self):
|
||||||
|
url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken'
|
||||||
|
values = {'corpid': self.CORPID,
|
||||||
|
'corpsecret': self.CORPSECRET,
|
||||||
|
}
|
||||||
|
req = requests.post(url, params=values)
|
||||||
|
data = json.loads(req.text)
|
||||||
|
return data["access_token"]
|
||||||
|
|
||||||
|
def send_text(self, message, touser="@all"):
|
||||||
|
send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token()
|
||||||
|
send_values = {
|
||||||
|
"touser": touser,
|
||||||
|
"msgtype": "text",
|
||||||
|
"agentid": self.AGENTID,
|
||||||
|
"text": {
|
||||||
|
"content": message
|
||||||
|
},
|
||||||
|
"safe": "0"
|
||||||
|
}
|
||||||
|
send_msges = (bytes(json.dumps(send_values), 'utf-8'))
|
||||||
|
respone = requests.post(send_url, send_msges)
|
||||||
|
respone = respone.json()
|
||||||
|
return respone["errmsg"]
|
||||||
|
|
||||||
|
def send_mpnews(self, title, message, media_id, touser="@all"):
|
||||||
|
send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token()
|
||||||
|
send_values = {
|
||||||
|
"touser": touser,
|
||||||
|
"msgtype": "mpnews",
|
||||||
|
"agentid": self.AGENTID,
|
||||||
|
"mpnews": {
|
||||||
|
"articles": [
|
||||||
|
{
|
||||||
|
"title": title,
|
||||||
|
"thumb_media_id": media_id,
|
||||||
|
"author": "Author",
|
||||||
|
"content_source_url": "",
|
||||||
|
"content": message.replace('\n', '<br/>'),
|
||||||
|
"digest": message
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send_msges = (bytes(json.dumps(send_values), 'utf-8'))
|
||||||
|
respone = requests.post(send_url, send_msges)
|
||||||
|
respone = respone.json()
|
||||||
|
return respone["errmsg"]
|
||||||
|
|
||||||
|
def send(title, content):
|
||||||
|
"""
|
||||||
|
使用 bark, telegram bot, dingding bot, server, feishuJ 发送手机推送
|
||||||
|
:param title:
|
||||||
|
:param content:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
|
||||||
|
for i in notify_mode:
|
||||||
|
if i == 'bark':
|
||||||
|
if BARK or BARK_PUSH:
|
||||||
|
bark(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用 bark')
|
||||||
|
continue
|
||||||
|
if i == 'sc_key':
|
||||||
|
if PUSH_KEY:
|
||||||
|
serverJ(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用 Server酱')
|
||||||
|
continue
|
||||||
|
elif i == 'dingding_bot':
|
||||||
|
if DD_BOT_TOKEN and DD_BOT_SECRET:
|
||||||
|
dingding_bot(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用 钉钉机器人')
|
||||||
|
continue
|
||||||
|
elif i == 'telegram_bot':
|
||||||
|
if TG_BOT_TOKEN and TG_USER_ID:
|
||||||
|
telegram_bot(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用 telegram机器人')
|
||||||
|
continue
|
||||||
|
elif i == 'coolpush_bot':
|
||||||
|
if QQ_SKEY and QQ_MODE:
|
||||||
|
coolpush_bot(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用 QQ机器人')
|
||||||
|
continue
|
||||||
|
elif i == 'pushplus_bot':
|
||||||
|
if PUSH_PLUS_TOKEN:
|
||||||
|
pushplus_bot(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用 PUSHPLUS机器人')
|
||||||
|
continue
|
||||||
|
elif i == 'wecom_app':
|
||||||
|
if QYWX_AM:
|
||||||
|
wecom_app(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用企业微信应用消息推送')
|
||||||
|
continue
|
||||||
|
elif i == 'wecom_key':
|
||||||
|
if QYWX_KEY:
|
||||||
|
|
||||||
|
for i in range(int(len(content)/2000)+1):
|
||||||
|
wecom_key(title=title, content=content[i*2000:(i+1)*2000])
|
||||||
|
else:
|
||||||
|
print('未启用企业微信应用消息推送')
|
||||||
|
continue
|
||||||
|
elif i == 'fs_key':
|
||||||
|
if FS_KEY:
|
||||||
|
fs_key(title=title, content=content)
|
||||||
|
else:
|
||||||
|
print('未启用飞书机器人消息推送')
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print('此类推送方式不存在')
|
||||||
|
print("xxxxxxxxxxxx")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
send('title', 'content')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Loading…
Reference in New Issue
Block a user