@@ 46-53 (lines=8) @@ | ||
43 | * |
|
44 | * @return int |
|
45 | */ |
|
46 | public function create($name) |
|
47 | { |
|
48 | $params = [ |
|
49 | 'group' => ['name' => $name], |
|
50 | ]; |
|
51 | ||
52 | return $this->parseJSON('json', [self::API_CREATE, $params]); |
|
53 | } |
|
54 | ||
55 | /** |
|
56 | * List all groups. |
|
@@ 73-83 (lines=11) @@ | ||
70 | * |
|
71 | * @return bool |
|
72 | */ |
|
73 | public function update($groupId, $name) |
|
74 | { |
|
75 | $params = [ |
|
76 | 'group' => [ |
|
77 | 'id' => $groupId, |
|
78 | 'name' => $name, |
|
79 | ], |
|
80 | ]; |
|
81 | ||
82 | return $this->parseJSON('json', [self::API_UPDATE, $params]); |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * Delete group. |
|
@@ 92-99 (lines=8) @@ | ||
89 | * |
|
90 | * @return bool |
|
91 | */ |
|
92 | public function delete($groupId) |
|
93 | { |
|
94 | $params = [ |
|
95 | 'group' => ['id' => $groupId], |
|
96 | ]; |
|
97 | ||
98 | return $this->parseJSON('json', [self::API_DELETE, $params]); |
|
99 | } |
|
100 | ||
101 | /** |
|
102 | * Get user group. |
@@ 47-54 (lines=8) @@ | ||
44 | * |
|
45 | * @return int |
|
46 | */ |
|
47 | public function create($name) |
|
48 | { |
|
49 | $params = [ |
|
50 | 'tag' => ['name' => $name], |
|
51 | ]; |
|
52 | ||
53 | return $this->parseJSON('json', [self::API_CREATE, $params]); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * List all tags. |
@@ 187-194 (lines=8) @@ | ||
184 | return $this->parseJSON('get', [self::API_DEV_STAT, $params]); |
|
185 | } |
|
186 | ||
187 | public function verifyQrcode($ticket) |
|
188 | { |
|
189 | $params = [ |
|
190 | 'ticket' => $ticket, |
|
191 | ]; |
|
192 | ||
193 | return $this->parseJSON('post', [self::API_DEV_VERIFY_QRCODE, $params]); |
|
194 | } |
|
195 | ||
196 | public function getOpenid($deviceId) |
|
197 | { |
|
@@ 206-213 (lines=8) @@ | ||
203 | return $this->parseJSON('get', [self::API_DEV_GET_OPENID, $params]); |
|
204 | } |
|
205 | ||
206 | public function getDeviceidByOpenid($openid) |
|
207 | { |
|
208 | $params = [ |
|
209 | 'openid' => $openid, |
|
210 | ]; |
|
211 | ||
212 | return $this->parseJSON('get', [self::API_USER_DEV_BIND, $params]); |
|
213 | } |
|
214 | } |
|
215 |
@@ 45-52 (lines=8) @@ | ||
42 | * |
|
43 | * @return \EasyWeChat\Support\Collection |
|
44 | */ |
|
45 | public function add($name) |
|
46 | { |
|
47 | $params = [ |
|
48 | 'group_name' => $name, |
|
49 | ]; |
|
50 | ||
51 | return $this->parseJSON('json', [self::API_ADD, $params]); |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * Update a device group name. |
|
@@ 62-70 (lines=9) @@ | ||
59 | * |
|
60 | * @return \EasyWeChat\Support\Collection |
|
61 | */ |
|
62 | public function update($groupId, $name) |
|
63 | { |
|
64 | $params = [ |
|
65 | 'group_id' => intval($groupId), |
|
66 | 'group_name' => $name, |
|
67 | ]; |
|
68 | ||
69 | return $this->parseJSON('json', [self::API_UPDATE, $params]); |
|
70 | } |
|
71 | ||
72 | /** |
|
73 | * Delete device group. |
@@ 97-105 (lines=9) @@ | ||
94 | * |
|
95 | * @return \EasyWeChat\Support\Collection |
|
96 | */ |
|
97 | public function fetchByIds(array $page_ids) |
|
98 | { |
|
99 | $params = [ |
|
100 | 'type' => 1, |
|
101 | 'page_ids' => $page_ids, |
|
102 | ]; |
|
103 | ||
104 | return $this->parseJSON('json', [self::API_SEARCH, $params]); |
|
105 | } |
|
106 | ||
107 | /** |
|
108 | * Pagination to fetch batch of pages. |