1
This commit is contained in:
parent
1120c295a8
commit
f881a6c173
@ -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'];
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user