diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index b25def3c..d0086c17 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -185,6 +185,7 @@ class BagController extends BaseAuthedController { return; } $costItems = mt\Item::getUseCostItems($itemMeta); + error_log(json_encode($costItems)); $lackItem = null; if (!$this->_hasEnoughItems($costItems, $lackItem)) { $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); diff --git a/webapp/mt/Item.php b/webapp/mt/Item.php index a0ad5ecf..dd4f66ca 100644 --- a/webapp/mt/Item.php +++ b/webapp/mt/Item.php @@ -172,13 +172,11 @@ class Item { public static function getUseCostItems($itemMeta) { $costItems = array(); - $tmpStrs1 = splitStr1($itemMeta['use_cost']); - foreach ($tmpStrs1 as $tmpStr1) { - $tmpStrs2 = splitStr2($tmpStr1); - if (count($tmpStrs2) >= 2) { + foreach (splitStr2($itemMeta['use_cost']) as $arr) { + if (count($arr) >= 2) { array_push($costItems, array( - 'item_id' => $tmpStrs2[0], - 'item_num' => $tmpStrs2[1] + 'item_id' => $arr[0], + 'item_num' => $arr[1] )); } }