refactor: 优化后端认证和路由功能
- 优化auth.py认证路由 - 优化books.py书籍路由 - 优化sms_service.py短信服务
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user