AdminTerminalEnum.php 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /**
  16. * @notes 是否为租户端
  17. * @return bool
  18. * @author JXDN
  19. * @date 2024/09/04 16:44
  20. */
  21. public static function isTenant()
  22. {
  23. return request()->source === self::TENANT;
  24. }
  25. /**
  26. * @notes 是否为平台端
  27. * @return bool
  28. * @author JXDN
  29. * @date 2024/09/04 16:44
  30. */
  31. public static function isPlatform()
  32. {
  33. return request()->source === self::PLATFORM;
  34. }
  35. /**
  36. * @notes 是否为用户端
  37. * @return bool
  38. * @author JXDN
  39. * @date 2024/09/04 16:44
  40. */
  41. public static function isUser()
  42. {
  43. return request()->source === self::USER;
  44. }
  45. }