diff --git a/webapp/services/ShopService.php b/webapp/services/ShopService.php index 7b309d60..f5324277 100644 --- a/webapp/services/ShopService.php +++ b/webapp/services/ShopService.php @@ -89,10 +89,11 @@ class ShopService { $errMsg = ''; $buyRecordHash = ShopBuyRecord::allToHash(); $boughtTimes = 1; + $goodsId = $goodsMeta['goods_id']; { switch ($goodsMeta['limit_type']) { case mt\Shop::DAILY_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $id); + $buyRecord = getXVal($buyRecordHash, $goodsId); $boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1 : 1; if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $goodsMeta['limit_num']) { $this->_rspErr(2, 'Daily purchase limit'); @@ -101,7 +102,7 @@ class ShopService { } break; case mt\Shop::WEEKLY_BUY_LIMIT: { - $buyRecord = getXVal($buyRecordHash, $id); + $buyRecord = getXVal($buyRecordHash, $goodsId); $boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1 : 1; if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $goodsMeta['limit_num']) { $this->_rspErr(2, 'Weekly purchase limit reached'); @@ -110,8 +111,8 @@ class ShopService { } break; case mt\Shop::TOTAL_BUY_LIMIT: { - // error_log("total buy limit " . $address . " " . $id . " " . $goodsMeta['limit_num']); - $buyRecord = getXVal($buyRecordHash, $id); + // error_log("total buy limit " . $address . " " . $goodsId . " " . $goodsMeta['limit_num']); + $buyRecord = getXVal($buyRecordHash, $goodsId); $boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1 : 1; if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $goodsMeta['limit_num']) { $this->_rspErr(2, 'Purchase limit reached');