feat(mining-admin): show pending contribution in dashboard
- Add networkPendingContribution and networkBonusPendingContribution to API - Display combined pending contribution (teamLevel + teamBonus) in stats card - Replace 'total contribution' with 'pending contribution' in price overview Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
81a58edaca
commit
b310fde426
|
|
@ -19,6 +19,7 @@ import { SnapshotService } from './services/snapshot.service';
|
|||
import { GetContributionAccountQuery } from './queries/get-contribution-account.query';
|
||||
import { GetContributionStatsQuery } from './queries/get-contribution-stats.query';
|
||||
import { GetContributionRankingQuery } from './queries/get-contribution-ranking.query';
|
||||
import { GetPlantingLedgerQuery } from './queries/get-planting-ledger.query';
|
||||
|
||||
// Schedulers
|
||||
import { ContributionScheduler } from './schedulers/contribution.scheduler';
|
||||
|
|
@ -46,6 +47,7 @@ import { ContributionScheduler } from './schedulers/contribution.scheduler';
|
|||
GetContributionAccountQuery,
|
||||
GetContributionStatsQuery,
|
||||
GetContributionRankingQuery,
|
||||
GetPlantingLedgerQuery,
|
||||
|
||||
// Schedulers
|
||||
ContributionScheduler,
|
||||
|
|
@ -57,6 +59,7 @@ import { ContributionScheduler } from './schedulers/contribution.scheduler';
|
|||
GetContributionAccountQuery,
|
||||
GetContributionStatsQuery,
|
||||
GetContributionRankingQuery,
|
||||
GetPlantingLedgerQuery,
|
||||
],
|
||||
})
|
||||
export class ApplicationModule {}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ export class DashboardController {
|
|||
adoptedUsers: raw.users?.adopted || 0,
|
||||
networkEffectiveContribution: raw.contribution?.effectiveContribution || '0',
|
||||
networkTotalContribution: raw.contribution?.totalContribution || '0',
|
||||
networkPendingContribution: raw.contribution?.teamLevelContribution || '0',
|
||||
networkBonusPendingContribution: raw.contribution?.teamBonusContribution || '0',
|
||||
totalDistributed: raw.mining?.totalMined || '0',
|
||||
totalBurned: raw.mining?.latestDailyStat?.totalBurned || '0',
|
||||
circulationPool: raw.trading?.circulationPool?.totalShares || '0',
|
||||
|
|
|
|||
|
|
@ -54,8 +54,15 @@ export function PriceOverview() {
|
|||
<p className="text-sm font-medium">{formatCompactNumber(stats?.networkEffectiveContribution)}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground">总算力</p>
|
||||
<p className="text-sm font-medium">{formatCompactNumber(stats?.networkTotalContribution)}</p>
|
||||
<p className="text-xs text-muted-foreground">待解锁</p>
|
||||
<p className="text-sm font-medium">
|
||||
{formatCompactNumber(
|
||||
String(
|
||||
Number(stats?.networkPendingContribution || 0) +
|
||||
Number(stats?.networkBonusPendingContribution || 0)
|
||||
)
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs text-muted-foreground">认种用户</p>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,12 @@ export function StatsCards() {
|
|||
{
|
||||
title: '全网算力',
|
||||
value: formatCompactNumber(stats?.networkEffectiveContribution),
|
||||
subValue: `总算力: ${formatCompactNumber(stats?.networkTotalContribution)}`,
|
||||
subValue: `待解锁: ${formatCompactNumber(
|
||||
String(
|
||||
Number(stats?.networkPendingContribution || 0) +
|
||||
Number(stats?.networkBonusPendingContribution || 0)
|
||||
)
|
||||
)}`,
|
||||
icon: Activity,
|
||||
iconColor: 'text-blue-500',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ export interface DashboardStats {
|
|||
adoptedUsers: number;
|
||||
networkEffectiveContribution: string;
|
||||
networkTotalContribution: string;
|
||||
networkPendingContribution: string;
|
||||
networkBonusPendingContribution: string;
|
||||
totalDistributed: string;
|
||||
totalBurned: string;
|
||||
circulationPool: string;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class ApiEndpoints {
|
|||
static String contributionRecords(String accountSequence) =>
|
||||
'/api/v2/contribution/accounts/$accountSequence/records';
|
||||
|
||||
// User Service 2.0 (Kong路由: /api/v2/users)
|
||||
// Planting Ledger (Kong路由: /api/v2/contribution)
|
||||
static String plantingLedger(String accountSequence) =>
|
||||
'/api/v2/users/$accountSequence/planting-ledger';
|
||||
'/api/v2/contribution/accounts/$accountSequence/planting-ledger';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue