diff --git a/webapp/controller/StakingController.class.php b/webapp/controller/StakingController.class.php index f9e53f68..08df3e82 100644 --- a/webapp/controller/StakingController.class.php +++ b/webapp/controller/StakingController.class.php @@ -17,43 +17,26 @@ class StackingController extends BaseAuthedController { $info = array( 'total_staking_value' => '0', 'daily_staking_value' => '0', - 'planet' => array( - 'type' => self::PLANET_TYPE, - 'is_open' => 1, - '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, - ), + 'planet' => array(), + 'badge' => array(), + 'cec' => array(), ); $rows = Stacking::all(myself()->_getAddress()); - $this->fillStackingInfo($info['planet'], $rows); - $this->fillStackingInfo($info['badge'], $rows); - $this->fillStackingInfo($info['cec'], $rows); + $this->fillStackingInfo($info['planet'], self::PLANET_TYPE, 1, $rows); + $this->fillStackingInfo($info['badge'], self::BADGE_TYPE, 1, $rows); + $this->fillStackingInfo($info['cec'], self::CEC_TYPE, 1, $rows); 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) { if (!$this->isTypeNft($info['type'], $row)) { continue;