This commit is contained in:
aozhiwei 2023-06-05 11:56:26 +08:00
parent f3d5a2e26a
commit 92b90f2b2a
2 changed files with 13 additions and 7 deletions

View File

@ -876,7 +876,7 @@ class MarketController extends BaseController {
$rows = $this->getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job_filter_array, $search_filter_array, $lv_filter, $quality_filter, $durability_filter); $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; $page_end = $start + $page_size;
if ($page_end > $total) { if ($page_end > $total) {
$page_end = $total; $page_end = $total;

View File

@ -76,6 +76,9 @@ class ShopController extends BaseAuthedController
} }
break; break;
} }
if (empty($goods['goods_num'])) {
$goods['goods_num'] = 1;
}
} }
$this->_rspData( $this->_rspData(
@ -117,6 +120,9 @@ class ShopController extends BaseAuthedController
return; return;
} }
// 这里命名混乱了, 购买个数,一捆个数命名冲突
$goods_count = $row['goods_num'];
$buyRecordHash = ShopBuyRecord::allToHash(); $buyRecordHash = ShopBuyRecord::allToHash();
$boughtTimes = 1; $boughtTimes = 1;
switch ($row['limit_type']) { switch ($row['limit_type']) {
@ -194,7 +200,7 @@ class ShopController extends BaseAuthedController
$itemMeta = mt\Item::get($row['goods_id']); $itemMeta = mt\Item::get($row['goods_id']);
$propertyChgService = new services\PropertyChgService(); $propertyChgService = new services\PropertyChgService();
for ($i = 0; $i < $goods_num; $i++) { for ($i = 0; $i < $goods_num; $i++) {
$this->internalAddItem($propertyChgService, $itemMeta); $this->internalAddItem($propertyChgService, $itemMeta, $goods_count);
} }
$awardService = new services\AwardService(); $awardService = new services\AwardService();
$awardService->addItem($row['goods_id'], $goods_num); $awardService->addItem($row['goods_id'], $goods_num);
@ -441,7 +447,7 @@ class ShopController extends BaseAuthedController
return; return;
} }
$this->_decItems($costItems); $this->_decItems($costItems);
$this->internalAddItem($propertyChgService, $itemMeta); $this->internalAddItem($propertyChgService, $itemMeta, 1);
$awardService = new services\AwardService(); $awardService = new services\AwardService();
$awardService->addItem($itemId, $itemNum); $awardService->addItem($itemId, $itemNum);
ShopBuyRecord::add($itemId, $itemNum); ShopBuyRecord::add($itemId, $itemNum);
@ -575,7 +581,7 @@ class ShopController extends BaseAuthedController
return; return;
} }
$this->_decItems($costItems); $this->_decItems($costItems);
$this->internalAddItem($propertyChgService, $itemMeta); $this->internalAddItem($propertyChgService, $itemMeta, 1);
$awardService = new services\AwardService(); $awardService = new services\AwardService();
$awardService->addItem($itemId, $itemNum); $awardService->addItem($itemId, $itemNum);
ShopBuyRecord::add($itemId, $itemNum); ShopBuyRecord::add($itemId, $itemNum);
@ -690,7 +696,7 @@ class ShopController extends BaseAuthedController
return $costItems; return $costItems;
} }
private function internalAddItem($propertyChgService, $itemMeta) private function internalAddItem($propertyChgService, $itemMeta, $count)
{ {
switch ($itemMeta['type']) { switch ($itemMeta['type']) {
case mt\Item::HERO_TYPE: { case mt\Item::HERO_TYPE: {
@ -720,7 +726,7 @@ class ShopController extends BaseAuthedController
} }
break; break;
default: { default: {
Bag::addItem($itemMeta['id'], 1); Bag::addItem($itemMeta['id'], $count);
$propertyChgService->addBagChg(); $propertyChgService->addBagChg();
} }
break; break;