diff --git a/backend/services/contribution-service/src/pre-planting/application/services/pre-planting-contribution.service.ts b/backend/services/contribution-service/src/pre-planting/application/services/pre-planting-contribution.service.ts index 3840f26d..b9fc959c 100644 --- a/backend/services/contribution-service/src/pre-planting/application/services/pre-planting-contribution.service.ts +++ b/backend/services/contribution-service/src/pre-planting/application/services/pre-planting-contribution.service.ts @@ -725,6 +725,39 @@ export class PrePlantingContributionService { `[PRE-PLANTING-MERGE] Expired ${expiredCount.count} portion records for merge ${mergeNo}`, ); + // 9b-sync: 查询已作废的记录并发布同步事件(mining-admin-service 需要更新 isExpired 状态) + if (expiredCount.count > 0) { + const expiredRecords = await tx.contributionRecord.findMany({ + where: { sourceAdoptionId: { in: portionSourceAdoptionIds }, isExpired: true }, + }); + const expiredEvents = expiredRecords.map((record) => { + const event = new ContributionRecordSyncedEvent( + record.id, + record.accountSequence, + record.sourceType, + record.sourceAdoptionId, + record.sourceAccountSequence, + record.treeCount, + record.baseContribution.toString(), + record.distributionRate.toString(), + record.levelDepth, + record.bonusTier, + record.amount.toString(), + record.effectiveDate, + record.expireDate, + true, + record.createdAt, + ); + return { + aggregateType: ContributionRecordSyncedEvent.AGGREGATE_TYPE, + aggregateId: record.id.toString(), + eventType: ContributionRecordSyncedEvent.EVENT_TYPE, + payload: event.toPayload(), + }; + }); + await this.outboxRepository.saveMany(expiredEvents); + } + // 9c: 从认种人账户扣减旧个人算力(personal_contribution - 和 effective_contribution -) if (parseFloat(expiredPersonalStr) > 0) { await tx.contributionAccount.updateMany({ diff --git a/frontend/mining-admin-web/src/features/users/components/contribution-records-list.tsx b/frontend/mining-admin-web/src/features/users/components/contribution-records-list.tsx index c4b33050..78e2bf66 100644 --- a/frontend/mining-admin-web/src/features/users/components/contribution-records-list.tsx +++ b/frontend/mining-admin-web/src/features/users/components/contribution-records-list.tsx @@ -164,9 +164,9 @@ export function ContributionRecordsList({ accountSequence }: ContributionRecords {formatDate(record.effectiveDate)} {record.isExpired ? ( - 已过期 + 无效 ) : ( - 有效 + 有效 )} diff --git a/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart b/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart index 8e5257a2..051a0ea2 100644 --- a/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart +++ b/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart @@ -354,20 +354,23 @@ class _ContributionRecordsListPageState extends ConsumerState