Client.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /*
  3. * This file is part of the overtrue/wechat.
  4. *
  5. * (c) overtrue <i@overtrue.me>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace EasyWeChat\OfficialAccount\WiFi;
  11. use EasyWeChat\Kernel\BaseClient;
  12. /**
  13. * Class Client.
  14. *
  15. * @author her-cat <i@her-cat.com>
  16. */
  17. class Client extends BaseClient
  18. {
  19. /**
  20. * Get Wi-Fi statistics.
  21. *
  22. * @param string $beginDate
  23. * @param string $endDate
  24. * @param int $shopId
  25. *
  26. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  27. *
  28. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  29. * @throws \GuzzleHttp\Exception\GuzzleException
  30. */
  31. public function summary(string $beginDate, string $endDate, int $shopId = -1)
  32. {
  33. $data = [
  34. 'begin_date' => $beginDate,
  35. 'end_date' => $endDate,
  36. 'shop_id' => $shopId,
  37. ];
  38. return $this->httpPostJson('bizwifi/statistics/list', $data);
  39. }
  40. /**
  41. * Get the material QR code.
  42. *
  43. * @param int $shopId
  44. * @param string $ssid
  45. * @param int $type
  46. *
  47. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  48. *
  49. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  50. * @throws \GuzzleHttp\Exception\GuzzleException
  51. */
  52. public function getQrCodeUrl(int $shopId, string $ssid, int $type = 0)
  53. {
  54. $data = [
  55. 'shop_id' => $shopId,
  56. 'ssid' => $ssid,
  57. 'img_id' => $type,
  58. ];
  59. return $this->httpPostJson('bizwifi/qrcode/get', $data);
  60. }
  61. /**
  62. * Wi-Fi completion page jump applet.
  63. *
  64. * @param array $data
  65. *
  66. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  67. *
  68. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  69. * @throws \GuzzleHttp\Exception\GuzzleException
  70. */
  71. public function setFinishPage(array $data)
  72. {
  73. return $this->httpPostJson('bizwifi/finishpage/set', $data);
  74. }
  75. /**
  76. * Set the top banner jump applet.
  77. *
  78. * @param array $data
  79. *
  80. * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
  81. *
  82. * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
  83. * @throws \GuzzleHttp\Exception\GuzzleException
  84. */
  85. public function setHomePage(array $data)
  86. {
  87. return $this->httpPostJson('bizwifi/homepage/set', $data);
  88. }
  89. }