diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index cabb366f..ef5729af 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -37,31 +37,18 @@ class MarketController extends BaseController { $account = getReqVal('account', ''); $currBatchMeta = mt\MarketBatch::getCurrentBatch(); if (!$currBatchMeta) { - $title = $this->escapeString( - mt\Parameter::getVal('pre_sale_not_started_title', '')); - $hint = $this->escapeString( - mt\Parameter::getVal('pre_sale_not_started_hint', '')); - $presaleInfo = array( - 'batch_id' => 0, - 'countdown' => 0, - 'sold_num' => 0, - 'total_num' => 0, - 'state' => self::PRESALE_NOT_STARTED, - 'title' => $title, - 'hint' => $hint, - 'buyable_list' => array(), - //'buyed' => 0 - ); myself()->_rspData(array( - 'presale_info' => $presaleInfo + 'presale_info' => $this->getDefaultPresaleInfo() )); return; } $countdown = mt\MarketBatch::getCountdown($currBatchMeta); - $soldNum = min(BoxOrder::getSoldNum($currBatchMeta['id']), $currBatchMeta['number_of_props']); + $soldNum = min(BoxOrder::getSoldNum($currBatchMeta['id']), + $currBatchMeta['number_of_props']); $totalNum = $currBatchMeta['number_of_props']; - $buyed = MarketService::isTestMode() ? 0 : BoxOrder::isBuyed($account, $currBatchMeta['id']); + $buyed = MarketService::isTestMode() ? + 0 : BoxOrder::isBuyed($account, $currBatchMeta['id']); $title = ''; $state = self::PRESALE_PREPARE; if ($countdown > 0) { @@ -465,4 +452,24 @@ class MarketController extends BaseController { MarketService::auth($account, $tips, $nonce, $signature); } + private function getDefaultPresaleInfo() + { + $title = $this->escapeString( + mt\Parameter::getVal('pre_sale_not_started_title', '')); + $hint = $this->escapeString( + mt\Parameter::getVal('pre_sale_not_started_hint', '')); + $presaleInfo = array( + 'batch_id' => 0, + 'countdown' => 0, + 'sold_num' => 0, + 'total_num' => 0, + 'state' => self::PRESALE_NOT_STARTED, + 'title' => $title, + 'hint' => $hint, + 'buyable_list' => array(), + //'buyed' => 0 + ); + return $presaleInfo; + } + }