diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 1a39685a..aaa8bbb0 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -85,6 +85,11 @@ class MarketController extends BaseController { foreach ($batchMetas as $meta) { $heroMeta = mt\Hero::get($meta['item_id']); $boxId = phpcommon\genBoxId($currBatchMeta['batch_id'], $meta['id'], $meta['item_id']); + $currencyMeta = mt\Currency::get($meta['currency_id']); + if (!$currencyMeta) { + myself()->_rspErr(500, 'server internal error'); + return; + } $saleBox = array( 'box_id' => $boxId, 'item_id' => $meta['item_id'], @@ -92,11 +97,12 @@ class MarketController extends BaseController { 'job' => emptyReplace($heroMeta['herotype'], '1'), 'currency_list' => array( array( - 'name' => 'BNB', - 'original_price' => 100, - 'discount_price' => 80, - 'discount_rate' => 80, - 'contract_address' => '0xCfEB869F69431e42cdB54A4F4f105C19C080A601', + 'name' => $currencyMeta['name'], + 'original_price' => $meta['price'], + 'discount_price' => $meta['discount'] > 0 ? + $meta['price'] * ($meta['discount'] / 100) : $meta['price'], + 'discount_rate' => $meta['discount'], + 'contract_address' => $currencyMeta['address'], ) ) ); diff --git a/webapp/mt/Currency.php b/webapp/mt/Currency.php index bfd99c91..e80f049c 100644 --- a/webapp/mt/Currency.php +++ b/webapp/mt/Currency.php @@ -17,7 +17,7 @@ class Currency { protected static function getMetaList() { if (!self::$metaList) { - self::$metaList = getMetaTable('currence@currence.php'); + self::$metaList = getMetaTable('currency@currency.php'); } return self::$metaList; }