diff --git a/webapp/models/Staking.php b/webapp/models/Staking.php index b08862b5..f309058d 100644 --- a/webapp/models/Staking.php +++ b/webapp/models/Staking.php @@ -248,14 +248,16 @@ class Staking extends BaseModel { } $dto['total_rewards'] = $dto['cec_rewards']; } else { + $stakedDays = max($stakedDays, 0); + $stakedDays = min($stakedDays, $saveDays); if ($dto['remain_days'] <= 0 ) { - $dto['cec_rewards'] = $srcDailyRewards * $saveDays; + $dto['cec_rewards'] = $srcDailyRewards * $stakedDays; } else { if ($saveDays >= 30 * 12 * 2) { $dto['cec_rewards'] = $srcDailyRewards * min(30 * 12, $stakedDays) * 0.6; $dto['cec_rewards'] += $srcDailyRewards * max(0, $stakedDays - 30 * 12) * 0.4; } else { - $dto['cec_rewards'] = $dto['daily_rewards'] * ($saveDays - $dto['remain_days']); + $dto['cec_rewards'] = $dto['daily_rewards'] * $stakedDays; } } $dto['total_rewards'] = $dto['cec_rewards'];