From 96da7518bf3a637b1a6e30e3bf8a40bef0ec898d Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 21 Jan 2026 00:28:48 -0800 Subject: [PATCH] =?UTF-8?q?fix(system-accounts):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=9C=81=E5=B8=82=E7=B3=BB=E7=BB=9F=E8=B4=A6=E6=88=B7=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=9B=E5=BB=BA=E7=9A=84=E6=95=B0=E6=8D=AE=E6=B5=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. contribution-service: 修复 CITY 类型账户的 provinceCode 映射 - 之前 CITY 的 provinceCode 被错误设为 cityCode - 现在正确传递 provinceCode 用于创建省份 2. mining-wallet-service: 修复系统账户创建事件的 topic - 之前发布到 mining-wallet.system-account.created - 现在发布到 cdc.mining-wallet.outbox 供 mining-admin-service 同步 Co-Authored-By: Claude Opus 4.5 --- .../contribution-distribution-publisher.service.ts | 5 +++-- .../application/services/contribution-wallet.service.ts | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/services/contribution-service/src/application/services/contribution-distribution-publisher.service.ts b/backend/services/contribution-service/src/application/services/contribution-distribution-publisher.service.ts index c093675e..e7d440b2 100644 --- a/backend/services/contribution-service/src/application/services/contribution-distribution-publisher.service.ts +++ b/backend/services/contribution-service/src/application/services/contribution-distribution-publisher.service.ts @@ -121,13 +121,14 @@ export class ContributionDistributionPublisherService { return result.systemContributions.map((sys) => ({ accountType: sys.accountType, amount: sys.amount.value.toString(), - // 直接使用 regionCode,没有就用传入的参数 + // 省份代码:PROVINCE 用自己的 regionCode,CITY 需要传递省份代码用于创建省份 provinceCode: sys.accountType === 'PROVINCE' ? sys.regionCode || provinceCode : sys.accountType === 'CITY' - ? sys.regionCode || cityCode + ? provinceCode // CITY 需要省份代码来创建省份(如果省份不存在) : undefined, + // 城市代码:只有 CITY 类型有 cityCode: sys.accountType === 'CITY' ? sys.regionCode || cityCode : undefined, neverExpires: sys.accountType === 'OPERATION', // 运营账户永不过期 diff --git a/backend/services/mining-wallet-service/src/application/services/contribution-wallet.service.ts b/backend/services/mining-wallet-service/src/application/services/contribution-wallet.service.ts index b99b7db0..aa1818cc 100644 --- a/backend/services/mining-wallet-service/src/application/services/contribution-wallet.service.ts +++ b/backend/services/mining-wallet-service/src/application/services/contribution-wallet.service.ts @@ -396,13 +396,13 @@ export class ContributionWalletService { }); this.logger.log(`Auto-created province system account: ${account.code}`); - // 发布系统账户创建事件到 Outbox + // 发布系统账户创建事件到 Outbox(用于 mining-admin-service 同步) await tx.outboxEvent.create({ data: { aggregateType: 'SystemAccount', aggregateId: account.id, eventType: 'WalletSystemAccountCreated', - topic: 'mining-wallet.system-account.created', + topic: 'cdc.mining-wallet.outbox', key: account.code, payload: { id: account.id, @@ -481,13 +481,13 @@ export class ContributionWalletService { }); this.logger.log(`Auto-created city system account: ${account.code}`); - // 发布系统账户创建事件到 Outbox + // 发布系统账户创建事件到 Outbox(用于 mining-admin-service 同步) await tx.outboxEvent.create({ data: { aggregateType: 'SystemAccount', aggregateId: account.id, eventType: 'WalletSystemAccountCreated', - topic: 'mining-wallet.system-account.created', + topic: 'cdc.mining-wallet.outbox', key: account.code, payload: { id: account.id,