|
...
|
...
|
@@ -26,6 +26,52 @@ class NavLogic extends BaseLogic |
|
|
|
$this->model = new BNav();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取当前id下所有子集
|
|
|
|
* @name :getSubList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/4 15:11
|
|
|
|
*/
|
|
|
|
public function getSubList(){
|
|
|
|
//编辑时
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])) {
|
|
|
|
$str = [];
|
|
|
|
//排序掉当前id下所有子集
|
|
|
|
$str = $this->getAllSub($this->param['id'], $str);
|
|
|
|
$str[] = $this->param['id'];
|
|
|
|
$this->param['id'] = ['not in', $str];
|
|
|
|
}
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$list = $this->model->list($this->param);
|
|
|
|
$data = array();
|
|
|
|
foreach ($list as $v){
|
|
|
|
$v = (array)$v;
|
|
|
|
if ($v['pid'] == 0) {
|
|
|
|
$v['sub'] = _get_child($v['id'], $list);
|
|
|
|
$data[] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取当前id下所有子集
|
|
|
|
* @name :getAllSub
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/10/18 15:10
|
|
|
|
*/
|
|
|
|
public function getAllSub($id,&$str = []){
|
|
|
|
$list = $this->model->list(['pid'=>$id,'status'=>1],['id','pid']);
|
|
|
|
if(!empty($list)){
|
|
|
|
foreach ($list as $v){
|
|
|
|
$str[] = $v['id'];
|
|
|
|
$this->getAllSub($v['id'],$str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存数据
|
|
...
|
...
|
@@ -71,10 +117,10 @@ class NavLogic extends BaseLogic |
|
|
|
if($this->param['pid'] == $info['id']){
|
|
|
|
$this->fail('不允许成为自己的上级');
|
|
|
|
}
|
|
|
|
$pid_info = $this->model->read(['pid'=>$this->param['id']]);
|
|
|
|
if(($pid_info !== false) && $this->param['pid'] != $info['pid']){
|
|
|
|
$this->fail('当前菜单拥有子集不允许修改上级');
|
|
|
|
}
|
|
|
|
// $pid_info = $this->model->read(['pid'=>$this->param['id']]);
|
|
|
|
// if(($pid_info !== false) && $this->param['pid'] != $info['pid']){
|
|
|
|
// $this->fail('当前菜单拥有子集不允许修改上级');
|
|
|
|
// }
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|