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; }