BASE_PATH.'diagnostic/debug.php'; // 1.获得参数 $data = array ( "staffId" => get_args ( 'staffId' ), "categoryId" => get_args ( 'categoryId' ) ?get_args ( 'categoryId' ) :GetDecryptId($this->staff['cid']), "year" => get_args ( 'year' ) ? get_args ( 'year' ):date("Y") ); //print_r($data); // $data = array ( // "staffId" => 94, // "categoryId" => 3, // "year" => 2021 // ); $data=$this->softwareService->GetSoftwareCount($data); echo json_encode(array( "status"=>"success", "totals"=>12, "data"=>$data, )); } public function beforeRun($resource, $action) { $this->accessAuth ( $resource, $action ); } function __construct() { include Doo::conf()->BASE_PATH.'diagnostic/debug.php'; $this->session (); $this->softwareService = new software_service (); } // 访问权限-费用管理 private function accessAuth($resource, $action) { Doo::loadClass ( 'XDeode' ); $XDeode = new XDeode ( 5 ); $sid = $XDeode->decode ( $_COOKIE ["staff"] ); // 1.单独判断公司汇总的访问权限 if ($action == 'companyCategoryCollect') { Doo::loadModel ( "receiptAuthorityManage" ); $invoiceCompanyManage = new receiptAuthorityManage (); $icm = $invoiceCompanyManage->getInvoiceCMByStaff ( $sid ); if (empty ( $icm )) die ( 'illegal request-无权访问该页面' ); } // 2.获得登陆用户信息 Doo::loadModel ( 'cld/staff_cld' ); $staff = new staff_cld (); $this->staff = $staff->Get ( $sid ); // 3.是否有权限访问 $accessModular = 'DASHBOARD'; if (empty ( $this->staff ['cldAccessArray'] )) { die ( 'illegal request-无权访问费用页面,向总部申请权限' ); } else { if (in_array ( "RECEIPTS", $this->staff ['cldAccessArray'] )) { if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) { $flag = true; } else { $flag = false; } } else { die ( 'illegal request-无权访问费用页面' ); } } if (! $flag) die ( 'illegal request-无权访问费用页面' ); } // 登陆判定 private function session() { if (isset ( $_COOKIE ["staff"] )) { if (! empty ( $_COOKIE ["staff"] )) { Doo::loadModel ( 'staff' ); Doo::loadModel ( 'verify' ); $verify = new verify (); $staff = new staff (); Doo::loadModel ( "execute" ); $execute = new execute (); $verifyList = $verify->find ( array ( 'select' => 'staff', 'asArray' => true ) ); $list = array (); // 判断角色的审批权限 foreach ( $verifyList as $key => $value ) { $ver = json_decode ( $value ['staff'] ); foreach ( $ver as $k => $v ) { if ($v [1] == 'ROLE') { $roleList = json_decode ( $v [3] ); foreach ( $roleList as $t => $g ) { $gList = explode ( "_", $g ); array_push ( $list, $gList [0] ); // print_r($list); } } else array_push ( $list, $v [0] ); } } // 判断执行人的审批权限 $executeList = $execute->find ( array ( 'where' => 'mold !="日常收支"', 'select' => 'staff', 'asArray' => true ) ); $list2 = array (); foreach ( $executeList as $key => $value ) { $ver = json_decode ( $value ['staff'] ); foreach ( $ver as $k => $v ) { array_push ( $list2, $v [0] ); } } $eidList = file_get_contents ( "protected/config/execute/execute.ini" ); $eidList = array_filter ( explode ( ",", $eidList ) ); $this->executeId = array_merge ( $list2, $eidList ); // print_r($this->executeId); $this->verifyId = $list; // $this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] ); return "/"; } } Doo::loadCore ( 'uri/DooUriRouter' ); $router = new DooUriRouter (); $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER ); if ($routeRs ['1'] != "login") { header ( 'Content-Type:text/html;charset=utf-8' ); @header ( "Location: /login" ); } } } ?>