dashboard_controller.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. /*
  3. * @description: 费用管理控制类 @Author: CP @Date: 2020-11-11 17:51:05 @FilePath: \cld\protected\controller\fee\fee_controller.php
  4. */
  5. require "protected/services/software_service.php";
  6. // require "protected/services/region_service.php";
  7. // require "protected/services/office_service.php";
  8. // require "protected/services/staff_service.php";
  9. require "protected/class/comm_cld.php";
  10. class dashboard_controller extends DooController {
  11. private $softwareService;
  12. private $staff;
  13. //获得面板软件锁个数
  14. public function GetJsonDashboardSoftwareCount(){
  15. // include Doo::conf()->BASE_PATH.'diagnostic/debug.php';
  16. // 1.获得参数
  17. $data = array (
  18. "staffId" => get_args ( 'staffId' ),
  19. "categoryId" => get_args ( 'categoryId' ) ?get_args ( 'categoryId' ) :GetDecryptId($this->staff['cid']),
  20. "year" => get_args ( 'year' ) ? get_args ( 'year' ):date("Y")
  21. );
  22. //print_r($data);
  23. // $data = array (
  24. // "staffId" => 94,
  25. // "categoryId" => 3,
  26. // "year" => 2021
  27. // );
  28. $data=$this->softwareService->GetSoftwareCount($data);
  29. echo json_encode(array(
  30. "status"=>"success",
  31. "totals"=>12,
  32. "data"=>$data,
  33. ));
  34. }
  35. public function beforeRun($resource, $action) {
  36. $this->accessAuth ( $resource, $action );
  37. }
  38. function __construct() {
  39. include Doo::conf()->BASE_PATH.'diagnostic/debug.php';
  40. $this->session ();
  41. $this->softwareService = new software_service ();
  42. }
  43. // 访问权限-费用管理
  44. private function accessAuth($resource, $action) {
  45. Doo::loadClass ( 'XDeode' );
  46. $XDeode = new XDeode ( 5 );
  47. $sid = $XDeode->decode ( $_COOKIE ["staff"] );
  48. // 1.单独判断公司汇总的访问权限
  49. if ($action == 'companyCategoryCollect') {
  50. Doo::loadModel ( "receiptAuthorityManage" );
  51. $invoiceCompanyManage = new receiptAuthorityManage ();
  52. $icm = $invoiceCompanyManage->getInvoiceCMByStaff ( $sid );
  53. if (empty ( $icm ))
  54. die ( 'illegal request-无权访问该页面' );
  55. }
  56. // 2.获得登陆用户信息
  57. Doo::loadModel ( 'cld/staff_cld' );
  58. $staff = new staff_cld ();
  59. $this->staff = $staff->Get ( $sid );
  60. // 3.是否有权限访问
  61. $accessModular = 'DASHBOARD';
  62. if (empty ( $this->staff ['cldAccessArray'] )) {
  63. die ( 'illegal request-无权访问费用页面,向总部申请权限' );
  64. } else {
  65. if (in_array ( "RECEIPTS", $this->staff ['cldAccessArray'] )) {
  66. if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) {
  67. $flag = true;
  68. } else {
  69. $flag = false;
  70. }
  71. } else {
  72. die ( 'illegal request-无权访问费用页面' );
  73. }
  74. }
  75. if (! $flag)
  76. die ( 'illegal request-无权访问费用页面' );
  77. }
  78. // 登陆判定
  79. private function session() {
  80. if (isset ( $_COOKIE ["staff"] )) {
  81. if (! empty ( $_COOKIE ["staff"] )) {
  82. Doo::loadModel ( 'staff' );
  83. Doo::loadModel ( 'verify' );
  84. $verify = new verify ();
  85. $staff = new staff ();
  86. Doo::loadModel ( "execute" );
  87. $execute = new execute ();
  88. $verifyList = $verify->find ( array (
  89. 'select' => 'staff',
  90. 'asArray' => true
  91. ) );
  92. $list = array ();
  93. // 判断角色的审批权限
  94. foreach ( $verifyList as $key => $value ) {
  95. $ver = json_decode ( $value ['staff'] );
  96. foreach ( $ver as $k => $v ) {
  97. if ($v [1] == 'ROLE') {
  98. $roleList = json_decode ( $v [3] );
  99. foreach ( $roleList as $t => $g ) {
  100. $gList = explode ( "_", $g );
  101. array_push ( $list, $gList [0] );
  102. // print_r($list);
  103. }
  104. } else
  105. array_push ( $list, $v [0] );
  106. }
  107. }
  108. // 判断执行人的审批权限
  109. $executeList = $execute->find ( array (
  110. 'where' => 'mold !="日常收支"',
  111. 'select' => 'staff',
  112. 'asArray' => true
  113. ) );
  114. $list2 = array ();
  115. foreach ( $executeList as $key => $value ) {
  116. $ver = json_decode ( $value ['staff'] );
  117. foreach ( $ver as $k => $v ) {
  118. array_push ( $list2, $v [0] );
  119. }
  120. }
  121. $eidList = file_get_contents ( "protected/config/execute/execute.ini" );
  122. $eidList = array_filter ( explode ( ",", $eidList ) );
  123. $this->executeId = array_merge ( $list2, $eidList );
  124. // print_r($this->executeId);
  125. $this->verifyId = $list;
  126. // $this->staff = $staff->getUserByIdList ( $_COOKIE ["staff"] );
  127. return "/";
  128. }
  129. }
  130. Doo::loadCore ( 'uri/DooUriRouter' );
  131. $router = new DooUriRouter ();
  132. $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
  133. if ($routeRs ['1'] != "login") {
  134. header ( 'Content-Type:text/html;charset=utf-8' );
  135. @header ( "Location: /login" );
  136. }
  137. }
  138. }
  139. ?>