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\OpenPlatform\Authorizer\MiniProgram\Code; |
13
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\BaseClient; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Class Client. |
18
|
|
|
* |
19
|
|
|
* @author mingyoung <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class Client extends BaseClient |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @param int $templateId |
25
|
|
|
* @param string $extJson |
26
|
|
|
* @param string $version |
27
|
|
|
* @param string $description |
28
|
|
|
* |
29
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
30
|
|
|
* |
31
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
32
|
|
|
*/ |
33
|
1 |
|
public function commit(int $templateId, string $extJson, string $version, string $description) |
34
|
|
|
{ |
35
|
1 |
|
return $this->httpPostJson('wxa/commit', [ |
36
|
1 |
|
'template_id' => $templateId, |
37
|
1 |
|
'ext_json' => $extJson, |
38
|
1 |
|
'user_version' => $version, |
39
|
1 |
|
'user_desc' => $description, |
40
|
|
|
]); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string|null $path |
45
|
|
|
* |
46
|
|
|
* @return \EasyWeChat\Kernel\Http\Response |
47
|
|
|
* |
48
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
49
|
|
|
*/ |
50
|
2 |
|
public function getQrCode(string $path = null) |
51
|
|
|
{ |
52
|
2 |
|
return $this->requestRaw('wxa/get_qrcode', 'GET', [ |
53
|
2 |
|
'query' => ['path' => $path], |
54
|
|
|
]); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
59
|
|
|
* |
60
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
61
|
|
|
*/ |
62
|
1 |
|
public function getCategory() |
63
|
|
|
{ |
64
|
1 |
|
return $this->httpGet('wxa/get_category'); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
69
|
|
|
* |
70
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
71
|
|
|
*/ |
72
|
1 |
|
public function getPage() |
73
|
|
|
{ |
74
|
1 |
|
return $this->httpGet('wxa/get_page'); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param array $itemList |
79
|
|
|
* |
80
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
81
|
|
|
* |
82
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
83
|
|
|
*/ |
84
|
1 |
|
public function submitAudit(array $itemList) |
85
|
|
|
{ |
86
|
1 |
|
return $this->httpPostJson('wxa/submit_audit', [ |
87
|
1 |
|
'item_list' => $itemList, |
88
|
|
|
]); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param int $auditId |
93
|
|
|
* |
94
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
95
|
|
|
* |
96
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
97
|
|
|
*/ |
98
|
1 |
|
public function getAuditStatus(int $auditId) |
99
|
|
|
{ |
100
|
1 |
|
return $this->httpPostJson('wxa/get_auditstatus', [ |
101
|
1 |
|
'auditid' => $auditId, |
102
|
|
|
]); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
107
|
|
|
* |
108
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
109
|
|
|
*/ |
110
|
1 |
|
public function getLatestAuditStatus() |
111
|
|
|
{ |
112
|
1 |
|
return $this->httpGet('wxa/get_latest_auditstatus'); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
117
|
|
|
* |
118
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
119
|
|
|
*/ |
120
|
1 |
|
public function release() |
121
|
|
|
{ |
122
|
1 |
|
return $this->httpPostJson('wxa/release'); |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
127
|
|
|
* |
128
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
129
|
|
|
*/ |
130
|
1 |
|
public function withdrawAudit() |
131
|
|
|
{ |
132
|
1 |
|
return $this->httpGet('wxa/undocodeaudit'); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
137
|
|
|
* |
138
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
139
|
|
|
*/ |
140
|
1 |
|
public function rollbackRelease() |
141
|
|
|
{ |
142
|
1 |
|
return $this->httpGet('wxa/revertcoderelease'); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @param string $action |
147
|
|
|
* |
148
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
149
|
|
|
* |
150
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
151
|
|
|
*/ |
152
|
1 |
|
public function changeVisitStatus(string $action) |
153
|
|
|
{ |
154
|
1 |
|
return $this->httpPostJson('wxa/change_visitstatus', [ |
155
|
1 |
|
'action' => $action, |
156
|
|
|
]); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* 分阶段发布. |
161
|
|
|
* |
162
|
|
|
* @param int $grayPercentage |
163
|
|
|
* |
164
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
165
|
|
|
* |
166
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
167
|
|
|
*/ |
168
|
1 |
|
public function grayRelease(int $grayPercentage) |
169
|
|
|
{ |
170
|
1 |
|
return $this->httpPostJson('wxa/grayrelease', [ |
171
|
1 |
|
'gray_percentage' => $grayPercentage, |
172
|
|
|
]); |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* 取消分阶段发布. |
177
|
|
|
* |
178
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
179
|
|
|
* |
180
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
181
|
|
|
*/ |
182
|
1 |
|
public function revertGrayRelease() |
183
|
|
|
{ |
184
|
1 |
|
return $this->httpGet('wxa/revertgrayrelease'); |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* 查询当前分阶段发布详情. |
189
|
|
|
* |
190
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
191
|
|
|
* |
192
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
193
|
|
|
*/ |
194
|
1 |
|
public function getGrayRelease() |
195
|
|
|
{ |
196
|
1 |
|
return $this->httpGet('wxa/getgrayreleaseplan'); |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* 查询当前设置的最低基础库版本及各版本用户占比. |
201
|
|
|
* |
202
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
203
|
|
|
* |
204
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
205
|
|
|
*/ |
206
|
|
|
public function getSupportVersion() |
207
|
|
|
{ |
208
|
|
|
return $this->httpPostJson('cgi-bin/wxopen/getweappsupportversion'); |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* 设置最低基础库版本. |
213
|
|
|
* |
214
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
215
|
|
|
* |
216
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
217
|
|
|
*/ |
218
|
|
|
public function setSupportVersion(string $version) |
219
|
|
|
{ |
220
|
|
|
return $this->httpPostJson('cgi-bin/wxopen/setweappsupportversion', [ |
221
|
|
|
'version' => $version, |
222
|
|
|
]); |
223
|
|
|
} |
224
|
|
|
} |
225
|
|
|
|