This commit is contained in:
aozhiwei 2023-08-26 08:56:25 +08:00
parent fee9be2d72
commit 55f0fb10f9

View File

@ -17,43 +17,26 @@ class StackingController extends BaseAuthedController {
$info = array( $info = array(
'total_staking_value' => '0', 'total_staking_value' => '0',
'daily_staking_value' => '0', 'daily_staking_value' => '0',
'planet' => array( 'planet' => array(),
'type' => self::PLANET_TYPE, 'badge' => array(),
'is_open' => 1, 'cec' => array(),
'staked_quant' => 0,
'claim_rewards' => 0,
'daily_rewards' => 0,
'staking_value' => 0,
'maturity_quant' => 0,
),
'badge' => array(
'type' => self::BADGE_TYPE,
'is_open' => 1,
'staked_quant' => 0,
'claim_rewards' => 0,
'daily_rewards' => 0,
'staking_value' => 0,
'maturity_quant' => 0,
),
'cec' => array(
'type' => self::CEC_TYPE,
'is_open' => 0,
'staked_quant' => 0,
'claim_rewards' => 0,
'daily_rewards' => 0,
'staking_value' => 0,
'maturity_quant' => 0,
),
); );
$rows = Stacking::all(myself()->_getAddress()); $rows = Stacking::all(myself()->_getAddress());
$this->fillStackingInfo($info['planet'], $rows); $this->fillStackingInfo($info['planet'], self::PLANET_TYPE, 1, $rows);
$this->fillStackingInfo($info['badge'], $rows); $this->fillStackingInfo($info['badge'], self::BADGE_TYPE, 1, $rows);
$this->fillStackingInfo($info['cec'], $rows); $this->fillStackingInfo($info['cec'], self::CEC_TYPE, 1, $rows);
myself()->_rspData($info); myself()->_rspData($info);
} }
private function fillStackingInfo($info, $rows) private function fillStackingInfo(&$info, $type, $isOpen, $rows)
{ {
$info['type'] = $type;
$info['is_open'] = $isOpen;
$info['staked_quant'] = 0;
$info['claim_rewards'] = 0;
$info['daily_rewards'] = 0;
$info['staking_value'] = 0;
$info['maturity_quant'] = 0;
foreach ($rows as $row) { foreach ($rows as $row) {
if (!$this->isTypeNft($info['type'], $row)) { if (!$this->isTypeNft($info['type'], $row)) {
continue; continue;