AuthController.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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\cashier;
  12. use crmeb\basic\BaseController;
  13. /**
  14. * 基类 所有控制器继承的类
  15. * Class AuthController
  16. * @package app\controller\admin
  17. * @method success($msg = 'ok', array $data = [])
  18. * @method fail($msg = 'error', array $data = [])
  19. */
  20. class AuthController extends BaseController
  21. {
  22. /**
  23. * 门店整体类型1:平台2:门店
  24. * @var int
  25. */
  26. protected $type = 2;
  27. /**
  28. * 当前登录门店信息
  29. * @var
  30. */
  31. protected $storeInfo;
  32. /**
  33. * 当前登门店ID
  34. * @var
  35. */
  36. protected $storeId;
  37. /**
  38. * 当前登录门店店员ID
  39. * @var
  40. */
  41. protected $cashierId;
  42. /**
  43. * 当前登录门店店员信息
  44. * @var
  45. */
  46. protected $cashierInfo;
  47. /**
  48. * 当前管理员权限
  49. * @var array
  50. */
  51. protected $auth = [];
  52. /**
  53. * 初始化
  54. */
  55. protected function initialize()
  56. {
  57. $this->storeId = $this->request->hasMacro('storeId') ? $this->request->storeId() : 0;
  58. $this->cashierId = $this->request->hasMacro('cashierId') ? $this->request->cashierId() : 0;
  59. $this->cashierInfo = $this->request->hasMacro('cashierInfo') ? $this->request->cashierInfo() : [];
  60. $this->auth = $this->cashierInfo['rule'] ?? [];
  61. }
  62. }