select(); foreach ($list as &$item){ $item['title'] = json_decode($item['title']); } $this->success('',$list); } //发起审批 public function startBill(){ $param = $this->request->param(); $models = $param['models']; unset($param['models']); unset($param['addon']); unset($param['controller']); unset($param['action']); $param['initiator_id'] = $this->auth->id; $param['status'] = 1; $param['createtime'] = time(); $param['updatetime'] = time(); Db::startTrans(); try { DB::table($models)->insert($param); $bill_id = Db::table($models)->getLastInsID(); $flow_id = (new \app\admin\model\fastflow\flow\Flow())->where('bill',$models)->value('id'); $data = [ 'bill'=>$models, 'bill_id'=>$bill_id, 'ebill_id'=>'', 'flow_id'=>$flow_id, 'checkcontent'=>'', 'file_name'=>'', 'file'=>'', 'carbon_scope'=>'1', 'carbon_receiver'=>'', 'carbon_range'=>'1', ]; $res = (new Run())->start($data); Db::commit();; } catch (Exception $e) { Db::rollback(); $this->error($e->getMessage()); } $this->success(); } //同意 public function agreeBill(){ $param = $this->request->param(); $thread_id= $param['thread_id']; $checkcontent = $param['checkcontent']; unset($param['thread_checkcontentid']); unset($param['thread_id']); unset($param['addon']); unset($param['controller']); unset($param['action']); $result = false; Db::startTrans(); try { $data = [ 'thread_id'=>$thread_id, 'checkcontent'=>$checkcontent, 'file_name'=>'', 'file'=>'', 'carbon_scope'=>'1', 'carbon_receiver'=>'', 'carbon_range'=>'1', 'start'=>1, ]; $res = (new Run())->agree($data); if($res['code'] == 0){ $msg = $res['msg']; }else{ $result = true; } Db::commit(); } catch (Exception $e) { Db::rollback(); $this->error($e->getMessage()); } if ($result === false) { $this->error($msg); } $this->success(); } public function canbackPresteps(){ $this->api = new api(new CustomMessage(), $this); $thread_id = input('thread_id'); $thread = $this->api->getThreadById($thread_id); $process = $this->api->getProcess($thread['process_id']); $flow_id = $process['flow_id']; $canback_presteps = $this->api->getCanBackPreStep($flow_id, $process['id'], $thread['step_id']); $this->success('',$canback_presteps); } //拒绝 public function backBill(){ $param = $this->request->param(); $thread_id= $param['thread_id']; $checkcontent = $param['checkcontent']; $back_steps = $param['back_steps']; unset($param['checkcontent']); unset($param['back_steps']); unset($param['thread_id']); unset($param['addon']); unset($param['controller']); unset($param['action']); $result = false; Db::startTrans(); try { $data = [ 'thread_id'=>$thread_id, 'checkcontent'=>$checkcontent, 'file_name'=>'', 'back_steps'=>$back_steps, 'file'=>'', 'carbon_scope'=>'1', 'carbon_receiver'=>'', 'carbon_range'=>'1', ]; $res = (new Run())->back($data); if($res['code'] == 0){ $msg = $res['msg']; }else{ $result = true; } Db::commit(); } catch (Exception $e) { Db::rollback(); $this->error($e->getMessage()); } if ($result === false) { $this->error($msg); } $this->success(); } /** * 查看详情 */ public function detail() { $api = new api(); $thread_logs = $api->getThreadLog(input('bill'), input('bill_id')); $process = $api->getProcessByBill(input('bill'), input('bill_id')); //halt([input('bill'),input('bill_id')]); $nodes = $api->getAllNodes2($process['flow_id']); $nodes_data = []; foreach ($nodes as $node) { $data = $node['data']; if ($data['type'] != 'condition') { if ($data['type'] == 'step') { if ($data['scope'] == 3) { $data['worker'] = '读取单据' . $data['worker'] . '字段'; } elseif ($data['scope'] == 5) { $data['worker'] = '上级审批'; } elseif ($data['scope'] == 6) { $data['worker'] = '上一审批人动态指定'; } else { //$data['worker'] = $api->getWorkerNameStr(explode(',', $data['worker']), $data['scope']); } } else if ($data['type'] == 'start' || $data['type'] == 'end') { $data['sign'] = ''; $data['back'] = ''; $data['checkmode'] = ''; $data['worker'] = ''; } $nodes_data[] = $data; } } $nodes_data2 = []; foreach ($nodes_data as $item){ if($item['type'] == 'step'){ $nodes_data2[] = $item; } } $bill_row = $api->getBillRow(input('bill'), input('bill_id')); $bill = \app\admin\model\fastflow\flow\Bill::where(['bill_table' => input('bill')])->find(); $initiator_id = []; $initiator_type = ''; //halt($nodes_data2); foreach ($nodes_data2 as &$item){ $initiator_type = $item['scope']; if($initiator_id == []){ $initiator_id[] = $bill_row['initiator_id']; } if($initiator_type == 5){ $initiator_id = Db::name('qingdong_staff')->where('id','in',$initiator_id)->column('parent_id'); $worker_name = ''; foreach ($initiator_id as $worker_id) { $uid = self::getUserById($worker_id); if ($uid) { $user_name = self::getUserById($worker_id)['username']; $worker_name .= $user_name . ','; } } if (substr($worker_name, -1) === ',') { $worker_name = substr($worker_name, 0, -1); } $item['worker_name'] = $worker_name; }elseif ($initiator_type == 1 || $initiator_type == 2 || $initiator_type == 4){ $item['worker_name'] =$api->getWorkerNameStr(explode(',', $item['worker']), $item['scope']); } } //halt($nodes_data2); $bill_name = ''; if ($bill) { $bill_name = $bill['bill_name']; } //4.4.2 审批详情页附加抄送记录 $carbonModel = new \app\admin\model\fastflow\Carbon; foreach ($thread_logs as &$thread_log_rows) { //halt($thread_log_rows); //foreach ($thread_log_rows as &$thread_log_row) { $thread_log_rows['hasCarbon'] = false; $carbon_rows = $carbonModel->where(['current_log_id' => $thread_log_rows['id']])->select(); if ($carbon_rows) { $carbon_receiver_ids = []; foreach ($carbon_rows as $carbon_row) { $carbon_receiver_ids[] = $carbon_row['receiver_id']; } $thread_log_rows['hasCarbon'] = true; $thread_log_rows['carbon_receiver'] = $api->getWorkerNameStr($carbon_receiver_ids, 1); } //} } //4.4.2 !-- //$bill_row = $api->getBillRow(input('bill'), input('bill_id')); $initiator = ''; if ($bill_row) { $initiator_id = $bill_row['initiator_id']; $admin = Admin::find($initiator_id); if ($admin) { $initiator = $admin['nickname']; } } $bill_row_url = http_build_query(['row' => $bill_row]); $domain = $_SERVER['HTTP_HOST']; $ebill_copy_id = $this->getEbillCopyId(input('bill'), input('bill_id')); //查询是否有发起签章 $hasSignature = false; $pdfFile = ''; $signature = (new Signature())->where(['bill' => input('bill'), 'bill_id' => input('bill_id')])->find(); if ($signature) { $hasSignature = true; $pdfFile = $signature['pdf_file']; } $this->success('',['bill' => $bill_name, 'bill_id' => input('bill_id'), 'initiator' => $initiator, 'logs' => $thread_logs, 'nodes_data2'=>$nodes_data2,'ebill_id' => $ebill_copy_id, 'hasSignature' => $hasSignature, 'pdfFile' => $pdfFile]); //halt(['bill' => $bill_name, 'bill_id' => input('bill_id'), 'initiator' => $initiator, 'logs' => $thread_logs, 'ebill_id' => $ebill_copy_id, 'hasSignature' => $hasSignature, 'pdfFile' => $pdfFile]); } private function getEbillCopyId($bill, $bill_id) { $ebill_copy = (new EbillCopy())->where(['bill' => $bill, 'bill_id' => $bill_id])->find(); if ($ebill_copy) { $ebill_copy = $ebill_copy->toArray(); return $ebill_copy['id']; } return null; } public function getUserById($uid) { $users = workerAdapter::callFn('getUser', ['id' => $uid]); if ($users) { return $users[0]; } return $users; } /** * 查看待审批的 */ public function cancheckIndex(){ $user_id = $this->auth->id; $list = (new \app\admin\model\fastflow\flow\Bill())->field('bill_name,bill_table')->select(); $array = []; foreach ($list as $item){ $bill = $item['bill_table']; $canCheck_ids = []; $canCheckIndexRows_byUser = CancheckIndex::where(['bill' => $bill, 'worker_id' => $user_id])->where('scope', 'in', [1, 3])->select();//通过user_id获取待审批单据ids foreach ($canCheckIndexRows_byUser as $canCheckIndexRow_byUesr) { $canCheck_ids[] = $canCheckIndexRow_byUesr['bill_id']; } $group_ids = $this->getUserGroupIds($user_id); $canCheckIndexRows_byGroup = CancheckIndex::where(['bill' => $bill])->where('scope', 'in', [2, 4])->where('worker_id', 'in', $group_ids)->select();//通过group_id获取待审批单据ids foreach ($canCheckIndexRows_byGroup as $canCheckIndexRow_byGroup) { $canCheck_ids[] = $canCheckIndexRow_byGroup['bill_id']; } $array2['bill_ids'] = array_unique($canCheck_ids); $array2['bill_name'] = $item['bill_name']; $array2['bill_table'] = $item['bill_table']; if(!empty($array2['bill_ids'])){ $array[] = $array2; } //halt($array2); } $count = 0; $list = []; foreach ($array as $k=>&$item){ $item['id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill_table'])->value('id'); $item['list'] = $this->cancheckIndexList(['type'=>$item['bill_table'],'bill_ids'=>$item['bill_ids']]); $count += count( $item['list']); $list += array_merge($list,$item['list']); } usort($list, function($a, $b) { return $b['createtime'] <=> $a['createtime']; }); $this->success('',['data'=>$array,'count'=>$count,'list'=>$list]); } /** * 查看已审批的 */ public function endCheckIndex(){ $user_id = $this->auth->id; $list = (new \app\admin\model\fastflow\flow\Bill())->field('bill_name,bill_table')->select(); $array = []; foreach ($list as $item){ $bill = $item['bill_table']; $canCheck_ids = []; $canCheckIndexRows_byUser = ParticipantIndex::where(['bill' => $bill, 'worker_id' => $user_id])->select();//通过user_id获取待审批单据ids foreach ($canCheckIndexRows_byUser as $canCheckIndexRow_byUesr) { //已办,不包括发起人是自己的 $initiator_id = Db::table($canCheckIndexRow_byUesr['bill'])->where('id',$canCheckIndexRow_byUesr['bill_id'])->value('initiator_id'); if($initiator_id != $user_id){ $canCheck_ids[] = $canCheckIndexRow_byUesr['bill_id']; } } $array2['bill_ids'] = $canCheck_ids; $array2['bill_name'] = $item['bill_name']; $array2['bill_table'] = $item['bill_table']; if(!empty($array2['bill_ids'])){ $array[] = $array2; } } $count = 0; $list = []; foreach ($array as $k=>&$item){ $item['id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill_table'])->value('id'); $item['list'] = $this->cancheckIndexList(['type'=>$item['bill_table'],'bill_ids'=>$item['bill_ids']]); $count += count( $item['list']); $list += array_merge($list,$item['list']); } usort($list, function($a, $b) { return $b['createtime'] <=> $a['createtime']; }); $this->success('',['data'=>$array,'count'=>$count,'list'=>$list]); } public function cancheckIndexList($param){ $bill_ids = $param['bill_ids']; $billModel = new \app\admin\model\fastflow\flow\Bill(); //采购设备 if($param['type'] == 'ats_xtuqll'){ $Model = new Xtuqll(); $Model->where('xtuqll.id in (' . implode(',',$bill_ids). ')'); $list = $Model->with('business')->order('createtime desc')->select(); //halt($list); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['customer_id'] = $customerModel->where('id',$item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id',$item['business_id'])->value('name'); $item['url'] = (new Amodel())->where('bill_id',$item['id'])->where('type','contract')->value('file'); } } //请假 elseif ($param['type'] == 'ats_hvuxhg'){ $Model = new Hvuxhg(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //出差 elseif ($param['type'] == 'ats_aysdrr'){ $Model = new Aysdrr(); $Model->where('aysdrr.id in (' . implode(',', $bill_ids) . ')'); $list = $Model->with('business')->order('createtime desc')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['customer_id'] = $customerModel->where('id', $item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id', $item['business_id'])->value('name'); } } //转正 elseif ($param['type'] == 'ats_dudzeq'){ $Model = new Dudzeq(); $Model->where('dudzeq.id in (' . implode(',', $bill_ids) . ')'); $list = $Model->with('user')->order('createtime desc')->select(); $staffModel = new \addons\qingdong\model\Staff(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['admin_id'] = $staffModel->where('id', $item['admin_id'])->value('name'); } } //招聘 elseif ($param['type'] == 'ats_wbvnia'){ $Model = new Wbvnia(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //用车 elseif ($param['type'] == 'ats_nidsvn'){ $Model = new Nidsvn(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //用章 elseif ($param['type'] == 'ats_wduzfa'){ $Model = new Wduzfa(); $Model->where('wduzfa.id in (' . implode(',', $bill_ids) . ')'); $list = $Model->with(['business','customer'])->order('createtime desc')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['customer_id'] = $customerModel->where('id', $item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id', $item['business_id'])->value('name'); } } //退换货单 elseif ($param['type'] == 'ats_xnsdti'){ $Model = new Xnsdti(); $Model->where('xnsdti.id in (' . implode(',', $bill_ids) . ')'); $list = $Model->with(['business','customer'])->order('createtime desc')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['customer_id'] = $customerModel->where('id', $item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id', $item['business_id'])->value('name'); } } //借支款 elseif ($param['type'] == 'ats_mowpvu'){ $Model = new Mowpvu(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //离职申请 elseif ($param['type'] == 'ats_kmqpxi'){ $Model = new Kmqpxi(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); $staffModel = new \addons\qingdong\model\Staff(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['admin_id'] = $staffModel->where('id', $item['admin_id'])->value('name'); } } //业务费预申请 elseif ($param['type'] == 'ats_havols'){ $Model = new Havols(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //临时单次报销 elseif ($param['type'] == 'ats_jxbunq'){ $Model = new Jxbunq(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //产品样品借样 elseif ($param['type'] == 'ats_zaxsta'){ $Model = new Zaxsta(); $Model->where('zaxsta.id in (' . implode(',', $bill_ids) . ')'); $list = $Model->with(['business','customer'])->order('createtime desc')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['customer_id'] = $customerModel->where('id', $item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id', $item['business_id'])->value('name'); } } //酒水申领 elseif ($param['type'] == 'ats_dbxovs'){ $Model = new Dbxovs(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //物品领用 elseif ($param['type'] == 'ats_yoirpj'){ $Model = new Yoirpj(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //设备赠送 elseif ($param['type'] == 'ats_zmqrbq'){ $Model = new Zmqrbq(); $Model->where('zmqrbq.id in (' . implode(',', $bill_ids) . ')'); $list = $Model->with(['business','customer'])->order('createtime desc')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['customer_id'] = $customerModel->where('id', $item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id', $item['business_id'])->value('name'); } } //付款申请 elseif ($param['type'] == 'ats_kiahkj'){ $Model = new Kiahkj(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //报价申请 elseif ($param['type'] == 'ats_czgprz'){ $Model = new Czgprz(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['customer_id'] = $customerModel->where('id', $item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id', $item['business_id'])->value('name'); } } //合同审批 elseif ($param['type'] == 'ats_bywnpk'){ $Model = new Bywnpk(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); $CzgprzModel = new Czgprz(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); $item['bill_id'] = $CzgprzModel->where('id', $item['bill_id'])->value('name'); $item['customer_id'] = $customerModel->where('id', $item['customer_id'])->value('name'); $item['business_id'] = $businessModel->where('id', $item['business_id'])->value('name'); } } //采购申请 elseif ($param['type'] == 'ats_txdphj'){ $Model = new Txdphj(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //入库申请确认 elseif ($param['type'] == 'ats_jiopho'){ $Model = new Jiopho(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //调薪申请 elseif ($param['type'] == 'ats_hwgvrz'){ $Model = new Hwgvrz(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //外出申请 elseif ($param['type'] == 'ats_stwoae'){ $Model = new Stwoae(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } //补卡申请 elseif ($param['type'] == 'ats_asiitn'){ $Model = new Asiitn(); $Model->where('id in (' . implode(',', $bill_ids) . ')'); $list = $Model->order('createtime desc')->select(); foreach ($list as &$item){ $item['bill_rule_id'] = Db::name('fastflow_bill_rule')->where('bill_table',$item['bill'])->value('id'); $item['bill_name'] = $billModel->where('bill_table',$item['bill'])->value('bill_name'); } } else{ $list = []; } return $list; } public function getUserGroupIds($uid) { $group_ids = []; $group_access = workerAdapter::callFn('getGroupAccess', ['uid' => $uid]); if (!$group_access) { return false; } foreach ($group_access as $access) { $group_arr = explode(',', $access['group_id']); foreach ($group_arr as $group_id) { $group_ids[] = $group_id; } } return $group_ids; } }