|
...
|
...
|
@@ -17,23 +17,36 @@ class DeptLogic extends BaseLogic |
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->param = $this->requestAll;
|
|
|
|
$this->model = new Dept();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function save($param){
|
|
|
|
if(!empty($param['pid'])){
|
|
|
|
if(!empty($param['id']) && $param['pid'] == $param['id']){
|
|
|
|
$this->fail('上级部门不能是本部门');
|
|
|
|
}
|
|
|
|
$p_cate = $this->getCacheInfo($param['pid']);
|
|
|
|
if(!$p_cate){
|
|
|
|
$this->fail('上级部门不存在');
|
|
|
|
/**
|
|
|
|
* @remark :保存
|
|
|
|
* @name :save
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/28 15:10
|
|
|
|
*/
|
|
|
|
public function deptSave(){
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
if($this->param['pid'] == $this->param['id']){
|
|
|
|
$this->fail('当前上级分类不能为自己');
|
|
|
|
}
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param]);
|
|
|
|
}else{
|
|
|
|
$this->model->add($this->param);
|
|
|
|
}
|
|
|
|
return parent::save($param);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :删除
|
|
|
|
* @name :delete
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/8/28 15:22
|
|
|
|
*/
|
|
|
|
public function delete($ids, $map = []){
|
|
|
|
$ids= array_filter(Arr::splitFilterToArray($ids), 'intval');
|
|
|
|
foreach ($ids as $id){
|
...
|
...
|
|