From 6caae7c860e5a23dbaf7ce4f372bfd52aada8600 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 11 Jan 2026 08:33:39 -0800 Subject: [PATCH] =?UTF-8?q?fix(auth-service):=20=E8=B7=B3=E8=BF=87?= =?UTF-8?q?=E6=97=A0=E6=89=8B=E6=9C=BA=E5=8F=B7/=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E7=9A=84=E7=B3=BB=E7=BB=9F=E8=B4=A6=E6=88=B7CDC=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.5 --- .../messaging/cdc/legacy-user-cdc.consumer.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts b/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts index d7d5a59b..53b33bf3 100644 --- a/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts +++ b/backend/services/auth-service/src/infrastructure/messaging/cdc/legacy-user-cdc.consumer.ts @@ -124,6 +124,18 @@ export class LegacyUserCdcConsumer implements OnModuleInit, OnModuleDestroy { } private async upsertLegacyUser(user: UnwrappedCdcUser, sequenceNum: bigint) { + // 跳过没有手机号的系统账户(user_id 1-5 通常是系统/测试账户) + if (!user.phone_number) { + this.logger.debug(`Skipped user ${user.user_id} (no phone number)`); + return; + } + + // 跳过没有密码的账户 + if (!user.password_hash) { + this.logger.debug(`Skipped user ${user.user_id} (no password)`); + return; + } + try { await this.prisma.syncedLegacyUser.upsert({ where: { legacyId: BigInt(user.user_id) },