소스 검색

fix: 补全 expense 模块 + 修复短信登录查询

alphah 2 주 전
부모
커밋
31cb6c4aff
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8 2
      backend/app/api/v1/module_system/auth/service.py

+ 8 - 2
backend/app/api/v1/module_system/auth/service.py

@@ -191,12 +191,18 @@ class LoginService:
         pass  # 测试阶段跳过短信验证码校验
 
         # 根据手机号查找用户
-        auth = AuthSchema(db=db)
-        user = await UserCRUD(auth).get_by_mobile_crud(mobile=mobile)
+        from app.api.v1.module_system.user.model import UserModel
+        from sqlalchemy import select
+        stmt = select(UserModel).where(UserModel.mobile == mobile)
+        result = await db.execute(stmt)
+        user = result.scalar_one_or_none()
 
         if not user:
+            log.error(f"短信登录-未找到用户: mobile={mobile}")
             raise CustomException(msg="用户不存在")
 
+        log.info(f"短信登录-找到用户: id={user.id}, mobile={user.mobile}, status={user.status}")
+
         if user.status == "1":
             raise CustomException(msg="用户已被停用")