作者 lyh

gx

@@ -104,16 +104,15 @@ class ProductLogic extends BaseLogic @@ -104,16 +104,15 @@ class ProductLogic extends BaseLogic
104 unset($ids[$k]); 104 unset($ids[$k]);
105 continue; 105 continue;
106 } 106 }
107 -  
108 if($info->status == Product::STATUS_RECYCLE){ 107 if($info->status == Product::STATUS_RECYCLE){
109 //删除路由映射 108 //删除路由映射
110 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 109 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
111 -  
112 //删除分类关联 110 //删除分类关联
113 CategoryRelated::where('product_id', $id)->delete(); 111 CategoryRelated::where('product_id', $id)->delete();
114 -  
115 //删除关键词关联 112 //删除关键词关联
116 KeywordRelated::where('product_id', $id)->delete(); 113 KeywordRelated::where('product_id', $id)->delete();
  114 + //删除当前产品模版
  115 + $this->delProductModule($id);
117 }else{ 116 }else{
118 //回收站 117 //回收站
119 parent::save(['id' => $id, 'status' => Product::STATUS_RECYCLE]); 118 parent::save(['id' => $id, 'status' => Product::STATUS_RECYCLE]);
@@ -247,4 +246,25 @@ class ProductLogic extends BaseLogic @@ -247,4 +246,25 @@ class ProductLogic extends BaseLogic
247 ]; 246 ];
248 return $param; 247 return $param;
249 } 248 }
  249 +
  250 + /**
  251 + * @remark :删除当前产品所有模块
  252 + * @name :delProductModule
  253 + * @author :lyh
  254 + * @method :post
  255 + * @time :2023/7/31 10:31
  256 + */
  257 + public function delProductModule($id){
  258 + $param = [
  259 + 'source' => BTemplate::SOURCE_PRODUCT,
  260 + 'source_id' => $id,
  261 + 'project_id'=>$this->user['project_id'],
  262 + ];
  263 + $bTemplateModel = new BTemplate();
  264 + $rs = $bTemplateModel->del($param);
  265 + if($rs === false){
  266 + $this->fail('error');
  267 + }
  268 + return $rs;
  269 + }
250 } 270 }