fix: 学时读不到时先重新登录再判断凭据失效

This commit is contained in:
Nixevol
2026-11-21 15:28:59 +08:00
parent a5539405ca
commit d5226fc1a1
3 changed files with 60 additions and 3 deletions
+11 -3
View File
@@ -659,8 +659,6 @@ def _refresh_one(employee_id: str, attempts: int, client_factory) -> None:
if is_studying(employee_id):
return
if account.credential_valid is False:
return
client = None
valid = False
checked_alive = False
@@ -714,11 +712,21 @@ def _refresh_one(employee_id: str, attempts: int, client_factory) -> None:
from admin.users import describe_credential
found = describe_credential(client)
if not found["valid"] and password and not is_qr_password(password):
logged = client.login(manual=False, auto_attempts=attempts)
_persist(db, employee_id, password, client, logged)
found = describe_credential(client)
hours = found["hours"]
official = found["official"]
profile = found["profile"]
profile = found["profile"] if isinstance(found["profile"], dict) else {}
valid = bool(found["valid"])
checked_alive = valid
if not valid:
import logging
logging.getLogger("euniv.service").warning(
"账号 %s 本次没同时取到个人信息和本月学时,记为已失效", employee_id
)
break
except Exception as exc:
if _switch_proxy(account, client, exc):