From b5eee37b0a1e6ab5522c8f27fa1c7093a1b9aa12 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 3 Apr 2022 09:56:24 +0800 Subject: [PATCH] 1 --- webapp/controller/BcShopController.class.php | 11 ------- webapp/controller/MarketController.class.php | 31 ++++++++++++-------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/webapp/controller/BcShopController.class.php b/webapp/controller/BcShopController.class.php index dd2a2b76..f62a2dba 100644 --- a/webapp/controller/BcShopController.class.php +++ b/webapp/controller/BcShopController.class.php @@ -1,9 +1,6 @@ fillPresaleBox($currBatchMeta, $meta); + if ($saleBox) { ++$pageInfo['total']; if ($pageInfo['total'] > $startPos && count($rows) < $pageInfo['per_page']) { @@ -368,20 +368,24 @@ class MarketController extends BaseController { MarketService::auth($account, $tips, $nonce, $signature); } - private function fillPresaleBox() + private function fillPresaleBox($batchMeta, $goodsMeta) { - $boxId = phpcommon\genBoxId($currBatchMeta['id'], - $meta['id'], - $meta['item_id']); + $currencyMeta = mt\Currency::get($goodsMeta['currency_id']); + if (!$currencyMeta) { + return null; + } + $boxId = phpcommon\genBoxId($batchMeta['id'], + $goodsMeta['id'], + $goodsMeta['item_id']); - $itemMeta = mt\Item::get($meta['item_id']); - $heroMeta = mt\Hero::get($meta['item_id']); - $originalPrice = $meta['price'] * pow(10, MarketService::CURRENCY_DECIMALS); - $discountPrice = $meta['discount'] * 100 > 0 ? - $originalPrice * $meta['discount'] : $originalPrice; + $itemMeta = mt\Item::get($goodsMeta['item_id']); + $heroMeta = mt\Hero::get($goodsMeta['item_id']); + $originalPrice = $goodsMeta['price'] * pow(10, MarketService::CURRENCY_DECIMALS); + $discountPrice = $goodsMeta['discount'] * 100 > 0 ? + $originalPrice * $goodsMeta['discount'] : $originalPrice; $saleBox = array( 'box_id' => $boxId, - 'item_id' => $meta['item_id'], + 'item_id' => $goodsMeta['item_id'], 'name' => emptyReplace($heroMeta['name'], 'Hill'), 'job' => emptyReplace($heroMeta['herotype'], '1'), //'avatar_url' => 'https://www.cebg.games/res/avatars/' . $itemMeta['nft_image_id'] . '.png', @@ -390,11 +394,12 @@ class MarketController extends BaseController { 'name' => $currencyMeta['name'], 'original_price' => $originalPrice, 'discount_price' => $discountPrice, - 'discount_rate' => $meta['discount'], + 'discount_rate' => $goodsMeta['discount'], 'decimals' => MarketService::CURRENCY_DECIMALS, 'contract_address' => $currencyMeta['address'], ) )); + return $saleBox; } }