diff --git a/backend/services/mining-service/src/application/services/batch-mining.service.ts b/backend/services/mining-service/src/application/services/batch-mining.service.ts index 5edf8deb..d8bb34e4 100644 --- a/backend/services/mining-service/src/application/services/batch-mining.service.ts +++ b/backend/services/mining-service/src/application/services/batch-mining.service.ts @@ -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) { // 计算该阶段参与用户的总算力