diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 87f55206..09392380 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -102,11 +102,6 @@ class ShopController extends BaseAuthedController { } $propertyChgService = new services\PropertyChgService(); $awardService = new services\AwardService(); - $costItemId = myself()->getCostItemIdByTokenType($tokenType); - $costItems = array( - 'item_id' => $costItemId, - 'item_num' => $goodsNum * $needPrice - ); $tokenType = $goodsMeta['token_type']; $price = $goodsMeta['price']; if (!in_array( @@ -119,6 +114,15 @@ class ShopController extends BaseAuthedController { myself()->_rspErr(1, "token_type is unsupport, {$tokenType}"); return; } + if ($price < 1) { + myself()->_rspErr(1, "config error"); + return; + } + $costItemId = myself()->getCostItemIdByTokenType($tokenType); + $costItems = array( + 'item_id' => $costItemId, + 'item_num' => $goodsNum * $price + ); $lackItem = null; if (!myself()->_hasEnoughItems($costItems, $lackItem)) { myself()->_rspErr(2, myself()->_getLackItemErrMsg($lackItem));