添加判断
This commit is contained in:
parent
b05cf35972
commit
9e71b720e5
@ -1747,6 +1747,7 @@ class ProductRepository extends BaseRepository
|
|||||||
public function switchStatus($id, $data)
|
public function switchStatus($id, $data)
|
||||||
{
|
{
|
||||||
$product = $this->getSearch([])->find($id);
|
$product = $this->getSearch([])->find($id);
|
||||||
|
if(!$product) throw new ValidateException('商品不存在');
|
||||||
$this->dao->update($id, $data);
|
$this->dao->update($id, $data);
|
||||||
$status = $data['status'];
|
$status = $data['status'];
|
||||||
$type = self::NOTIC_MSG[$data['status']][$product['product_type']];
|
$type = self::NOTIC_MSG[$data['status']][$product['product_type']];
|
||||||
@ -1760,7 +1761,7 @@ class ProductRepository extends BaseRepository
|
|||||||
]
|
]
|
||||||
], $product['mer_id']);
|
], $product['mer_id']);
|
||||||
app()->make(SpuRepository::class)->changeStatus($id, $product->product_type);
|
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);
|
$this->switchShow($id, $status, 'is_used', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user