diff --git a/backend/services/auth-service/src/application/services/auth.service.ts b/backend/services/auth-service/src/application/services/auth.service.ts index 44f8a08..960ec70 100644 --- a/backend/services/auth-service/src/application/services/auth.service.ts +++ b/backend/services/auth-service/src/application/services/auth.service.ts @@ -113,7 +113,14 @@ export class AuthService { /* ── Password Login ── */ async login(dto: LoginDto): Promise { - const user = await this.userRepo.findByPhoneOrEmail(dto.identifier); + // Normalize phone numbers to E.164 before lookup (e.g. 18926762721 → +8618926762721) + let identifier = dto.identifier; + try { + identifier = Phone.create(dto.identifier).value; + } catch { + // Not a valid phone number — treat as email, use as-is + } + const user = await this.userRepo.findByPhoneOrEmail(identifier); if (!user) { throw new UnauthorizedException('账号或密码错误'); }