fix: 单个检查也刷新本月学时
This commit is contained in:
@@ -129,7 +129,7 @@ def _checked_profile(client) -> dict:
|
||||
return payload
|
||||
|
||||
|
||||
def check_employee(db: Session, employee_id: str, *, refresh_hours: bool = False) -> dict:
|
||||
def check_employee(db: Session, employee_id: str) -> dict:
|
||||
from euniv.proxy import bind_url, is_proxy_failure, url_of, uses_pool
|
||||
from euniv.proxy_pool import MAX_SWITCHES, retire_if_dead
|
||||
|
||||
@@ -155,7 +155,7 @@ def check_employee(db: Session, employee_id: str, *, refresh_hours: bool = False
|
||||
result = "有效" if alive else "已失效"
|
||||
valid = alive
|
||||
profile = _checked_profile(client) if alive else {}
|
||||
if alive and refresh_hours:
|
||||
if alive:
|
||||
hours = _checked_hours(client)
|
||||
break
|
||||
except Exception as exc:
|
||||
@@ -200,7 +200,7 @@ def _check_saved(db: Session, employee_ids: list[str]) -> list[dict]:
|
||||
results = []
|
||||
for employee_id in employee_ids:
|
||||
try:
|
||||
results.append(check_employee(db, employee_id, refresh_hours=True))
|
||||
results.append(check_employee(db, employee_id))
|
||||
except HTTPException as exc:
|
||||
if exc.status_code == 404:
|
||||
continue
|
||||
@@ -232,7 +232,7 @@ def _run_check(employee_ids: list[str]) -> None:
|
||||
for employee_id in employee_ids:
|
||||
with SessionLocal() as db:
|
||||
try:
|
||||
results.append(check_employee(db, employee_id, refresh_hours=True))
|
||||
results.append(check_employee(db, employee_id))
|
||||
except HTTPException as exc:
|
||||
if exc.status_code != 404:
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user