AuthController.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\admin;
  12. use app\Request;
  13. use crmeb\basic\BaseController;
  14. /**
  15. * 基类 所有控制器继承的类
  16. * Class AuthController
  17. * @package app\controller\admin
  18. * @property Request $request
  19. * @property $services
  20. * @method success($message = '',array $data = [])
  21. * @method fail($message = '',array $data = [])
  22. */
  23. class AuthController extends BaseController
  24. {
  25. /**
  26. * 当前登陆管理员信息
  27. * @var
  28. */
  29. protected $adminInfo;
  30. /**
  31. * 当前登陆管理员ID
  32. * @var
  33. */
  34. protected $adminId;
  35. /**
  36. * 当前管理员权限
  37. * @var array
  38. */
  39. protected $auth = [];
  40. /**
  41. * 初始化
  42. */
  43. protected function initialize()
  44. {
  45. $this->adminId = $this->request->hasMacro('adminId') ? $this->request->adminId() : 0;
  46. $this->adminInfo = $this->request->hasMacro('adminInfo') ? $this->request->adminInfo() : [];
  47. $this->auth = $this->adminInfo['rule'] ?? [];
  48. }
  49. }