作者 lyh

gx

... ... @@ -104,16 +104,15 @@ class ProductLogic extends BaseLogic
unset($ids[$k]);
continue;
}
if($info->status == Product::STATUS_RECYCLE){
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
//删除分类关联
CategoryRelated::where('product_id', $id)->delete();
//删除关键词关联
KeywordRelated::where('product_id', $id)->delete();
//删除当前产品模版
$this->delProductModule($id);
}else{
//回收站
parent::save(['id' => $id, 'status' => Product::STATUS_RECYCLE]);
... ... @@ -247,4 +246,25 @@ class ProductLogic extends BaseLogic
];
return $param;
}
/**
* @remark :删除当前产品所有模块
* @name :delProductModule
* @author :lyh
* @method :post
* @time :2023/7/31 10:31
*/
public function delProductModule($id){
$param = [
'source' => BTemplate::SOURCE_PRODUCT,
'source_id' => $id,
'project_id'=>$this->user['project_id'],
];
$bTemplateModel = new BTemplate();
$rs = $bTemplateModel->del($param);
if($rs === false){
$this->fail('error');
}
return $rs;
}
}
... ...