fix(auth-service): 跳过无手机号/密码的系统账户CDC同步

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-11 08:33:39 -08:00
parent a749a3b9e1
commit 6caae7c860
1 changed files with 12 additions and 0 deletions

View File

@ -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) },