Site.php 826 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Client;
  3. class Site
  4. {
  5. protected $site;
  6. public function __construct()
  7. {
  8. $this->site = app()->make('siteData');
  9. }
  10. /**
  11. * 获取用户id
  12. *
  13. * @return mixed
  14. */
  15. public function getUid()
  16. {
  17. return (int)getProp($this->site, 'uid');
  18. }
  19. /**
  20. * 获取用户角色
  21. *
  22. * @return mixed
  23. */
  24. public function getRole()
  25. {
  26. return (string)getProp($this->site, 'role');
  27. }
  28. /**
  29. * 获取用户昵称
  30. *
  31. * @return mixed
  32. */
  33. public function getNickname()
  34. {
  35. return (string)getProp($this->site, 'nickname');
  36. }
  37. /**
  38. * 获取用户token
  39. *
  40. * @return mixed
  41. */
  42. public function getToken()
  43. {
  44. return (string)getProp($this->site, 'token');
  45. }
  46. }