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