|
...
|
...
|
@@ -268,14 +268,37 @@ class CustomModuleCategoryLogic extends BaseLogic |
|
|
|
* @time :2023/12/4 15:47
|
|
|
|
*/
|
|
|
|
public function categoryDel(){
|
|
|
|
$info = $this->model->read(['pid' => $this->param['id']], ['id', 'route']);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('当前分类拥有下级');
|
|
|
|
$ids = $this->param['id'];
|
|
|
|
foreach ($ids as $id){
|
|
|
|
$info = $this->model->read(['pid'=>$id],['id']);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('分类id:'.$id.'拥有子集不允许删除');
|
|
|
|
}
|
|
|
|
$rs = $this->model->del($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('系统错误,请连续管理员');
|
|
|
|
$contentModel = new CustomModuleContent();
|
|
|
|
$contentInfo = $contentModel->read(['category_id'=>['like','%,'.$id.',%']]);
|
|
|
|
if($contentInfo !== false){
|
|
|
|
$this->fail('当前分类拥有产品不允许删除');
|
|
|
|
}
|
|
|
|
//删除路由
|
|
|
|
$this->delRoute($id);
|
|
|
|
$this->model->del(['id'=>$id]);
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :删除路由
|
|
|
|
* @name :delRoute
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/7 10:50
|
|
|
|
*/
|
|
|
|
public function delRoute($id)
|
|
|
|
{
|
|
|
|
RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], $id, $this->user['project_id']);
|
|
|
|
//通知
|
|
|
|
$info = $this->model->read(['id' => $id], ['id', 'route']);
|
|
|
|
$this->curlDelRoute(['route'=>$info['route']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|