From f881a6c173cbcf184ef6524458bc7f54e1071a9d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 28 Aug 2023 10:00:43 +0800 Subject: [PATCH] 1 --- webapp/controller/StakingController.class.php | 8 ++--- webapp/models/Staking.php | 31 ------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/webapp/controller/StakingController.class.php b/webapp/controller/StakingController.class.php index fef40f5e..8f2dafbe 100644 --- a/webapp/controller/StakingController.class.php +++ b/webapp/controller/StakingController.class.php @@ -50,13 +50,13 @@ class StackingController extends BaseAuthedController { if ($this->isTypeNft($stackingInfo['type'], $row) && $stakingMeta) { $stakingDto = Staking::toDto($row); if ($stakingDto['status'] == Stacking::STAKING_STATUS) { - if ($stakingDto['start_time'] + $stakingDto['stake_time'] < myself()->_getNowTime()) { - $stackingInfo['staked_quant'] += $stakingDto['stacked_num']; - } else { + if ($stakingDto['remain_days'] <= 0) { $stackingInfo['maturity_quant'] += $stakingDto['stacked_num']; + } else { + $stackingInfo['daily_rewards'] += $stakingMeta['daily_rewards']; } + $stackingInfo['staked_quant'] += $stakingDto['stacked_num']; $stackingInfo['staking_value'] += $stakingMeta['stake_value']; - $stackingInfo['daily_rewards'] += $stakingMeta['daily_rewards']; } else { $stackingInfo['claim_rewards'] += $stakingMeta['total_rewards']; } diff --git a/webapp/models/Staking.php b/webapp/models/Staking.php index 15456cab..0a420cb7 100644 --- a/webapp/models/Staking.php +++ b/webapp/models/Staking.php @@ -198,37 +198,6 @@ class Staking extends BaseModel { return $dto; } - public static function calcReward($row, &$reward) - { - $reward = 0; - $stakingMeta = mt\Staking::get($row['item_id']); - if (!$stakingMeta) { - return false; - } - $stakingValue = $stakingMeta['stake_value']; - $realValue = $stakingValue / self::getCecPrice(); - $dailyInterest = self::getDailyInterest($row['stake_time']); - $passedDays = myself()->_getNowTime() - $row['start_time']; - $saveDays = intval($row['stake_time'] / 3600 / 24); - if ($row['stake_time'] >= 3600 * 24 * 30 * 12 * 2) { - - } else if ($row['stake_time'] <= 3600 * 24 * 30 * 12 * 1) { - if ($row['redeem_time'] > 0) { - $redeemDays = intval(($row['redeem_time'] - $row['start_time']) / 3600 / 24); - if ($redeemDays < $saveDays) { - - } else { - $reward = $realValue * min($passedDays, $redeemDays) * $dailyInterest; - } - } else { - $reward = $realValue * min($passedDays, $saveDays) * $dailyInterest; - } - } else { - return false; - } - return true; - } - public static function getCecPrice() { return 1;