fix(mining-admin-service): correct effective contribution calculation
Effective contribution should equal theoretical total (totalTrees * 22617) since it includes all parts: personal 70% + operation 12% + province 1% + city 2% + level 7.5% + bonus 7.5% = 100%. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
420dfbfd9f
commit
d7bbb19571
|
|
@ -123,6 +123,11 @@ export class DashboardService {
|
|||
|
||||
/**
|
||||
* 获取算力统计
|
||||
*
|
||||
* 有效算力 = 个人算力(70%) + 运营账户(12%) + 省公司(1%) + 市公司(2%)
|
||||
* + 已解锁层级 + 未解锁层级 + 已解锁团队 + 未解锁团队
|
||||
* = 理论总算力(因为包含所有部分)
|
||||
* = 总树数 * 22617
|
||||
*/
|
||||
private async getContributionStats() {
|
||||
const [accounts, systemContributions, adoptionStats] = await Promise.all([
|
||||
|
|
@ -147,22 +152,31 @@ export class DashboardService {
|
|||
}),
|
||||
]);
|
||||
|
||||
const totalTrees = adoptionStats._sum.treeCount || 0;
|
||||
|
||||
// 有效算力 = 理论总算力 = 总树数 * 22617
|
||||
// 因为按照公式,有效算力包含所有部分(个人70%+运营12%+省1%+市2%+层级7.5%+团队7.5%=100%)
|
||||
const effectiveContribution = BASE_CONTRIBUTION_PER_TREE.mul(totalTrees);
|
||||
|
||||
// 个人算力(已分配到用户账户)
|
||||
const personalContribution = new Decimal(accounts._sum.personalContribution || 0);
|
||||
|
||||
// 系统账户算力(运营+省+市)
|
||||
const systemContribution = new Decimal(systemContributions._sum.contributionBalance || 0);
|
||||
|
||||
return {
|
||||
totalAccounts: accounts._count,
|
||||
totalContribution: accounts._sum.totalContribution?.toString() || '0',
|
||||
effectiveContribution:
|
||||
accounts._sum.effectiveContribution?.toString() || '0',
|
||||
personalContribution:
|
||||
accounts._sum.personalContribution?.toString() || '0',
|
||||
effectiveContribution: effectiveContribution.toString(),
|
||||
personalContribution: personalContribution.toString(),
|
||||
teamLevelContribution:
|
||||
accounts._sum.teamLevelContribution?.toString() || '0',
|
||||
teamBonusContribution:
|
||||
accounts._sum.teamBonusContribution?.toString() || '0',
|
||||
systemAccounts: systemContributions._count,
|
||||
systemContribution:
|
||||
systemContributions._sum.contributionBalance?.toString() || '0',
|
||||
systemContribution: systemContribution.toString(),
|
||||
totalAdoptions: adoptionStats._count,
|
||||
totalTrees: adoptionStats._sum.treeCount || 0,
|
||||
totalTrees,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue