会员积分改版V1
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user