diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 6bae0722..ffca055f 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -658,7 +658,8 @@ "Bash($env:DATABASE_URL=\"postgresql://test:test@localhost:5432/test\")", "Bash(DATABASE_URL=\"postgresql://test:test@localhost:5432/test\" npx prisma validate:*)", "Bash(DATABASE_URL=\"postgresql://test:test@localhost:5432/test\" npx prisma format:*)", - "Bash(timeout 60 npx tsc:*)" + "Bash(timeout 60 npx tsc:*)", + "Bash(git commit -m \"$\\(cat <<''EOF''\nfeat\\(wallet-service\\): 三层保护机制确保内部转账接收方钱包存在\n\n新增三层保护机制:\n1. 用户注册时:监听 identity.UserAccountCreated 事件自动创建钱包\n2. 发起转账时:检测内部转账后调用 ensureWalletExists\\(\\) 预创建钱包\n3. 链上确认时:原有 upsert 逻辑兜底(保持不变)\n\n新增文件:\n- identity-event-consumer.service.ts: 消费 identity 用户注册事件\n- user-account-created.handler.ts: 处理用户注册事件创建钱包\n\n新增 API:\n- POST /wallets/ensure-wallet: 确保单个钱包存在\n- POST /wallets/ensure-wallets: 批量确保钱包存在\n\n🤖 Generated with [Claude Code]\\(https://claude.com/claude-code\\)\n\nCo-Authored-By: Claude Opus 4.5 \nEOF\n\\)\")" ], "deny": [], "ask": [] diff --git a/backend/services/authorization-service/src/infrastructure/persistence/repositories/authorization-role.repository.impl.ts b/backend/services/authorization-service/src/infrastructure/persistence/repositories/authorization-role.repository.impl.ts index 9ae901f2..f74b6dd0 100644 --- a/backend/services/authorization-service/src/infrastructure/persistence/repositories/authorization-role.repository.impl.ts +++ b/backend/services/authorization-service/src/infrastructure/persistence/repositories/authorization-role.repository.impl.ts @@ -89,7 +89,7 @@ export class AuthorizationRoleRepositoryImpl implements IAuthorizationRoleReposi ): Promise { const record = await this.prisma.authorizationRole.findFirst({ where: { - userId: userId.value, + accountSequence: userId.accountSequence, roleType: roleType, ...this.notDeleted, }, @@ -104,7 +104,7 @@ export class AuthorizationRoleRepositoryImpl implements IAuthorizationRoleReposi ): Promise { const record = await this.prisma.authorizationRole.findFirst({ where: { - userId: userId.value, + accountSequence: userId.accountSequence, roleType: roleType, regionCode: regionCode.value, ...this.notDeleted, @@ -129,7 +129,7 @@ export class AuthorizationRoleRepositoryImpl implements IAuthorizationRoleReposi async findByUserId(userId: UserId): Promise { const records = await this.prisma.authorizationRole.findMany({ - where: { userId: userId.value, ...this.notDeleted }, + where: { accountSequence: userId.accountSequence, ...this.notDeleted }, orderBy: { createdAt: 'desc' }, }) return records.map((record) => this.toDomain(record)) @@ -174,7 +174,7 @@ export class AuthorizationRoleRepositoryImpl implements IAuthorizationRoleReposi async findPendingByUserId(userId: UserId): Promise { const records = await this.prisma.authorizationRole.findMany({ where: { - userId: userId.value, + accountSequence: userId.accountSequence, status: AuthorizationStatus.PENDING, ...this.notDeleted, }, @@ -430,7 +430,7 @@ export class AuthorizationRoleRepositoryImpl implements IAuthorizationRoleReposi async findAllByUserIdIncludeDeleted(userId: UserId): Promise { const records = await this.prisma.authorizationRole.findMany({ - where: { userId: userId.value }, + where: { accountSequence: userId.accountSequence }, orderBy: { createdAt: 'desc' }, }) return records.map((record) => this.toDomain(record))