From 0e78259a9da2fe0a38db5117c0da3e15a86b7467 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 31 Jul 2023 15:21:49 +0800 Subject: [PATCH] 1 --- webapp/services/ShopService.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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');