From bb0656a29390fd84d3e00386bb532ebb47bffcb7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 25 Aug 2023 19:23:05 +0800 Subject: [PATCH] 1 --- webapp/models/Staking.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/webapp/models/Staking.php b/webapp/models/Staking.php index 83a76420..57a3dc12 100644 --- a/webapp/models/Staking.php +++ b/webapp/models/Staking.php @@ -170,13 +170,42 @@ class Staking extends BaseModel { if (!$stakingMeta) { return false; } + $stakingValue = $stakingMeta['stake_value']; + $realValue = $stakingValue / self::getCecPrice(); if ($row['stake_time'] >= 3600 * 24 * 30 * 12 * 2) { - } else if ($row['stake_time'] <= 3600 * 24 * 30 * 1) { + } else if ($row['stake_time'] <= 3600 * 24 * 30 * 12 * 1) { } else { return false; } return true; } + public static function getCecPrice() + { + return 1; + } + + public static function getDailyInterest($stakeTime) + { + $months = intval($stakeTime / 3600 / 24 / 30); + if ($months <= 0) { + return 0; + } + //1 3 6 12 24 + if ($months <= 1) { + return 0.01 / 30 * $months; + } else if ($months <= 3) { + return 0.05 / 30 * $months; + } else if ($months <= 6) { + return 0.15 / 30 * $months; + } else if ($months <= 12) { + return 0.4 / 30 * $months; + } else if ($months <= 24) { + return 1 / 30 * $months; + } else { + return 0; + } + } + }