From 6e4d821a30d98a718c5ed3272b02c6ba2fe45f63 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 25 Jan 2022 20:08:13 +0800 Subject: [PATCH] 1 --- webapp/controller/NewMarketController.class.php | 8 ++++++-- webapp/models/Box.php | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/webapp/controller/NewMarketController.class.php b/webapp/controller/NewMarketController.class.php index 0e6a1797..b298855b 100644 --- a/webapp/controller/NewMarketController.class.php +++ b/webapp/controller/NewMarketController.class.php @@ -7,12 +7,16 @@ require_once('mt/WhiteList.php'); require_once('mt/Currency.php'); require_once('mt/Hero.php'); +require_once('models/Box.php'); + use phpcommon\SqlHelper; +use models\Box; class NewMarketController extends BaseController { public function searchBox() { + $account = getReqVal('account', ''); $page = getReqVal('page', 1); $type = getReqVal('type', 0); $sort = getReqVal('sort', ''); @@ -35,10 +39,10 @@ class NewMarketController extends BaseController { $presaleInfo = array( 'batch_id' => $currBatchMeta['batch_id'], 'countdown' => max(0, $currBatchMeta['_start_time_utc'] - myself()->_getNowTime()), - 'sold_num' => 0, + 'sold_num' => min(Box::getSoldNum($currBatchMeta['batch_id']), $currBatchMeta['number_of_props']), 'inventory_num' => $currBatchMeta['number_of_props'], 'hint' => str_replace("\n", '\n', $currBatchMeta['hint']), - 'buyed' => rand() % 2 < 1 ? 0 : 1 + 'buyed' => Box::isBuyed($account, $currBatchMeta['batch_id']) ); $batchMetas = mt\MarketGoods::getBatchMetas($currBatchMeta['batch_id']); diff --git a/webapp/models/Box.php b/webapp/models/Box.php index 38bd6d68..744c6ab9 100644 --- a/webapp/models/Box.php +++ b/webapp/models/Box.php @@ -9,7 +9,12 @@ class Box extends BaseModel { public function getSoldNum($batchId) { + return 0; + } + public function isBuyed($buyerAddress, $batchId) + { + return 0; } }