1
This commit is contained in:
parent
9e747116a5
commit
d238a699e9
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user