diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index c8f08766..9fa8c190 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -56,14 +56,26 @@ class MarketController extends BaseController { $countdown = max(0, $currBatchMeta['start_time'] - myself()->_getNowTime()); $soldNum = min(BoxOrder::getSoldNum($currBatchMeta['id']), $currBatchMeta['number_of_props']); + $totalNum = $currBatchMeta['number_of_props']; $buyed = $this->isTestMode() ? 0 : BoxOrder::isBuyed($account, $currBatchMeta['id']); $title = ''; - $state = 0; + $state = PRESALE_PREPARE; + if ($countdown > 0) { + $state = PRESALE_PREPARE; + } else { + if ($soldNum >= $totalNum) { + $title = $this->escapeString($currBatchMeta['end_title']); + $state = PRESALE_SOLD_OUT; + } else { + $title = $this->escapeString($currBatchMeta['begin_title']); + $state = PRESALE_STARTED; + } + } $presaleInfo = array( 'batch_id' => $currBatchMeta['batch_id'], 'countdown' => $countdown, 'sold_num' => $soldNum, - 'total_num' => $currBatchMeta['number_of_props'], + 'total_num' => $totalNum, 'state' => $state, 'title' => $title, 'hint' => $this->escapeString($currBatchMeta['hint']),