diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php index 2e281a6..d0daa23 100644 --- a/app/api/controller/Common.php +++ b/app/api/controller/Common.php @@ -603,4 +603,38 @@ class Common extends ApiController $data['flow_data'] = $flowData; $this->apiSuccess('获取成功', $data); } + + //获取审核流程节点 + public function get_flow_nodes($id=0,$type=1) + { + $flows = Db::name('FlowStep')->where(['action_id'=>$id,'type'=>$type,'delete_time'=>0])->order('sort asc')->select()->toArray(); + foreach ($flows as $key => &$val) { + $user_id_info = Db::name('Admin')->field('id,name,thumb')->where('id','in',$val['flow_uids'])->select()->toArray(); + foreach ($user_id_info as $k => &$v) { + $v['check_time'] = 0; + $v['content'] = ''; + $v['status'] = 0; + $check_array = Db::name('FlowRecord')->where(['check_user_id' => $v['id'],'step_id' => $val['id']])->order('check_time desc')->select()->toArray(); + if(!empty($check_array)){ + $checked = $check_array[0]; + $v['check_time'] = date('Y-m-d H:i', $checked['check_time']); + $v['content'] = $checked['content']; + $v['status'] = $checked['status']; + } + } + + $check_list = Db::name('FlowRecord') + ->field('f.*,a.name,a.thumb') + ->alias('f') + ->join('Admin a', 'a.id = f.check_user_id', 'left') + ->where(['f.step_id' => $val['id']])->select()->toArray(); + foreach ($check_list as $kk => &$vv) { + $vv['check_time_str'] = date('Y-m-d H:i', $vv['check_time']); + } + + $val['user_id_info'] = $user_id_info; + $val['check_list'] = $check_list; + } + $this->apiSuccess('获取成功', $flows); + } }