From a2e438afb99e5f354b3f9ea5a85dafed59ca3fcd Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Wed, 4 Nov 2020 16:58:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=BB=E7=BB=93=E5=BA=93=E5=AD=98=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/v3/GoodsActivity.php | 3 +-- app/Service/v3/Implementations/GoodsActivityService.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Model/v3/GoodsActivity.php b/app/Model/v3/GoodsActivity.php index c2d004f..5df8ea2 100644 --- a/app/Model/v3/GoodsActivity.php +++ b/app/Model/v3/GoodsActivity.php @@ -96,10 +96,9 @@ class GoodsActivity extends Model // 获取冻结的库存 $inventoryFrozen = $this->goodsInventoryService->getSold(2, $this->attributes['id']); - if ($this->attributes['expire_time'] < time()) { $msg = '已结束'; - } elseif ($this->attributes['inventory'] <= $inventoryFrozen && $this->attributes['is_infinite'] != 1) { + } elseif (($this->attributes['inventory'] <= $inventoryFrozen || $this->attributes['inventory'] <= 0) && $this->attributes['is_infinite'] != 1) { $msg = '已抢光'; } return $msg; diff --git a/app/Service/v3/Implementations/GoodsActivityService.php b/app/Service/v3/Implementations/GoodsActivityService.php index a1d7ee0..a29b14e 100644 --- a/app/Service/v3/Implementations/GoodsActivityService.php +++ b/app/Service/v3/Implementations/GoodsActivityService.php @@ -67,7 +67,7 @@ class GoodsActivityService implements GoodsActivityServiceInterface } // 是否超过限购数量 - if ($goods->restrict_num != 0 && $goods->restrict_num < $num) { + if (($goods->restrict_num <= $inventoryFrozen || $goods->restrict_num <= 0) && $goods->restrict_num < $num) { return ErrorCode::GOODS_ACTIVITY_RESTRICT_LIMIT; }