From fa7f26e6aaf5981ca8168d352acd427c88794890 Mon Sep 17 00:00:00 2001 From: weigang Date: Wed, 16 Sep 2020 11:52:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E9=99=90=E8=B4=AD=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Service/v3/Implementations/GoodsActivityService.php | 2 +- app/Service/v3/Implementations/GoodsService.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Service/v3/Implementations/GoodsActivityService.php b/app/Service/v3/Implementations/GoodsActivityService.php index 91370ad..f2a5a5b 100644 --- a/app/Service/v3/Implementations/GoodsActivityService.php +++ b/app/Service/v3/Implementations/GoodsActivityService.php @@ -48,7 +48,7 @@ class GoodsActivityService implements GoodsActivityServiceInterface } // 是否超过限购数量 - if ($goods->restrict_num < $num) { + if ($goods->restrict_num != 0 && $goods->restrict_num < $num) { return ErrorCode::GOODS_ACTIVITY_RESTRICT_LIMIT; } diff --git a/app/Service/v3/Implementations/GoodsService.php b/app/Service/v3/Implementations/GoodsService.php index f5f0026..40ed706 100644 --- a/app/Service/v3/Implementations/GoodsService.php +++ b/app/Service/v3/Implementations/GoodsService.php @@ -37,6 +37,11 @@ class GoodsService implements GoodsServiceInterface return ErrorCode::GOODS_INVENTORY_ERROR; } + // 是否超过限购数量 + if ($goods->restrict_num != 0 && $goods->restrict_num < $num) { + return ErrorCode::GOODS_RESTRICT_LIMIT; + } + return true; }