会员积分改版V1

This commit is contained in:
2026-08-11 09:24:18 +08:00
parent fe24e51b97
commit b9fd07f293
111 changed files with 9355 additions and 3900 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)
@@ -53,6 +54,7 @@ async def get_current_user_allow_password_pending(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="账号不存在或已禁用",
)
attach_credit_snapshot(user, await get_available_credits(db, user.id))
return user
@@ -92,6 +94,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