✨✨ 新增获取用户信息方法
This commit is contained in:
parent
bda28e00ae
commit
ab30398389
43
hykb.py
43
hykb.py
@ -33,6 +33,28 @@ class HaoYouKuaiBao():
|
||||
"User-Agent": user_agent
|
||||
}
|
||||
|
||||
def user_info(self):
|
||||
"""
|
||||
获取用户信息
|
||||
:return:
|
||||
"""
|
||||
url = self.url.format("qdjh", "")
|
||||
data = {
|
||||
"ac": "login",
|
||||
"r": f"0.{random.randint(1000000000000000, 8999999999999999)}",
|
||||
"scookie": self.cookie,
|
||||
"device": "kbA25014349F11473F467DC6FF5C89E9D6"
|
||||
}
|
||||
try:
|
||||
response = requests.post(url, headers=self.headers, data=data).json()
|
||||
if response['key'] == 'ok':
|
||||
return {
|
||||
"user": response["config"]["name"],
|
||||
"uuid": response["config"]["uuid"]
|
||||
}
|
||||
except Exception as e:
|
||||
print("好游快爆-获取用户信息出现错误:{}".format(e))
|
||||
|
||||
def plant(self) -> int:
|
||||
"""播种
|
||||
"""
|
||||
@ -42,16 +64,19 @@ class HaoYouKuaiBao():
|
||||
response = requests.post(url, headers=self.headers, data=data).json()
|
||||
if response['key'] == 'ok':
|
||||
print("好游快爆-播种成功")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-播种成功")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||
"好游快爆-播种成功")
|
||||
return 1
|
||||
else:
|
||||
if response['seed'] == 0:
|
||||
print("好游快爆-种子已用完")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-种子已用完")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||
"好游快爆-种子已用完")
|
||||
return -1
|
||||
else:
|
||||
print("好游快爆-播种失败")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-播种失败")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||
"好游快爆-播种失败")
|
||||
return 0
|
||||
except Exception as e:
|
||||
print(f"好游快爆-播种出现错误:{e}")
|
||||
@ -66,11 +91,13 @@ class HaoYouKuaiBao():
|
||||
response = requests.post(url, headers=self.headers, data=data).json()
|
||||
if response['key'] == 'ok':
|
||||
print("好游快爆-收获成功")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-收获成功")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||
"好游快爆-收获成功")
|
||||
return True
|
||||
else:
|
||||
print("好游快爆-收获失败")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), "好游快爆-收获失败")
|
||||
send_notification_message("好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||
"好游快爆-收获失败")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"好游快爆-收获出现错误:{e}")
|
||||
@ -100,11 +127,13 @@ class HaoYouKuaiBao():
|
||||
response = requests.post(url, headers=self.headers, data=data).json()
|
||||
if response['key'] == 'ok':
|
||||
print("好游快爆-浇水成功")
|
||||
send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), content="好游快爆-浇水成功")
|
||||
send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||
content="好游快爆-浇水成功")
|
||||
return 1, response['add_baomihua']
|
||||
elif response['key'] == '1001':
|
||||
print("好游快爆-今日已浇水")
|
||||
send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"), content="好游快爆-今日已浇水")
|
||||
send_notification_message(title="好游快爆签到通知 - " + datetime.now().strftime("%Y/%m/%d"),
|
||||
content="好游快爆-今日已浇水")
|
||||
return 0, 0
|
||||
else:
|
||||
print("好游快爆-浇水出现错误:{}".format(response))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user