diff --git a/app/common/repositories/store/product/ProductRepository.php b/app/common/repositories/store/product/ProductRepository.php index c79132b2..692f521d 100755 --- a/app/common/repositories/store/product/ProductRepository.php +++ b/app/common/repositories/store/product/ProductRepository.php @@ -1747,6 +1747,7 @@ class ProductRepository extends BaseRepository public function switchStatus($id, $data) { $product = $this->getSearch([])->find($id); + if(!$product) throw new ValidateException('商品不存在'); $this->dao->update($id, $data); $status = $data['status']; $type = self::NOTIC_MSG[$data['status']][$product['product_type']]; @@ -1760,7 +1761,7 @@ class ProductRepository extends BaseRepository ] ], $product['mer_id']); app()->make(SpuRepository::class)->changeStatus($id, $product->product_type); - event('product.sell', ['product_id' => [$id]]); + event('product.sell', ['product_id' => [$id,'status'=>$status]]); $this->switchShow($id, $status, 'is_used', 0); }