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