mirror of
https://github.com/TDSCDMAA/AutoMihoyoBBS.git
synced 2026-06-03 19:09:12 +08:00
去除重复内容,修改获取账号列表的提示
This commit is contained in:
parent
c4484c61b9
commit
d3b66b3bf3
16
genshin.py
16
genshin.py
@ -27,7 +27,7 @@ class genshin:
|
||||
|
||||
#获取绑定的账号列表
|
||||
def Getacc_list(self) -> list:
|
||||
tools.log.info("正在获取米哈游账号绑定的游戏账号列表...")
|
||||
tools.log.info("正在获取米哈游账号绑定原神账号列表...")
|
||||
temp_List = []
|
||||
req = httpx.get(setting.genshin_Account_info_url, headers=self.headers)
|
||||
data = req.json()
|
||||
@ -39,12 +39,6 @@ class genshin:
|
||||
tools.log.info(f"已获取到{len(temp_List)}个原神账号信息")
|
||||
return temp_List
|
||||
|
||||
#获取签到的奖励名称
|
||||
def Get_item(self, raw_data:dict) ->str:
|
||||
temp_Name = raw_data["name"]
|
||||
temp_Cnt = raw_data["cnt"]
|
||||
return f"{temp_Name}x{temp_Cnt}"
|
||||
|
||||
#获取已经签到奖励列表
|
||||
def Get_singgive(self) -> list:
|
||||
tools.log.info("正在获取签到奖励列表...")
|
||||
@ -78,7 +72,7 @@ class genshin:
|
||||
else:
|
||||
sing_Days = is_data["total_sign_day"] - 1
|
||||
if is_data["is_sign"] == True:
|
||||
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{self.Get_item(self.sing_Give[sing_Days])}")
|
||||
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days])}")
|
||||
else:
|
||||
time.sleep(random.randint(2, 6))
|
||||
req = httpx.post(url=setting.genshin_Singurl, headers=self.headers,
|
||||
@ -86,11 +80,11 @@ class genshin:
|
||||
data = req.json()
|
||||
if data["retcode"] == 0:
|
||||
if sing_Days == 0:
|
||||
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{self.Get_item(self.sing_Give[sing_Days])}")
|
||||
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days])}")
|
||||
else:
|
||||
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{self.Get_item(self.sing_Give[sing_Days + 1])}")
|
||||
tools.log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days + 1])}")
|
||||
elif data["retcode"] == -5003:
|
||||
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{self.Get_item(self.sing_Give[sing_Days])}")
|
||||
tools.log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.Get_item(self.sing_Give[sing_Days])}")
|
||||
else:
|
||||
tools.log.warn("账号签到失败!")
|
||||
print (req.text)
|
||||
|
||||
12
honkai3rd.py
12
honkai3rd.py
@ -25,7 +25,7 @@ class honkai3rd:
|
||||
|
||||
#获取绑定的账号列表
|
||||
def Getacc_list(self) -> list:
|
||||
tools.log.info("正在获取米哈游账号绑定的游戏账号列表...")
|
||||
tools.log.info("正在获取米哈游账号绑定的崩坏3账号列表...")
|
||||
temp_List = []
|
||||
req = httpx.get(setting.honkai3rd_Account_info_url, headers=self.headers)
|
||||
data = req.json()
|
||||
@ -37,12 +37,6 @@ class honkai3rd:
|
||||
tools.log.info(f"已获取到{len(temp_List)}个崩坏3账号信息")
|
||||
return temp_List
|
||||
|
||||
#获取签到的奖励名称
|
||||
def Get_item(self, raw_data:dict) ->str:
|
||||
temp_Name = raw_data["name"]
|
||||
temp_Cnt = raw_data["cnt"]
|
||||
return f"{temp_Name}x{temp_Cnt}"
|
||||
|
||||
#获取今天已经签到了的dict
|
||||
def Get_today_item(self,raw_data:list) -> dict:
|
||||
#用range进行循环,当staus等于0的时候上一个就是今天签到的dict
|
||||
@ -66,7 +60,7 @@ class honkai3rd:
|
||||
if today_Item["status"] == 1:
|
||||
return True
|
||||
else:
|
||||
tools.log.info(f"舰长{nickname}今天已经签到过了~\r\n今天获得的奖励是{self.Get_item(today_Item)}")
|
||||
tools.log.info(f"舰长{nickname}今天已经签到过了~\r\n今天获得的奖励是{tools.Get_item(today_Item)}")
|
||||
return False
|
||||
|
||||
#签到
|
||||
@ -83,7 +77,7 @@ class honkai3rd:
|
||||
data = req.json()
|
||||
if data["retcode"] == 0:
|
||||
today_Item = self.Get_today_item(data["data"]["list"])
|
||||
tools.log.info(f"舰长{i[0]}签到成功~\r\n今天获得的奖励是{self.Get_item(today_Item)}")
|
||||
tools.log.info(f"舰长{i[0]}签到成功~\r\n今天获得的奖励是{tools.Get_item(today_Item)}")
|
||||
elif (data["retcode"] == -5003):
|
||||
tools.log.info(f"舰长{i[0]}今天已经签到过了~")
|
||||
else:
|
||||
|
||||
6
tools.py
6
tools.py
@ -52,6 +52,12 @@ def Get_deviceid() -> str:
|
||||
return str(uuid.uuid3(uuid.NAMESPACE_URL, config.mihoyobbs_Cookies)).replace(
|
||||
'-', '').upper()
|
||||
|
||||
#获取签到的奖励名称
|
||||
def Get_item(self, raw_data:dict) ->str:
|
||||
temp_Name = raw_data["name"]
|
||||
temp_Cnt = raw_data["cnt"]
|
||||
return f"{temp_Name}x{temp_Cnt}"
|
||||
|
||||
#获取明天早晨0点的时间戳
|
||||
def Nextday() -> int:
|
||||
now_time = int(time.time())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user