fee_controller.php 3.8 KB

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