|
@@ -140,7 +140,14 @@ class Newfill extends BaseController
|
|
|
if($pid===""){
|
|
|
return error_show(1002,"父级id不能为空");
|
|
|
}
|
|
|
- $spid = Db::name('company_item')->where(['id'=>$pid,'is_del'=>0])->find();
|
|
|
+ //$spid = Db::name('company_item')->where(['id'=>$pid,'is_del'=>0])->find();
|
|
|
+ $spid=['depart_link'=>""];
|
|
|
+ if($pid!=0){
|
|
|
+ $spid = Db::name('company_item')->where(['id'=>$pid,'is_del'=>0])->find();
|
|
|
+ if(empty($spid)){
|
|
|
+ return error_show(1004,"父级数据不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
$level = isset($this->post['level']) && $this->post['level'] !==""? trim($this->post['level']):"1";
|
|
|
$weight = isset($this->post['weight']) && $this->post['weight'] !==""? trim($this->post['weight']):"1";
|
|
|
Db::startTrans();
|
|
@@ -184,7 +191,7 @@ class Newfill extends BaseController
|
|
|
return error_show($effetc['code'],$effetc['message']);
|
|
|
}
|
|
|
$id = isset($this->post['id'])?intval($this->post['id']):"";
|
|
|
- $items = Db::name("company_item")->where("id","=",$id)->find();
|
|
|
+ $items = Db::name("company_item")->where(['id'=>$id,'is_del'=>0])->find();
|
|
|
if($items==false){
|
|
|
return error_show(1003,"部门信息不存在");
|
|
|
}
|
|
@@ -192,9 +199,12 @@ class Newfill extends BaseController
|
|
|
if($pid==""){
|
|
|
return error_show(1002,"父级id不能为空");
|
|
|
}
|
|
|
- $spid = Db::name('company_item')->where(['id'=>$pid,'is_del'=>0])->find();
|
|
|
- if(empty($spid)){
|
|
|
- return error_show(1004,"父级id不能为空");
|
|
|
+ $spid=['depart_link'=>""];
|
|
|
+ if($pid!=0){
|
|
|
+ $spid = Db::name('company_item')->where(['id'=>$pid,'is_del'=>0])->find();
|
|
|
+ if(empty($spid)){
|
|
|
+ return error_show(1004,"父级数据不能为空");
|
|
|
+ }
|
|
|
}
|
|
|
$weight = isset($this->post['weight']) && $this->post['weight'] !==""? trim($this->post['weight']):"1";
|
|
|
$itemname=isset($this->post['name'])? trim($this->post['name']):"";
|