Merge pull request #61 from stkevintan/fix-recheck

fix: invalid access of local variable
This commit is contained in:
Womsxd 2022-02-08 14:42:33 +08:00 committed by GitHub
commit e1ce375f72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,6 +78,7 @@ class Genshin:
log.warning(f"旅行者{i[0]}是第一次绑定米游社,请先手动签到一次") log.warning(f"旅行者{i[0]}是第一次绑定米游社,请先手动签到一次")
else: else:
sign_days = is_data["total_sign_day"] - 1 sign_days = is_data["total_sign_day"] - 1
ok = True
if is_data["is_sign"]: if is_data["is_sign"]:
log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days])}") log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days])}")
else: else:
@ -86,19 +87,15 @@ class Genshin:
json={'act_id': setting.genshin_Act_id, 'region': i[2], 'uid': i[1]}) json={'act_id': setting.genshin_Act_id, 'region': i[2], 'uid': i[1]})
data = req.json() data = req.json()
if data["retcode"] == 0: if data["retcode"] == 0:
if sign_days == 0: log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.get_item(self.sign_Give[0 if sign_days == 0 else sign_days + 1])}")
log.info(f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days])}") sign_days += 1
else:
log.info(
f"旅行者{i[0]}签到成功~\r\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days + 1])}")
elif data["retcode"] == -5003: elif data["retcode"] == -5003:
log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days])}") log.info(f"旅行者{i[0]}今天已经签到过了~\r\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days])}")
else: else:
log.warning("账号签到失败!") log.warning("账号签到失败!")
print(req.text) print(req.text)
if is_data["is_sign"] or data["retcode"] == 0 or data["retcode"] == -5003: ok = False
if data["retcode"] == 0: if ok:
sign_days += 1
return_data += f"\n{i[0]}已连续签到{sign_days}\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days])}" return_data += f"\n{i[0]}已连续签到{sign_days}\n今天获得的奖励是{tools.get_item(self.sign_Give[sign_days])}"
else: else:
return_data += f"\n{i[0]},本次签到失败" return_data += f"\n{i[0]},本次签到失败"