refactor: 优化后端认证和路由功能

- 优化auth.py认证路由
- 优化books.py书籍路由
- 优化sms_service.py短信服务
This commit is contained in:
iammm0
2026-01-29 10:57:05 +08:00
parent 6744263773
commit 32fdc066dd
3 changed files with 57 additions and 21 deletions

View File

@@ -166,7 +166,7 @@ async def check_rate_limit(db: AsyncSession, phone: str) -> Tuple[bool, int]:
SmsVerificationCode.phone == phone
).order_by(
SmsVerificationCode.created_at.desc()
)
).limit(1)
result = await db.execute(stmt)
recent_code = result.scalar_one_or_none()
@@ -262,7 +262,7 @@ async def verify_code(
SmsVerificationCode.is_expired == False
).order_by(
SmsVerificationCode.created_at.desc()
)
).limit(1)
result = await db.execute(stmt)
verification = result.scalar_one_or_none()