fix: 清掉无用接口和样式,并收紧登录与工号边界

This commit is contained in:
2026-11-16 11:30:59 +08:00
parent 7381b49e4c
commit 5b83b7e415
15 changed files with 232 additions and 329 deletions
+1 -8
View File
@@ -24,7 +24,6 @@ _inflight: set[str] = set()
_dirty: set[str] = set()
_urgent: set[str] = set()
_last_flush: dict[str, float] = {}
_latest: dict[str, dict] = {}
def attach_loop(loop: asyncio.AbstractEventLoop) -> None:
@@ -47,6 +46,7 @@ def unregister(employee_id: str, ws: WebSocket) -> None:
group.discard(ws)
if not group:
_clients.pop(key, None)
_last_flush.pop(key, None)
def notify(employee_id: str | None = None, urgent: bool = False) -> None:
@@ -59,12 +59,6 @@ def notify(employee_id: str | None = None, urgent: bool = False) -> None:
loop.call_soon_threadsafe(_mark, key, urgent)
def latest_of(employee_id: str) -> dict | None:
key = (employee_id or "").strip()
payload = _latest.get(key)
return dict(payload) if payload else None
def _mark(employee_id: str, urgent: bool) -> None:
_dirty.add(employee_id)
if urgent:
@@ -109,7 +103,6 @@ async def _flush(employee_id: str, armed: bool = False) -> None:
from euniv.study_control import payload_for
payload = await asyncio.to_thread(payload_for, employee_id)
_latest[employee_id] = payload
_last_flush[employee_id] = asyncio.get_running_loop().time()
dead: list[WebSocket] = []
for ws in sockets: