Site.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. * 获取appid
  12. *
  13. * @return mixed
  14. */
  15. public function getAppid()
  16. {
  17. return (string)getProp($this->site, 'appid');
  18. }
  19. /**
  20. * 获取app_token
  21. *
  22. * @return mixed
  23. */
  24. public function getAppToken()
  25. {
  26. return (string)getProp($this->site, 'app_token');
  27. }
  28. /**
  29. * 获取公司名
  30. *
  31. * @return mixed
  32. */
  33. public function getCompanyName()
  34. {
  35. return (string)getProp($this->site, 'company_name');
  36. }
  37. /**
  38. * 获取appid
  39. *
  40. * @return mixed
  41. */
  42. public function getCompanyId()
  43. {
  44. return (string)getProp($this->site, 'company_id');
  45. }
  46. /**
  47. * 获取channel_id
  48. *
  49. * @return mixed
  50. */
  51. public function getChannelId()
  52. {
  53. return (array)getProp($this->site, 'channel_id');
  54. }
  55. /**
  56. * 设置全局返回报错数据
  57. *
  58. * @param $data
  59. */
  60. public function setErrorResponseData($data)
  61. {
  62. $this->site->errorResponseData = $data;
  63. }
  64. /**
  65. * 获取全局返回报错数据
  66. *
  67. * @return mixed|string
  68. */
  69. public function getErrorResponseData()
  70. {
  71. return getProp($this->site, 'errorResponseData', []);
  72. }
  73. }