LifeVta commited on
Commit
9e07669
·
verified ·
1 Parent(s): c957e8c

Update app/products/web/admin/tokens.py

Browse files
Files changed (1) hide show
  1. app/products/web/admin/tokens.py +5 -11
app/products/web/admin/tokens.py CHANGED
@@ -1,12 +1,3 @@
1
- """Admin token CRUD — list, import, delete, replace pool.
2
-
3
- Performance notes:
4
- - DI-injected repo (no try/except per call)
5
- - orjson direct output (bypasses stdlib json)
6
- - Quota dict: zero deserialization — reads r.quota directly
7
- - Import refresh: reuses app.state.refresh_service singleton
8
- """
9
-
10
  import asyncio
11
  import re
12
  from typing import TYPE_CHECKING
@@ -33,14 +24,17 @@ if TYPE_CHECKING:
33
  from app.control.account.refresh import AccountRefreshService
34
  from app.control.account.repository import AccountRepository
35
 
36
- from fastapi import APIRouter, Query
 
 
37
 
38
- router = APIRouter()
39
  _background_tasks: set[asyncio.Task] = set()
40
 
41
  # ---------------------------------------------------------------------------
42
  # Token sanitisation
43
  # ---------------------------------------------------------------------------
 
44
 
45
  _TOKEN_TRANS = str.maketrans({
46
  "\u2010": "-", "\u2011": "-", "\u2012": "-",
 
 
 
 
 
 
 
 
 
 
1
  import asyncio
2
  import re
3
  from typing import TYPE_CHECKING
 
24
  from app.control.account.refresh import AccountRefreshService
25
  from app.control.account.repository import AccountRepository
26
 
27
+ # ── 核心:必须确保补回下面这两行引入 ──
28
+ from . import get_refresh_svc, get_repo
29
+ from app.control.account.runtime import global_auditor
30
 
31
+ router = APIRouter(tags=["Admin - Tokens"])
32
  _background_tasks: set[asyncio.Task] = set()
33
 
34
  # ---------------------------------------------------------------------------
35
  # Token sanitisation
36
  # ---------------------------------------------------------------------------
37
+ # ... 下方保持你原有的具体业务 Endpoint 逻辑不变 ...
38
 
39
  _TOKEN_TRANS = str.maketrans({
40
  "\u2010": "-", "\u2011": "-", "\u2012": "-",