From 162210ea2eb2d34e11030c48c9f8c7b27d8e832f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 29 Aug 2023 11:42:02 +0800 Subject: [PATCH] 1 --- webapp/controller/StakingController.class.php | 6 ++---- webapp/models/Staking.php | 16 +++++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/webapp/controller/StakingController.class.php b/webapp/controller/StakingController.class.php index fcdf2e64..553e8630 100644 --- a/webapp/controller/StakingController.class.php +++ b/webapp/controller/StakingController.class.php @@ -55,10 +55,8 @@ class StakingController extends BaseAuthedController { if ($stakingDto['remain_days'] <= 0) { $stackingInfo['maturity_quant'] += $stakingDto['stacked_num']; } else { - $stackingInfo['daily_rewards'] += $stakingDto['cec_value'] * - $stakingDto['daily_rewards']; - $info['daily_staking_value'] += $stakingDto['cec_value'] * - $stakingDto['daily_rewards']; + $stackingInfo['daily_rewards'] += $stakingDto['daily_rewards']; + $info['daily_staking_value'] += $stakingDto['daily_rewards']; } $stackingInfo['staked_quant'] += $stakingDto['stacked_num']; $stackingInfo['staking_value'] += $stakingDto['cec_value']; diff --git a/webapp/models/Staking.php b/webapp/models/Staking.php index dcfe9cbf..91157589 100644 --- a/webapp/models/Staking.php +++ b/webapp/models/Staking.php @@ -215,6 +215,12 @@ class Staking extends BaseModel { $dto['stacked_days'] = max(0, $passedDays); $dto['remain_days'] = max(0, $saveDays - $dto['stacked_days']); $dto['daily_rewards'] = $dto['cec_value'] * $dailyInterest; + /* + error_log(json_encode(array( + 'remain_days' => max(0, $saveDays - $dto['stacked_days']), + 'daily_rewards' => $dto['daily_rewards'], + 'daily_interest' => $dailyInterest + )));*/ if ($dto['remain_days'] <= 0 ) { $dto['cec_rewards'] = $dto['daily_rewards'] * $saveDays; $dto['total_rewards'] = $dto['daily_rewards'] * $saveDays; @@ -238,15 +244,15 @@ class Staking extends BaseModel { } //1 3 6 12 24 if ($months <= 1) { - return 0.01 / 30 * $months; + return 0.01 / 30 / $months; } else if ($months <= 3) { - return 0.05 / 30 * $months; + return 0.05 / 30 / $months; } else if ($months <= 6) { - return 0.15 / 30 * $months; + return 0.15 / 30 / $months; } else if ($months <= 12) { - return 0.4 / 30 * $months; + return 0.4 / 30 / $months; } else if ($months <= 24) { - return 1 / 30 * $months; + return 1 / 30 / $months; } else { return 0; }