This commit is contained in:
azw 2023-07-30 10:54:18 +08:00
parent 7010020307
commit cb40c60c20

View File

@ -141,7 +141,10 @@ class ShopController extends BaseAuthedController {
} }
$costItemId = $this->getCostItemIdByTokenType($tokenType); $costItemId = $this->getCostItemIdByTokenType($tokenType);
$costItems = $this->makeCostItems($costItemId, $goodsNum * $needPrice); $costItems = array(
'item_id' => $costItemId,
'item_num' => $goodsNum * $needPrice
);
if (!in_array( if (!in_array(
$tokenType, $tokenType,
array( array(
@ -160,7 +163,11 @@ class ShopController extends BaseAuthedController {
ShopBuyRecord::add($id, $goodsNum); ShopBuyRecord::add($id, $goodsNum);
$this->_decItems($costItems); $this->_decItems($costItems);
for ($i = 0; $i < $goodsNum; $i++) { for ($i = 0; $i < $goodsNum; $i++) {
$this->internalAddItem($propertyChgService, $itemMeta, $goodsMeta['goods_num'], 0); $this->internalAddItem($awardService,
$propertyChgService,
$itemMeta,
$goodsMeta['goods_num'],
0);
} }
$propertyChgService->addUserChg(); $propertyChgService->addUserChg();
$this->_rspData( $this->_rspData(
@ -387,18 +394,11 @@ class ShopController extends BaseAuthedController {
} }
} }
private function makeCostItems($item_id, $num) private function internalAddItem($awardService,
{ $propertyChgService,
$costItems = array( $itemMeta,
array( $count,
'item_id' => $item_id, $grade = null)
'item_num' => $num
)
);
return $costItems;
}
private function internalAddItem($propertyChgService, $itemMeta, $count, $grade = null)
{ {
switch ($itemMeta['type']) { switch ($itemMeta['type']) {
case mt\Item::HERO_TYPE: case mt\Item::HERO_TYPE: