|
@@ -362,6 +362,7 @@ class ProductLogic extends BaseLogic |
|
@@ -362,6 +362,7 @@ class ProductLogic extends BaseLogic |
|
362
|
public function productDelete(){
|
362
|
public function productDelete(){
|
|
363
|
DB::connection('custom_mysql')->beginTransaction();
|
363
|
DB::connection('custom_mysql')->beginTransaction();
|
|
364
|
try {
|
364
|
try {
|
|
|
|
365
|
+ $cateRelate = new CategoryRelated();
|
|
365
|
foreach ($this->param['ids'] as $id) {
|
366
|
foreach ($this->param['ids'] as $id) {
|
|
366
|
$info = $this->model->read(['id'=>$id],['id','status']);
|
367
|
$info = $this->model->read(['id'=>$id],['id','status']);
|
|
367
|
if($info['status'] == Product::STATUS_RECYCLE){
|
368
|
if($info['status'] == Product::STATUS_RECYCLE){
|
|
@@ -369,6 +370,8 @@ class ProductLogic extends BaseLogic |
|
@@ -369,6 +370,8 @@ class ProductLogic extends BaseLogic |
|
369
|
//删除当前产品模版
|
370
|
//删除当前产品模版
|
|
370
|
$this->delProductModule($id);
|
371
|
$this->delProductModule($id);
|
|
371
|
$this->model->del(['id'=>$id]);
|
372
|
$this->model->del(['id'=>$id]);
|
|
|
|
373
|
+ //删除关联表
|
|
|
|
374
|
+ $cateRelate->del(['product_id'=>$id]);
|
|
372
|
}else{
|
375
|
}else{
|
|
373
|
//回收站
|
376
|
//回收站
|
|
374
|
$this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]);
|
377
|
$this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]);
|