1
This commit is contained in:
parent
75b41c7ce4
commit
5722c46f54
@ -31,30 +31,30 @@ class StackingController extends BaseAuthedController {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
$rows = Stacking::all(myself()->_getAddress());
|
$rows = Stacking::all(myself()->_getAddress());
|
||||||
$this->fillStackingInfo($info['planet'], $rows);
|
$this->fillStackingInfo($info, 'planet', $rows);
|
||||||
$this->fillStackingInfo($info['badge'], $rows);
|
$this->fillStackingInfo($info, 'badge', $rows);
|
||||||
$this->fillStackingInfo($info['cec'], $rows);
|
$this->fillStackingInfo($info, 'cec', $rows);
|
||||||
myself()->_rspData($info);
|
myself()->_rspData($info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fillStackingInfo(&$info, $rows)
|
private function fillStackingInfo(&$info, $rows)
|
||||||
{
|
{
|
||||||
$info['staked_quant'] = 0;
|
$stackingInfo['staked_quant'] = 0;
|
||||||
$info['claim_rewards'] = 0;
|
$stackingInfo['claim_rewards'] = 0;
|
||||||
$info['daily_rewards'] = 0;
|
$stackingInfo['daily_rewards'] = 0;
|
||||||
$info['staking_value'] = 0;
|
$stackingInfo['staking_value'] = 0;
|
||||||
$info['maturity_quant'] = 0;
|
$stackingInfo['maturity_quant'] = 0;
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
if ($this->isTypeNft($info['type'], $row) &&
|
if ($this->isTypeNft($stackingInfo['type'], $row) &&
|
||||||
$row['status'] == Stacking::STAKING_STATUS) {
|
$row['status'] == Stacking::STAKING_STATUS) {
|
||||||
if ($row['start_time'] + $row['stake_time'] < myself()->_getNowTime()) {
|
if ($row['start_time'] + $row['stake_time'] < myself()->_getNowTime()) {
|
||||||
$info['staked_quant'] += $row['stacked_num'];
|
$stackingInfo['staked_quant'] += $row['stacked_num'];
|
||||||
} else {
|
} else {
|
||||||
$info['maturity_quant'] += $row['stacked_num'];
|
$stackingInfo['maturity_quant'] += $row['stacked_num'];
|
||||||
}
|
}
|
||||||
$stakingMeta = mt\Staking::get($row['item_id']);
|
$stakingMeta = mt\Staking::get($row['item_id']);
|
||||||
if ($stakingMeta) {
|
if ($stakingMeta) {
|
||||||
$info['staking_value'] += $stakingMeta['stake_value'];
|
$stackingInfo['staking_value'] += $stakingMeta['stake_value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user