AdminTerminalEnum.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\common\enum;
  3. /**
  4. * 管理后台登录终端
  5. * Class terminalEnum
  6. * @package app\common\enum
  7. */
  8. class AdminTerminalEnum
  9. {
  10. const PC = 1;
  11. const MOBILE = 2;
  12. const PLATFORM = '__saas__platform__';
  13. const TENANT = '__saas__tenant__';
  14. const USER = '__saas__user__';
  15. const Worker = '__saas__worker__';
  16. /**
  17. * @notes 是否为租户端
  18. * @return bool
  19. * @author JXDN
  20. * @date 2024/09/04 16:44
  21. */
  22. public static function isTenant()
  23. {
  24. return request()->source === self::TENANT;
  25. }
  26. /**
  27. * @notes 是否为平台端
  28. * @return bool
  29. * @author JXDN
  30. * @date 2024/09/04 16:44
  31. */
  32. public static function isPlatform()
  33. {
  34. return request()->source === self::PLATFORM;
  35. }
  36. /**
  37. * @notes 是否为用户端
  38. * @return bool
  39. * @author JXDN
  40. * @date 2024/09/04 16:44
  41. */
  42. public static function isUser()
  43. {
  44. return request()->source === self::USER;
  45. }
  46. /**
  47. * @notes 是否为工程师端
  48. * @return bool
  49. * @author JXDN
  50. * @date 2024/09/04 16:44
  51. */
  52. public static function isWorker()
  53. {
  54. return request()->source === self::Worker;
  55. }
  56. }