From 962e7874c8471897b736b0055c0c94dd367d5410 Mon Sep 17 00:00:00 2001 From: hailin Date: Fri, 16 Jan 2026 04:55:30 -0800 Subject: [PATCH] =?UTF-8?q?fix(contribution):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=85=A8=E7=BD=91=E7=90=86=E8=AE=BA=E7=AE=97=E5=8A=9B=E6=9C=AA?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 calculateForAdoption 中调用 updateNetworkProgress 更新 NetworkAdoptionProgress 表 - 之前 publishNetworkProgressEvent 读取的 totalTreeCount 始终为 0,因为表未被更新 Co-Authored-By: Claude Opus 4.5 --- .claude/settings.local.json | 6 +++++- .../services/contribution-calculation.service.ts | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 629ba56d..44f18707 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -775,7 +775,11 @@ "Bash(del \"c:\\\\Users\\\\dong\\\\Desktop\\\\rwadurian\\\\frontend\\\\mining-app\\\\lib\\\\domain\\\\usecases\\\\trading\\\\buy_shares.dart\")", "Bash(del \"c:\\\\Users\\\\dong\\\\Desktop\\\\rwadurian\\\\frontend\\\\mining-app\\\\lib\\\\domain\\\\usecases\\\\trading\\\\sell_shares.dart\")", "Bash(ls -la \"c:\\\\Users\\\\dong\\\\Desktop\\\\rwadurian\\\\frontend\\\\mining-app\\\\lib\\\\presentation\\\\pages\"\" 2>/dev/null || dir /b \"c:UsersdongDesktoprwadurianfrontendmining-applibpresentationpages \")", - "Bash(cd:*)" + "Bash(cd:*)", + "Bash(ssh -o StrictHostKeyChecking=no -J ceshi@103.39.231.231 ceshi@192.168.1.111 \"curl -s http://localhost:3020/api/v1/ | head -100\")", + "Bash(ssh -o StrictHostKeyChecking=no -J ceshi@103.39.231.231 ceshi@192.168.1.111:*)", + "Bash(bc:*)", + "Bash(DATABASE_URL=\"postgresql://postgres:password@localhost:5432/mining_db?schema=public\" npx prisma migrate diff:*)" ], "deny": [], "ask": [] diff --git a/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts b/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts index d21899ca..1da79d54 100644 --- a/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts +++ b/backend/services/contribution-service/src/application/services/contribution-calculation.service.ts @@ -114,6 +114,16 @@ export class ContributionCalculationService { `unallocated=${result.unallocatedContributions.length}`, ); + // 更新全网认种进度(更新 NetworkAdoptionProgress 表) + // 判断是否为新认种用户:之前没有账户记录即为新用户 + const isNewUser = !adopterAccount; + await this.contributionRateService.updateNetworkProgress( + adoption.treeCount, + adoption.adoptionDate, + adoption.originalAdoptionId, + isNewUser, + ); + // 发布全网进度更新事件(用于 mining-service 同步全网理论算力) await this.publishNetworkProgressEvent(); }