AuthController.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\adminapi\controller;
  3. use crmeb\basic\BaseController;
  4. /**
  5. * 基类 所有控制器继承的类
  6. * Class AuthController
  7. * @package app\adminapi\controller
  8. */
  9. class AuthController extends BaseController
  10. {
  11. /**
  12. * 当前登陆管理员信息
  13. * @var
  14. */
  15. protected $adminInfo;
  16. /**
  17. * 当前登陆管理员ID
  18. * @var
  19. */
  20. protected $adminId;
  21. /**
  22. * 当前登录的地址
  23. * @var
  24. */
  25. protected $merId;
  26. /**
  27. * 当前管理员权限
  28. * @var array
  29. */
  30. protected $auth = [];
  31. /**
  32. * 模型类名
  33. * @var null
  34. */
  35. protected $bindModel = null;
  36. /**
  37. * 初始化
  38. */
  39. protected function initialize()
  40. {
  41. parent::initialize();
  42. $this->adminId = $this->request->adminId();
  43. $this->adminInfo = $this->request->adminInfo();
  44. $this->merId = $this->request->mer_id();
  45. $this->auth = $this->request->adminInfo['rule'] ?? [];
  46. event('AdminVisit', [$this->adminInfo, 'system', $this->merId]);
  47. }
  48. }