|
@@ -13,6 +13,14 @@ class Resigninfo extends BaseController
|
|
|
{
|
|
|
parent::__construct($app);
|
|
|
$this->post = $this->request->post();
|
|
|
+ $token = isset($this->post['token']) ? trim($this->post['token']) : "";
|
|
|
+ if($token==""){
|
|
|
+ return error_show(101,'token不能为空');
|
|
|
+ }
|
|
|
+ $effetc = VerifyTokens($token);
|
|
|
+ if(!empty($effetc) && $effetc['code']!=0) {
|
|
|
+ return error_show($effetc['code'], $effetc['message']);
|
|
|
+ }
|
|
|
}
|
|
|
public function list(){
|
|
|
$page = isset($this->post['page']) && $this->post['page'] !=="" ? intval($this->post['page']):"1";
|
|
@@ -24,4 +32,150 @@ class Resigninfo extends BaseController
|
|
|
$list = Db::name('resign_info')->where($where)->page($page,$size)->select();
|
|
|
return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
|
|
|
}
|
|
|
+ public function create(){
|
|
|
+ $token =isset($this->post['token']) && $this->post['token'] !=="" ? trim($this->post['token']) :"";
|
|
|
+ $condition=[];
|
|
|
+ $resign_id = isset($this->post['resign_uid']) && $this->post['resign_uid'] !==""? trim($this->post['resign_uid']) :"";
|
|
|
+ if($resign_id==""){
|
|
|
+ return error_show(1002,"离职人id不能为空");
|
|
|
+ }
|
|
|
+ $condition['id']=$resign_id;
|
|
|
+ $resign_uid=GetInfoById($token,$condition);
|
|
|
+ if(empty($resign_uid)||$resign_uid['code']!=0){
|
|
|
+ return error_show(1002,"离职人员信息不存在");
|
|
|
+ }
|
|
|
+ $ri= isset($resign_uid["data"]['nickname']) ? $resign_uid["data"]['nickname'] : "";
|
|
|
+ $hand_id = isset($this->post['hand_uid']) && $this->post['hand_uid'] !==""? trim($this->post['hand_uid']) :"";
|
|
|
+ if($hand_id==""){
|
|
|
+ return error_show(1002,"交接人名称不能为空");
|
|
|
+ }
|
|
|
+ $condition['id']=$hand_id;
|
|
|
+ $hand_uid = GetInfoById($token,$condition);
|
|
|
+ if(empty($hand_uid)||$hand_uid['code']!=0){
|
|
|
+ return error_show(1002,"交接人员信息不存在");
|
|
|
+ }
|
|
|
+ $rp= isset($hand_uid["data"]['nickname']) ? $hand_uid["data"]['nickname'] : "";
|
|
|
+ $resign_date = isset($this->post['resign_date']) && $this->post['resign_date']!== "" ? $this->post['resign_date']:date("Y-m-d H:i:s");
|
|
|
+ if($resign_date==""){
|
|
|
+ return error_show(1005,'离职日期不能为空');
|
|
|
+ }
|
|
|
+ $is_hand = isset($this->post['is_hand']) && $this->post['is_hand'] !=="" ? trim($this->post['is_hand']):"0";
|
|
|
+ $status = isset($this->post['status']) && $this->post['status'] !== "" ? intval($this->post['status']) : "0";
|
|
|
+ $remark = isset($this->post['remark']) && $this->post['remark'] !== "" ? intval($this->post['remark']) : "";
|
|
|
+ $data=[
|
|
|
+ "resign_uid"=>$resign_id,
|
|
|
+ "hand_uid"=>$hand_id,
|
|
|
+ "resign_name"=>$ri,
|
|
|
+ "hand_name"=>$rp,
|
|
|
+ "resign_date"=>date("Y-m-d H:i:s"),
|
|
|
+ "is_hand"=>$is_hand,
|
|
|
+ "status"=>$status,
|
|
|
+ "remark"=>$remark,
|
|
|
+ "is_del"=>0,
|
|
|
+ "addtime"=>date("Y-m-d H:i:s"),
|
|
|
+ "updatetime"=>date("Y-m-d H:i:s"),
|
|
|
+ ];
|
|
|
+ $in = Db::name('resign_info')->insert($data);
|
|
|
+ return $in ? error_show(0,"添加成功") : error_show(1002,"添加失败");
|
|
|
+ }
|
|
|
+ public function selec(){
|
|
|
+ $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']) :"";
|
|
|
+ if($id==""){
|
|
|
+ return error_show(1002,"离职人员信息不存在");
|
|
|
+ }
|
|
|
+ $rid = Db::name('resign_info')->where(['is_del'=>0,'id'=>$id])->find();
|
|
|
+ return app_show(0,"获取成功",$rid);
|
|
|
+ }
|
|
|
+ public function edit(){
|
|
|
+ $condition=[];
|
|
|
+ $token =isset($this->post['token']) && $this->post['token'] !=="" ? trim($this->post['token']) :"";
|
|
|
+ $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
|
+ $eid = Db::name('resign_info')->where(['is_del'=>0,'id'=>$id])->find();
|
|
|
+ if($eid==""){
|
|
|
+ return error_show(1002,"离职信息不存在");
|
|
|
+ }
|
|
|
+ $resign_id = isset($this->post['resign_uid']) && $this->post['resign_uid'] !=="" ? trim($this->post['resign_uid']):"";
|
|
|
+ if($resign_id==""){
|
|
|
+ return error_show(1002,"离职人员ID不能为空");
|
|
|
+ }
|
|
|
+ $condition['id']=$resign_id;
|
|
|
+ $resign_uid=GetInfoById($token,$condition);
|
|
|
+ if(empty($resign_uid)||$resign_uid['code']!=0){
|
|
|
+ return error_show(1002,"离职人员信息不存在");
|
|
|
+ }
|
|
|
+ $rr= isset($resign_uid["data"]['nickname']) ? $resign_uid["data"]['nickname'] : "";
|
|
|
+
|
|
|
+ $resign_date = isset($this->post['resign_date']) && $this->post['resign_date']!== "" ? $this->post['resign_date']:date("Y-m-d H:i:s");
|
|
|
+ if($resign_date==""){
|
|
|
+ return error_show(1005,'离职日期不能为空');
|
|
|
+ }
|
|
|
+ $hand_id = isset($this->post['hand_uid']) && $this->post['hand_uid'] !=="" ? trim($this->post['hand_uid']) :"";
|
|
|
+ if($hand_id=="") {
|
|
|
+ return error_show(1002, "交接人员id不能为空");
|
|
|
+ }
|
|
|
+ $condition['id']=$hand_id;
|
|
|
+ $hand_uid = GetInfoById($token,$condition);
|
|
|
+ if(empty($hand_uid)||$hand_uid['code']!=0){
|
|
|
+ return error_show(1002,"交接人员信息不存在");
|
|
|
+ }
|
|
|
+ $r= isset($hand_uid["data"]['nickname']) ? $hand_uid["data"]['nickname'] : "";
|
|
|
+ $is_hand = isset($this->post['is_hand']) && $this->post['is_hand'] !=="" ? trim($this->post['is_hand']):"0";
|
|
|
+ $str=[
|
|
|
+ "hand_name"=>$r,
|
|
|
+ "resign_name"=>$rr,
|
|
|
+ "id"=>$id,
|
|
|
+ "resign_uid"=>$resign_id,
|
|
|
+ "hand_uid"=>$hand_id,
|
|
|
+ "is_hand"=>$is_hand,
|
|
|
+ "resign_date"=>date('Y-m-d H:i:s'),
|
|
|
+ "is_del"=>0,
|
|
|
+ "updatetime"=>date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ $it = Db::name('resign_info')->where(['is_del'=>0,'id'=>$id])->save($str);
|
|
|
+ if($it){
|
|
|
+ return error_show(0,"编辑成功");
|
|
|
+ }else{
|
|
|
+ return error_show(1002,"编辑失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function del(){
|
|
|
+ $id = isset($this->post['id']) && $this->post['id'] !=="" ? $this->post['id']:"";
|
|
|
+ $fid = Db::name('resign_info')->where(['is_del'=>0,'id'=>$id])->find();
|
|
|
+ if($fid==false){
|
|
|
+ return error_show(1002,"离职人员不存在");
|
|
|
+ }
|
|
|
+ $num = Db::name('resign_info')->update(['is_del'=>1,'id'=>$id,"updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+ if($num){
|
|
|
+ return error_show(0,"删除成功");
|
|
|
+ }else{
|
|
|
+ return error_show(1002,"删除失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function statu(){
|
|
|
+ $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
|
|
|
+ if($id==""){
|
|
|
+ return error_show(1002,"离职人id不能为空");
|
|
|
+ }
|
|
|
+ $remark = isset($this->post['remark']) && $this->post['remark'] !=="" ? trim($this->post['remark']) :"";
|
|
|
+ if($remark==""){
|
|
|
+ return error_show(1002,"备注不能为空");
|
|
|
+ }
|
|
|
+ $stauts = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"";
|
|
|
+ if($stauts===""){
|
|
|
+ return error_show(1002,"状态不能为空");
|
|
|
+ }
|
|
|
+ $st = Db::name('resign_info')->where(['id'=>$id,"is_del"=>0])->find();
|
|
|
+ if(empty($st)){
|
|
|
+ return error_show(1002,"离职人员信息未找到");
|
|
|
+ }
|
|
|
+ $st['remark']=$remark;
|
|
|
+ $st['status']=$stauts;
|
|
|
+ $st['updatetime']= date('Y-m-d H:i:s');
|
|
|
+ $sv = Db::name('resign_info')->save($st);
|
|
|
+ if($sv){
|
|
|
+ return error_show(0,"状态更新成功");
|
|
|
+ }else{
|
|
|
+ return error_show(1002,"状态更新失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|