This commit is contained in:
aozhiwei 2023-08-29 11:42:02 +08:00
parent 00c6c95eef
commit 162210ea2e
2 changed files with 13 additions and 9 deletions

View File

@ -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'];

View File

@ -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;
}