From 2bab5ff6925279e94ecf4ec3821d0b1a90971855 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Mon, 22 Jan 2024 18:03:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=85=B3=E8=81=94=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E9=93=BE=E7=9A=84=E5=95=86=E5=93=81=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=B8=8B=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/store/product/ProductRepository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index fa3c25e0..fade4dae 100644 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -16,6 +16,7 @@ namespace app\common\repositories\store\product; use app\common\dao\store\order\StoreCartDao; use app\common\model\store\order\StoreOrder; use app\common\model\store\order\StoreOrderProduct; +use app\common\model\store\product\CloudProduct; use app\common\model\store\product\ProductAttrValue; use app\common\model\store\product\ProductLabel; use app\common\model\store\product\PurchaseRecord; @@ -1951,6 +1952,10 @@ class ProductRepository extends BaseRepository $product = $this->dao->search(null, $where)->find(); if (!$product) throw new ValidateException('商品已下架'); + if ($data['source'] == 103 && empty($product['old_product_id'])) { + CloudProduct::where('product_id', $product['product_id'])->update(['status' => 0]); + throw new ValidateException('商品已下架'); + } if ($product['type'] && !$data['is_new']) throw new ValidateException('虚拟商品不可加入购物车'); $value_make = app()->make(ProductAttrValueRepository::class); $sku = $value_make->getOptionByUnique($data['product_attr_unique']);