123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- <?php
- /*
- * @description: 费用管理控制类 @Author: CP @Date: 2020-11-11 17:51:05 @FilePath: \cld\protected\controller\fee\fee_controller.php
- */
- require "protected/services/software_service.php";
- // require "protected/services/region_service.php";
- // require "protected/services/office_service.php";
- // require "protected/services/staff_service.php";
- require "protected/class/comm_cld.php";
- class dashboard_controller extends DooController {
- private $softwareService;
- private $staff;
-
-
- //获得面板软件锁个数
- public function GetJsonDashboardSoftwareCount(){
-
- // include Doo::conf()->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" );
- }
- }
-
-
-
-
-
-
- }
- ?>
|