This commit is contained in:
azw 2023-08-27 16:08:06 +08:00
parent 9e747116a5
commit d238a699e9

View File

@ -164,6 +164,29 @@ class Staking extends BaseModel {
}
}
public static function toDto($row)
{
$dto = array(
'token_id' => $row['token_id'],
'token_type' => $row['token_type'],
'contract_address' => $row['contract_address'],
'net_id' => $row['net_id'],
'start_time' => $row['start_time'],
'stake_time' => $row['stake_time'],
'txhash' => $row['txhash'],
'item_id' => $row['item_id'],
);
$yesterDay = myself()->_getNowDaySeconds() - 3600 * 24;
$passedDays = intval((myself()->_getNowDaySeconds() -
myself()->_getDaySeconds($row['start_time'])) /
3600 / 24);
$saveDays = intval($row['stake_time'] / 3600 / 24);
$dto['stacked_days'] = max(0, $passedDays);
$dto['remain_days'] = max(0, $saveDays - $dto['stacked_days']);
return $dto;
}
public static function calcReward($row, &$reward)
{
$reward = 0;