From 92b90f2b2a4a02d8ac6df4f222dde3e421b0280c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 5 Jun 2023 11:56:26 +0800 Subject: [PATCH] ... --- webapp/controller/MarketController.class.php | 4 ++-- webapp/controller/ShopController.class.php | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/webapp/controller/MarketController.class.php b/webapp/controller/MarketController.class.php index 31d2a2db..4f017c75 100644 --- a/webapp/controller/MarketController.class.php +++ b/webapp/controller/MarketController.class.php @@ -875,8 +875,8 @@ class MarketController extends BaseController { $durability_filter = getReqVal('durability_filter', 0); $rows = $this->getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job_filter_array, $search_filter_array, $lv_filter, $quality_filter, $durability_filter); - - $total = count($rows); + + $total = count($rows); $page_end = $start + $page_size; if ($page_end > $total) { $page_end = $total; diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index b12f81aa..39002d06 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -76,6 +76,9 @@ class ShopController extends BaseAuthedController } break; } + if (empty($goods['goods_num'])) { + $goods['goods_num'] = 1; + } } $this->_rspData( @@ -117,6 +120,9 @@ class ShopController extends BaseAuthedController return; } + // 这里命名混乱了, 购买个数,一捆个数命名冲突 + $goods_count = $row['goods_num']; + $buyRecordHash = ShopBuyRecord::allToHash(); $boughtTimes = 1; switch ($row['limit_type']) { @@ -194,7 +200,7 @@ class ShopController extends BaseAuthedController $itemMeta = mt\Item::get($row['goods_id']); $propertyChgService = new services\PropertyChgService(); for ($i = 0; $i < $goods_num; $i++) { - $this->internalAddItem($propertyChgService, $itemMeta); + $this->internalAddItem($propertyChgService, $itemMeta, $goods_count); } $awardService = new services\AwardService(); $awardService->addItem($row['goods_id'], $goods_num); @@ -441,7 +447,7 @@ class ShopController extends BaseAuthedController return; } $this->_decItems($costItems); - $this->internalAddItem($propertyChgService, $itemMeta); + $this->internalAddItem($propertyChgService, $itemMeta, 1); $awardService = new services\AwardService(); $awardService->addItem($itemId, $itemNum); ShopBuyRecord::add($itemId, $itemNum); @@ -575,7 +581,7 @@ class ShopController extends BaseAuthedController return; } $this->_decItems($costItems); - $this->internalAddItem($propertyChgService, $itemMeta); + $this->internalAddItem($propertyChgService, $itemMeta, 1); $awardService = new services\AwardService(); $awardService->addItem($itemId, $itemNum); ShopBuyRecord::add($itemId, $itemNum); @@ -690,7 +696,7 @@ class ShopController extends BaseAuthedController return $costItems; } - private function internalAddItem($propertyChgService, $itemMeta) + private function internalAddItem($propertyChgService, $itemMeta, $count) { switch ($itemMeta['type']) { case mt\Item::HERO_TYPE: { @@ -720,7 +726,7 @@ class ShopController extends BaseAuthedController } break; default: { - Bag::addItem($itemMeta['id'], 1); + Bag::addItem($itemMeta['id'], $count); $propertyChgService->addBagChg(); } break;