diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 2e267d20..64b41750 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -869,7 +869,6 @@ class ShopController extends BaseAuthedController } break; case ShopController::TOTAL_BUY_LIMIT: { - $sendingTimes = $this->countBuyGoodsRequestTimesByGoodsId($address, $row['goods_id']); $buyRecord = getXVal($buyRecordHash, $id); $boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1; if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $row['limit_num']) { @@ -880,6 +879,11 @@ class ShopController extends BaseAuthedController $this->_rspErr(2, 'he maximum number of purchase restrictions has been reached'); return; } + $sendingTimes = $this->countBuyGoodsRequestTimesByGoodsId($address, $row['goods_id']); + if ($sendingTimes >= $row['limit_num']) { + $this->_rspErr(2, 'The maximum number of purchase restrictions has been reached'); + return; + } } break; default: {