select(); $groupIds = \addons\qingdong\model\Staff::getLowerId(102, true); $uids = AuthGroupAccess::where(['group_id' => ['in', $groupIds]])->column('uid'); // halt($uids); // 过滤掉不符合条件的项 $filteredItems = []; foreach ($list as $item) { $item['title'] = json_decode($item['title'], true); $filteredItems[] = $item; } // 返回过滤后的列表 $this->success('', $filteredItems); } //新的权限 public function listSel2(){ $list = Db::name('fastflow_bill_rule')->select(); $groupIds = \addons\qingdong\model\Staff::getLowerId(102, true); $uids = AuthGroupAccess::where(['group_id' => ['in', $groupIds]])->column('uid'); // halt($uids); // 过滤掉不符合条件的项 $filteredItems = []; foreach ($list as $item) { // 检查当前用户是否在 $uids 中 if (in_array($this->auth->id, $uids)) { // 如果用户在 $uids 中,则只保留 ID 为 1, 9, 11, 12, 17, 21, 26 的项 // if (in_array($item['id'], [1, 9, 11, 12, 17, 21, 26,27,28,29,30,31])) { // $item['title'] = json_decode($item['title'], true); // $filteredItems[] = $item; // } if (in_array($item['id'], [27,28,29,30,31])) { $item['title'] = json_decode($item['title'], true); $filteredItems[] = $item; } } else { if(in_array($this->auth->id, [5,6,15,128,149])){ // 如果用户不在 $uids 中,直接添加 $item['title'] = json_decode($item['title'], true); $filteredItems[] = $item; }else{ if (!in_array($item['id'], [27,28,29,30,31])) { $item['title'] = json_decode($item['title'], true); $filteredItems[] = $item; } } } } // 返回过滤后的列表 $this->success('', $filteredItems); } public function index(){ $param = $this->request->param(); $type = $param['status_type']??''; $billrule = new Billrule(); if($param['type'] == '1'){ $Model = new Xtuqll(); $bill_ids = $this->filtrateBillIds($Model,'ats_xtuqll',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('xtuqll.id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->with('business')->order('createtime desc')->where('status','<>','-1')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '2'){ $Model = new Hvuxhg(); $bill_ids = $this->filtrateBillIds($Model,'ats_hvuxhg',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //出差 elseif ($param['type'] == '3'){ $Model = new Aysdrr(); $bill_ids = $this->filtrateBillIds($Model,'ats_aysdrr',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('aysdrr.id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->with('business')->order('createtime desc')->where('status','<>','-1')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '4'){ $Model = new Dudzeq(); $bill_ids = $this->filtrateBillIds($Model,'ats_dudzeq',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('dudzeq.id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->with('user')->order('createtime desc')->where('status','<>','-1')->select(); $staffModel = new \addons\qingdong\model\Staff(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); $item['admin_id'] = $staffModel->where('id', $item['admin_id'])->value('name'); } } //招聘 elseif ($param['type'] == '5'){ $Model = new Wbvnia(); $bill_ids = $this->filtrateBillIds($Model,'ats_wbvnia',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //用车 elseif ($param['type'] == '6'){ $Model = new Nidsvn(); $bill_ids = $this->filtrateBillIds($Model,'ats_nidsvn',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //用章 elseif ($param['type'] == '7'){ $Model = new Wduzfa(); $bill_ids = $this->filtrateBillIds($Model,'ats_wduzfa',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('wduzfa.id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->with(['business','customer'])->order('createtime desc')->where('status','<>','-1')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '8'){ $Model = new Xnsdti(); $bill_ids = $this->filtrateBillIds($Model,'ats_xnsdti',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('xnsdti.id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->with(['business','customer'])->order('createtime desc')->where('status','<>','-1')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '9'){ $Model = new Mowpvu(); $bill_ids = $this->filtrateBillIds($Model,'ats_mowpvu',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //离职申请 elseif ($param['type'] == '10'){ $Model = new Kmqpxi(); $bill_ids = $this->filtrateBillIds($Model,'ats_kmqpxi',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); $staffModel = new \addons\qingdong\model\Staff(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); $item['admin_id'] = $staffModel->where('id', $item['admin_id'])->value('name'); } } //业务费预申请 elseif ($param['type'] == '11'){ $Model = new Havols(); $bill_ids = $this->filtrateBillIds($Model,'ats_havols',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //临时单次报销 elseif ($param['type'] == '12'){ $Model = new Jxbunq(); $bill_ids = $this->filtrateBillIds($Model,'ats_jxbunq',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //产品样品借样 elseif ($param['type'] == '13'){ $Model = new Zaxsta(); $bill_ids = $this->filtrateBillIds($Model,'ats_zaxsta',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('zaxsta.id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->with(['business','customer'])->order('createtime desc')->where('status','<>','-1')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '14'){ $Model = new Dbxovs(); $bill_ids = $this->filtrateBillIds($Model,'ats_dbxovs',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //物品领用 elseif ($param['type'] == '15'){ $Model = new Yoirpj(); $bill_ids = $this->filtrateBillIds($Model,'ats_yoirpj',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //设备赠送 elseif ($param['type'] == '16'){ $Model = new Zmqrbq(); $bill_ids = $this->filtrateBillIds($Model,'ats_zmqrbq',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('zmqrbq.id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->with(['business','customer'])->order('createtime desc')->where('status','<>','-1')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '17'){ $Model = new Kiahkj(); $bill_ids = $this->filtrateBillIds($Model,'ats_kiahkj',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //报价申请 elseif ($param['type'] == '18'){ $Model = new Czgprz(); $bill_ids = $this->filtrateBillIds($Model,'ats_czgprz',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '19'){ $Model = new Bywnpk(); $bill_ids = $this->filtrateBillIds($Model,'ats_bywnpk',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); $CzgprzModel = new Czgprz(); $customerModel = new \addons\qingdong\model\Customer(); $businessModel = new \addons\qingdong\model\Business(); foreach ($list as &$item) { $item['bill_name'] = $billrule->where('id',$param['type'])->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'] == '20'){ $Model = new Txdphj(); $bill_ids = $this->filtrateBillIds($Model,'ats_txdphj',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //入库申请确认 elseif ($param['type'] == '21'){ $Model = new Jiopho(); $bill_ids = $this->filtrateBillIds($Model,'ats_jiopho',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //调薪申请 elseif ($param['type'] == '22'){ $Model = new Hwgvrz(); $bill_ids = $this->filtrateBillIds($Model,'ats_hwgvrz',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //外出申请 elseif ($param['type'] == '23'){ $Model = new Stwoae(); $bill_ids = $this->filtrateBillIds($Model,'ats_stwoae',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } elseif ($param['type'] == '24'){ $Model = new Asiitn(); $bill_ids = $this->filtrateBillIds($Model,'ats_asiitn',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } elseif ($param['type'] == '25'){ $Model = new Ekmdnj(); $bill_ids = $this->filtrateBillIds($Model,'ats_ekmdnj',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } elseif ($param['type'] == '26'){ $Model = new Tmrxyo(); $bill_ids = $this->filtrateBillIds($Model,'ats_tmrxyo',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } }elseif ($param['type'] == '27'){ $Model = new Jtokfr(); $bill_ids = $this->filtrateBillIds($Model,'ats_jtokfr',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } elseif ($param['type'] == '28'){ $Model = new Bdobmf(); $bill_ids = $this->filtrateBillIds($Model,'ats_bdobmf',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); $item['lozowlhp'] = $item['lozowlhp_text']; } } elseif ($param['type'] == '29'){ $Model = new Htbncr(); $bill_ids = $this->filtrateBillIds($Model,'ats_htbncr',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } elseif ($param['type'] == '30'){ $Model = new Nbmmpv(); $bill_ids = $this->filtrateBillIds($Model,'ats_nbmmpv',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } //采购申请 elseif ($param['type'] == '31'){ $Model = new Jmhbgp(); $bill_ids = $this->filtrateBillIds($Model,'ats_jmhbgp',$type); if (is_array($bill_ids) && empty($bill_ids)) { $this->success('',[]); } if (is_array($bill_ids) && !empty($bill_ids)) { $Model->where('id in (' . implode(',', $bill_ids) . ')'); } $list = $Model->order('createtime desc')->where('status','<>','-1')->select(); foreach ($list as &$item){ $item['bill_name'] = $billrule->where('id',$param['type'])->value('bill_name'); } } foreach($list as &$item){ $check_type = Db::name('fastflow_thread_log') ->where('bill',$item['bill'])->where('bill_id',$item['id'])->order('id desc')->value('check_type'); if($check_type==7){ $item->status = 4; } } $this->success('',$list); } public function getCzgprz(){ $list = (new Czgprz())->where('initiator_id',$this->auth->id)->select(); $this->success('',$list); } //获取能查看的单据ids public function filtrateBillIds($model,$bill,$type) { $auth_row = (new \app\admin\model\fastflow\flow\BillAuth())->where(['bill' => $bill])->find(); if ($auth_row) { $rules = json_decode($auth_row['rules'], true); if (isset($rules['view'])) { $view_rule = $rules['view']; } } $canCheck_ids = []; //$needStart_ids = []; $mine_ids = []; $participant_ids = []; $user_id = $this->auth->id; $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->getGroups(); //halt($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']; } $canCheck_ids = array_unique($canCheck_ids); //$needStartBill_rows = $model->where(['initiator_id' => $user_id, 'status' => 0])->field('id')->select();//待发起单据 //foreach ($needStartBill_rows as $needStartBill_row) { // $needStart_ids[] = $needStartBill_row['id']; //} $mineBill_rows = $model->where(['initiator_id' => $user_id])->field('id')->select(); foreach ($mineBill_rows as $mineBill_row) { $mine_ids[] = $mineBill_row['id']; } $participantIndex_rows = ParticipantIndex::where(['bill' => $bill, 'worker_id' => $user_id])->select(); foreach ($participantIndex_rows as $participantIndex_row) { $participant_ids[] = $participantIndex_row['bill_id']; } //halt($participant_ids); if($type == '1'){ $canView_ids = $canCheck_ids; //待审批 }elseif ($type == '2'){ $canView_ids = $participant_ids; //已审批 }elseif ($type == '3'){ $canView_ids = $mine_ids; //我发起的审批 }else{ $canView_ids = array_merge($mine_ids, $canCheck_ids, $participant_ids); } //halt(array_unique($canView_ids)); return array_unique($canView_ids); } public function getGroups(){ $uid = $this->auth->id; $user_groups = Db::name('auth_group_access') ->alias('aga') ->join('ats_auth_group ag', 'aga.group_id = ag.id', 'LEFT') ->field('aga.uid, aga.group_id, ag.id, ag.pid, ag.name, ag.rules') ->where("aga.uid='{$uid}' and ag.status='normal'") ->select(); $groupIds = []; foreach ($user_groups as $K => $v) { $groupIds[] = (int)$v['group_id']; } return $groupIds; } }