fix(contribution): 修复全网理论算力未同步问题

- 在 calculateForAdoption 中调用 updateNetworkProgress 更新 NetworkAdoptionProgress 表
- 之前 publishNetworkProgressEvent 读取的 totalTreeCount 始终为 0,因为表未被更新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-16 04:55:30 -08:00
parent bb75ff19a4
commit 962e7874c8
2 changed files with 15 additions and 1 deletions

View File

@ -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": []

View File

@ -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();
}