fix(mining): 为 HEADQUARTERS 账户添加每分钟挖矿记录
HEADQUARTERS 的挖矿收益来自待解锁算力,之前只更新了账户余额, 但没有写入 system_mining_records 表的每分钟汇总记录。 现在在两个分发路径中都为 HEADQUARTERS 调用 accumulateSystemMinuteData, 确保前端能正确显示总部账户的挖矿记录。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1d5e3ebff2
commit
5fa0fd5d1a
|
|
@ -193,6 +193,27 @@ export class MiningDistributionService {
|
|||
secondDistribution,
|
||||
);
|
||||
}
|
||||
|
||||
// 为 HEADQUARTERS 累积待解锁算力的挖矿数据
|
||||
if (result.pendingRedisData.length > 0) {
|
||||
const headquartersTotalReward = result.pendingRedisData.reduce(
|
||||
(sum, data) => sum.add(data.reward),
|
||||
new ShareAmount(0),
|
||||
);
|
||||
const headquartersTotalContribution = result.pendingRedisData.reduce(
|
||||
(sum, data) => sum.add(new ShareAmount(data.pending.amount)),
|
||||
new ShareAmount(0),
|
||||
);
|
||||
await this.accumulateSystemMinuteData(
|
||||
SystemAccountType.HEADQUARTERS,
|
||||
currentMinute,
|
||||
headquartersTotalReward,
|
||||
headquartersTotalContribution,
|
||||
networkTotalContribution,
|
||||
secondDistribution,
|
||||
);
|
||||
}
|
||||
|
||||
for (const data of result.pendingRedisData) {
|
||||
await this.accumulatePendingMinuteData(
|
||||
data.pendingId,
|
||||
|
|
@ -435,6 +456,26 @@ export class MiningDistributionService {
|
|||
);
|
||||
}
|
||||
|
||||
// 为 HEADQUARTERS 累积待解锁算力的挖矿数据
|
||||
if (pendingRewards.length > 0) {
|
||||
const headquartersTotalReward = pendingRewards.reduce(
|
||||
(sum, { reward }) => sum.add(reward),
|
||||
new ShareAmount(0),
|
||||
);
|
||||
const headquartersTotalContribution = pendingRewards.reduce(
|
||||
(sum, { pending }) => sum.add(new ShareAmount(pending.amount)),
|
||||
new ShareAmount(0),
|
||||
);
|
||||
await this.accumulateSystemMinuteData(
|
||||
SystemAccountType.HEADQUARTERS,
|
||||
currentMinute,
|
||||
headquartersTotalReward,
|
||||
headquartersTotalContribution,
|
||||
networkTotalContribution,
|
||||
secondDistribution,
|
||||
);
|
||||
}
|
||||
|
||||
for (const { pending, reward } of pendingRewards) {
|
||||
await this.accumulatePendingMinuteData(
|
||||
pending.id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue