diff --git a/webapp/controller/ComputingPowerController.class.php b/webapp/controller/ComputingPowerController.class.php index 81f31566..e9b2b197 100644 --- a/webapp/controller/ComputingPowerController.class.php +++ b/webapp/controller/ComputingPowerController.class.php @@ -37,8 +37,13 @@ class ComputingPowerController extends BaseAuthedController "cec" => 0, "point" => 0, ); + $last_period = array( + "period_begin" => 0, + "period_end" => 0, + "reward" => 0, + ); - $lastMeta = \mt\HashRateCommon::getLastPeriod(); + $lastMeta = \mt\HashRateCommon::getLastPeriod(); $currentMeta = \mt\HashRateCommon::getCurrentPeriod(); $nextMeta = \mt\HashRateCommon::getNextPeriod(); if (!$currentMeta && $lastMeta){ @@ -80,12 +85,22 @@ class ComputingPowerController extends BaseAuthedController $reward['point'] = $ownerNum; } + if ($lastMeta){ + $last_period['period_begin'] = strtotime($lastMeta['start_time']); + $last_period['period_end'] = strtotime($lastMeta['end_time']); + $cecDb = RewardsCec::findByAccount(myself()->_getAccountId(),$lastMeta['id']); + $last_period['reward'] = $cecDb ? $cecDb['reward_cec'] : 0; + $last_period['last_hash_rate'] = ComputingPower::getOwnedBH($lastMeta['id']); + } + + $info = array( 'period_state' => $period_state, 'curr_period' => $curr_period, 'curr_reward' => $reward, + 'last_period' => $last_period, 'listing_state' => LISTING_SWITCH, 'owned_cec' => RewardsCec::getTotalCecNum(), 'owned_total_hash_rate' =>ComputingPower::getMyTotalBH(),