This commit is contained in:
aozhiwei 2023-07-31 15:21:49 +08:00
parent 40f146b895
commit 0e78259a9d

View File

@ -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');