添加判断

This commit is contained in:
mkm 2024-01-26 14:06:56 +08:00
parent b05cf35972
commit 9e71b720e5

View File

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