post = $this->request->post(); } /** * @return \think\response\Json|void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function list(){ $page =isset($this->post['page']) &&$this->post['page']!="" ? intval($this->post['page']) : 1; $size =isset($this->post['size']) &&$this->post['size']!="" ? intval($this->post['size']) : 10; $count = Db::name("process")->where('is_del',1)->count(); $total = ceil($count/$size); $page = $page>$total ? $total:$page; $list = Db::name("process")->where('is_del', 1)->page($page, $size)->select(); return app_show(0,"获取成功",["list"=>$list,"count"=>$count]); } /** * @return \think\response\Json|void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function info(){ $id =isset($this->post['id']) &&$this->post['id']!="" ? intval($this->post['id']) : ""; if($id==""){ return error_show(1004,"参数id 不能为空"); } $info = Db::name("process")->where(['id'=>$id,"is_del"=>0])->find(); if(empty($info)){ return error_show(1004,"流程信息未找到"); } $list=Db::name("action_process")->where(["pid"=>$id,"is_del"=>0])->order("weight,id")->select(); $info['item'] = empty($list) ? []:$list; return app_show(0,"获取成功",$info); } /** * @return \think\response\Json|void * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function process(){ $process_type = isset($this->post['type'])&&$this->post['type']!="" ? $this->post['type']:""; if($process_type==""){ return error_show(1004,"参数type 不能为空"); } $orderCode = isset($this->post['orderCode'])&&$this->post['orderCode']!="" ? $this->post['orderCode']:""; if($orderCode==""){ return error_show(1004,"参数orderCode不能为空"); } $list = Db::name("action_process")->where(['order_type'=>$process_type,"is_del"=>0,"status"=>1])->order("weight desc,id desc") ->select(); $data=[]; foreach ($list as $value){ $node = Db::name("process_order")->where(["order_type"=>$value['order_type'],"action_process"=>$value['order_process'],"order_code"=>$orderCode])->find(); $value['action_uid']= isset($node['action_uid']) ? $node['action_uid']:''; $value['action_name']= isset($node['action_name']) ? $node['action_name']:''; $data[]=$value; } return app_show(0,"获取成功",$data); } }