|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the overtrue/wechat. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) overtrue <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace EasyWeChat\OfficialAccount\WiFi; |
|
13
|
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\BaseClient; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class ShopClient. |
|
18
|
|
|
* |
|
19
|
|
|
* @author her-cat <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class ShopClient extends BaseClient |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Get shop Wi-Fi information. |
|
25
|
|
|
* |
|
26
|
|
|
* @param int $shopId |
|
27
|
|
|
* |
|
28
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
29
|
|
|
* |
|
30
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
31
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
32
|
|
|
*/ |
|
33
|
1 |
|
public function get(int $shopId) |
|
34
|
|
|
{ |
|
35
|
1 |
|
return $this->httpPostJson('bizwifi/shop/get', ['shop_id' => $shopId]); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Get a list of Wi-Fi shops. |
|
40
|
|
|
* |
|
41
|
|
|
* @param int $page |
|
42
|
|
|
* @param int $size |
|
43
|
|
|
* |
|
44
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
45
|
|
|
* |
|
46
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
47
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
48
|
|
|
*/ |
|
49
|
1 |
|
public function list(int $page = 1, int $size = 10) |
|
50
|
|
|
{ |
|
51
|
|
|
$data = [ |
|
52
|
1 |
|
'pageindex' => $page, |
|
53
|
1 |
|
'pagesize' => $size, |
|
54
|
|
|
]; |
|
55
|
|
|
|
|
56
|
1 |
|
return $this->httpPostJson('bizwifi/shop/list', $data); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Update shop Wi-Fi information. |
|
61
|
|
|
* |
|
62
|
|
|
* @param int $shopId |
|
63
|
|
|
* @param array $data |
|
64
|
|
|
* |
|
65
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
66
|
|
|
* |
|
67
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
68
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
69
|
|
|
*/ |
|
70
|
1 |
|
public function update(int $shopId, array $data) |
|
71
|
|
|
{ |
|
72
|
1 |
|
$data = array_merge(['shop_id' => $shopId], $data); |
|
73
|
|
|
|
|
74
|
1 |
|
return $this->httpPostJson('bizwifi/shop/update', $data); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Clear shop network and equipment. |
|
79
|
|
|
* |
|
80
|
|
|
* @param int $shopId |
|
81
|
|
|
* @param string|null $ssid |
|
82
|
|
|
* |
|
83
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
84
|
|
|
* |
|
85
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
86
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
87
|
|
|
*/ |
|
88
|
1 |
|
public function clearDevice(int $shopId, string $ssid = null) |
|
89
|
|
|
{ |
|
90
|
|
|
$data = [ |
|
91
|
1 |
|
'shop_id' => $shopId, |
|
92
|
|
|
]; |
|
93
|
|
|
|
|
94
|
1 |
|
if (!is_null($ssid)) { |
|
95
|
1 |
|
$data['ssid'] = $ssid; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
1 |
|
return $this->httpPostJson('bizwifi/shop/clean', $data); |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|