This commit is contained in:
2026-08-13 09:38:36 +08:00
124 changed files with 11236 additions and 5549 deletions
+3
View File
@@ -6,6 +6,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.models.base import async_session
from app.models.user import User
from app.services.auth import decode_access_token, user_must_set_password
from app.services.credit.query_service import attach_credit_snapshot, get_available_credits
security = HTTPBearer(auto_error=False)
@@ -64,6 +65,7 @@ async def get_current_user_allow_password_pending(
detail="账号已在其他设备登录,请重新登录",
)
attach_credit_snapshot(user, await get_available_credits(db, user.id))
return user
@@ -103,6 +105,7 @@ async def get_optional_current_user(
if user_must_set_password(user):
return None
attach_credit_snapshot(user, await get_available_credits(db, user.id))
return user