fix(batch-mining): 最后批次preMineDays=0时改为1天

最后一个批次即使 preMineDays=0,也要算1天(所有人一起挖1天生成收益)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-21 23:37:35 -08:00
parent d98e22f151
commit 0adc4c8c26
1 changed files with 9 additions and 2 deletions

View File

@ -392,14 +392,21 @@ export class BatchMiningService {
// 阶段1: 只有第一批,分配第一批的 preMineDays 天
// 阶段2: 第一批+第二批,分配第二批的 preMineDays 天
// 阶段3: 第一批+第二批+第三批,分配第三批的 preMineDays 天
// ...依次类推,总天数 = 所有 preMineDays 之和
// ...依次类推
// 最后一个批次即使 preMineDays=0也要算1天所有人一起挖1天
for (let i = 0; i < sortedBatches.length; i++) {
const currentBatch = sortedBatches[i];
const currentPreMineDays = batchPreMineDays.get(currentBatch) || 0;
let currentPreMineDays = batchPreMineDays.get(currentBatch) || 0;
// 当前批次加入参与列表
participatingBatches.push(currentBatch);
// 最后一个批次如果 preMineDays=0改为1天
const isLastBatch = i === sortedBatches.length - 1;
if (isLastBatch && currentPreMineDays === 0) {
currentPreMineDays = 1;
}
// 该阶段持续天数 = 当前批次的 preMineDays
if (currentPreMineDays > 0) {
// 计算该阶段参与用户的总算力