This commit is contained in:
aozhiwei 2023-08-30 13:40:04 +08:00
parent 6d03d0f648
commit aa656832a5
2 changed files with 13 additions and 2 deletions

View File

@ -49,7 +49,7 @@ class BaseController {
public function _getNowDaySeconds()
{
return $this->_getDaySeconds($this->nowtime);
return $this->_getDaySeconds($this->_getNowTime());
}
public function _getDaySeconds($time)

View File

@ -225,9 +225,20 @@ class Staking extends BaseModel {
$dto['cec_rewards'] = 0;
$dto['total_rewards'] = 0;
if ($dto['status'] == self::REDEEM_STATUS) {
$stakedDays = intval(($dto['redeem_time'] - myself()->_getDaySeconds($row['start_time']) - 3600 * 24) / 3600 / 24);
$stakedDays = intval((myself()->_getDaySeconds($dto['redeem_time']) -
(myself()->_getDaySeconds($row['start_time']) + 3600 * 24)) / 3600 / 24);
$stakedDays = max($stakedDays, 0);
$stakedDays = min($stakedDays, $saveDays);
$dto['stacked_days'] = $stakedDays;
/*
if ($dto['stacked_days'] <= 0) {
error_log(json_encode(array(
'src_stacked_days' => $stakedDays,
'now_daySeocnds' => myself()->_getNowDaySeconds(),
'now_time' => myself()->_getNowTime(),
'redeem_time' => myself()->_getDaySeconds($dto['redeem_time'])
)));
}*/
if ($saveDays >= 30 * 12 * 2) {
$stakedDays = max($stakedDays, 0);
$dto['cec_rewards'] = ($dto['cec_value'] * (0.6 / 30 / 12)) * min(30 * 12, $stakedDays) * 0.25;