1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* This file is part of the wannanbigpig/alipay-sdk-php. |
4
|
|
|
* |
5
|
|
|
* (c) wannanbigpig <[email protected]> |
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
|
|
|
|
11
|
|
|
namespace EasyAlipay\MiniProgram\Version; |
12
|
|
|
|
13
|
|
|
use EasyAlipay\Kernel\Support\Support; |
14
|
|
|
|
15
|
|
|
class Client extends Support |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* alipay.open.mini.version.gray.cancel(小程序结束灰度). |
19
|
|
|
* |
20
|
|
|
* @param string $appVersion |
21
|
|
|
* |
22
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
23
|
|
|
* |
24
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
25
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
26
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
27
|
|
|
*/ |
28
|
|
|
public function grayCancel(string $appVersion) |
29
|
|
|
{ |
30
|
|
|
$method = 'alipay.open.mini.version.gray.cancel'; |
31
|
|
|
$params = [ |
32
|
|
|
'app_version' => $appVersion, |
33
|
|
|
]; |
34
|
|
|
|
35
|
|
|
return $this->request($method, [ |
36
|
|
|
'biz_content' => $params, |
37
|
|
|
]); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* alipay.open.mini.version.delete(小程序删除版本). |
42
|
|
|
* |
43
|
|
|
* @param string $appVersion |
44
|
|
|
* |
45
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
46
|
|
|
* |
47
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
48
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
49
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
50
|
|
|
*/ |
51
|
|
|
public function delete(string $appVersion) |
52
|
|
|
{ |
53
|
|
|
$method = 'alipay.open.mini.version.delete'; |
54
|
|
|
$params = [ |
55
|
|
|
'app_version' => $appVersion, |
56
|
|
|
]; |
57
|
|
|
|
58
|
|
|
return $this->request($method, [ |
59
|
|
|
'biz_content' => $params, |
60
|
|
|
]); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* alipay.open.mini.version.upload(小程序基于模板上传版本). |
65
|
|
|
* |
66
|
|
|
* @param string $templateId |
67
|
|
|
* @param string $appVersion |
68
|
|
|
* @param string|null $templateVersion |
69
|
|
|
* @param string|null $ext |
70
|
|
|
* |
71
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
72
|
|
|
* |
73
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
74
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
75
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
76
|
|
|
*/ |
77
|
|
|
public function upload(string $templateId, string $appVersion, string $templateVersion = null, string $ext = null) |
78
|
|
|
{ |
79
|
|
|
$method = 'alipay.open.agent.create'; |
80
|
|
|
$params = array_filter([ |
81
|
|
|
'template_version' => $templateVersion, |
82
|
|
|
'ext' => $ext, |
83
|
|
|
'template_id' => $templateId, |
84
|
|
|
'app_version' => $appVersion, |
85
|
|
|
], function ($value) { |
86
|
|
|
return !($this->checkEmpty($value)); |
87
|
|
|
}); |
88
|
|
|
|
89
|
|
|
return $this->request($method, [ |
90
|
|
|
'biz_content' => $params, |
91
|
|
|
]); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* alipay.open.mini.version.gray.online(小程序灰度上架). |
96
|
|
|
* |
97
|
|
|
* @param string $appVersion |
98
|
|
|
* @param string $grayStrategy |
99
|
|
|
* |
100
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
101
|
|
|
* |
102
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
103
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
104
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
105
|
|
|
*/ |
106
|
|
|
public function grayOnline(string $appVersion, string $grayStrategy) |
107
|
|
|
{ |
108
|
|
|
$method = 'alipay.open.mini.version.delete'; |
109
|
|
|
$params = [ |
110
|
|
|
'app_version' => $appVersion, |
111
|
|
|
'gray_strategy' => $grayStrategy, |
112
|
|
|
]; |
113
|
|
|
|
114
|
|
|
return $this->request($method, [ |
115
|
|
|
'biz_content' => $params, |
116
|
|
|
]); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* alipay.open.mini.version.build.query(小程序查询版本构建状态). |
121
|
|
|
* |
122
|
|
|
* @param string $appVersion |
123
|
|
|
* |
124
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
125
|
|
|
* |
126
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
127
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
128
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
129
|
|
|
*/ |
130
|
|
|
public function buildQuery(string $appVersion) |
131
|
|
|
{ |
132
|
|
|
$method = 'alipay.open.mini.version.build.query'; |
133
|
|
|
$params = [ |
134
|
|
|
'app_version' => $appVersion, |
135
|
|
|
]; |
136
|
|
|
|
137
|
|
|
return $this->request($method, [ |
138
|
|
|
'biz_content' => $params, |
139
|
|
|
]); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* alipay.open.mini.version.audited.cancel(小程序退回开发). |
144
|
|
|
* |
145
|
|
|
* @param string $appVersion |
146
|
|
|
* |
147
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
148
|
|
|
* |
149
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
150
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
151
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
152
|
|
|
*/ |
153
|
|
|
public function cancelAudited(string $appVersion) |
154
|
|
|
{ |
155
|
|
|
$method = 'alipay.open.mini.version.audited.cancel'; |
156
|
|
|
$params = [ |
157
|
|
|
'app_version' => $appVersion, |
158
|
|
|
]; |
159
|
|
|
|
160
|
|
|
return $this->request($method, [ |
161
|
|
|
'biz_content' => $params, |
162
|
|
|
]); |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* alipay.open.mini.version.offline(小程序下架). |
167
|
|
|
* |
168
|
|
|
* @param string $appVersion |
169
|
|
|
* |
170
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
171
|
|
|
* |
172
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
173
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
174
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
175
|
|
|
*/ |
176
|
|
|
public function offline(string $appVersion) |
177
|
|
|
{ |
178
|
|
|
$method = 'alipay.open.mini.version.offline'; |
179
|
|
|
$params = [ |
180
|
|
|
'app_version' => $appVersion, |
181
|
|
|
]; |
182
|
|
|
|
183
|
|
|
return $this->request($method, [ |
184
|
|
|
'biz_content' => $params, |
185
|
|
|
]); |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* alipay.open.mini.version.list.query(小程序版本列表查询). |
190
|
|
|
* |
191
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
192
|
|
|
* |
193
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
194
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
195
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
196
|
|
|
*/ |
197
|
|
|
public function getList() |
198
|
|
|
{ |
199
|
|
|
$method = 'alipay.open.mini.version.list.query'; |
200
|
|
|
$params = []; |
201
|
|
|
|
202
|
|
|
return $this->request($method, [ |
203
|
|
|
'biz_content' => $params, |
204
|
|
|
]); |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* alipay.open.mini.experience.create(小程序生成体验版). |
209
|
|
|
* |
210
|
|
|
* @param string $appVersion |
211
|
|
|
* |
212
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
213
|
|
|
* |
214
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
215
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
216
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
217
|
|
|
*/ |
218
|
|
|
public function createExperience(string $appVersion) |
219
|
|
|
{ |
220
|
|
|
$method = 'alipay.open.mini.experience.create'; |
221
|
|
|
$params = [ |
222
|
|
|
'app_version' => $appVersion, |
223
|
|
|
]; |
224
|
|
|
|
225
|
|
|
return $this->request($method, [ |
226
|
|
|
'biz_content' => $params, |
227
|
|
|
]); |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* alipay.open.mini.experience.cancel(小程序取消体验版). |
232
|
|
|
* |
233
|
|
|
* @param string $appVersion |
234
|
|
|
* |
235
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
236
|
|
|
* |
237
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
238
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
239
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
240
|
|
|
*/ |
241
|
|
|
public function cancelExperience(string $appVersion) |
242
|
|
|
{ |
243
|
|
|
$method = 'alipay.open.mini.experience.cancel'; |
244
|
|
|
$params = [ |
245
|
|
|
'app_version' => $appVersion, |
246
|
|
|
]; |
247
|
|
|
|
248
|
|
|
return $this->request($method, [ |
249
|
|
|
'biz_content' => $params, |
250
|
|
|
]); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* alipay.open.mini.experience.query(小程序体验版状态查询接口). |
255
|
|
|
* |
256
|
|
|
* @param string $appVersion |
257
|
|
|
* |
258
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
259
|
|
|
* |
260
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
261
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
262
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
263
|
|
|
*/ |
264
|
|
|
public function queryExperience(string $appVersion) |
265
|
|
|
{ |
266
|
|
|
$method = 'alipay.open.mini.experience.query'; |
267
|
|
|
$params = [ |
268
|
|
|
'app_version' => $appVersion, |
269
|
|
|
]; |
270
|
|
|
|
271
|
|
|
return $this->request($method, [ |
272
|
|
|
'biz_content' => $params, |
273
|
|
|
]); |
274
|
|
|
} |
275
|
|
|
|
276
|
|
|
/** |
277
|
|
|
* alipay.open.mini.version.online(小程序上架). |
278
|
|
|
* |
279
|
|
|
* @param string $appVersion |
280
|
|
|
* |
281
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
282
|
|
|
* |
283
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
284
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
285
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
286
|
|
|
*/ |
287
|
|
|
public function online(string $appVersion) |
288
|
|
|
{ |
289
|
|
|
$method = 'alipay.open.mini.version.online'; |
290
|
|
|
$params = [ |
291
|
|
|
'app_version' => $appVersion, |
292
|
|
|
]; |
293
|
|
|
|
294
|
|
|
return $this->request($method, [ |
295
|
|
|
'biz_content' => $params, |
296
|
|
|
]); |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* alipay.open.mini.version.detail.query(小程序版本详情查询). |
301
|
|
|
* |
302
|
|
|
* @param string $appVersion |
303
|
|
|
* |
304
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
305
|
|
|
* |
306
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
307
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
308
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
309
|
|
|
*/ |
310
|
|
|
public function getDetail(string $appVersion) |
311
|
|
|
{ |
312
|
|
|
$method = 'alipay.open.mini.version.detail.query'; |
313
|
|
|
$params = [ |
314
|
|
|
'app_version' => $appVersion, |
315
|
|
|
]; |
316
|
|
|
|
317
|
|
|
return $this->request($method, [ |
318
|
|
|
'biz_content' => $params, |
319
|
|
|
]); |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* alipay.open.mini.version.rollback(小程序回滚). |
324
|
|
|
* |
325
|
|
|
* @param string $appVersion |
326
|
|
|
* |
327
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
328
|
|
|
* |
329
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
330
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
331
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
332
|
|
|
*/ |
333
|
|
|
public function rollback(string $appVersion) |
334
|
|
|
{ |
335
|
|
|
$method = 'alipay.open.mini.version.rollback'; |
336
|
|
|
$params = [ |
337
|
|
|
'app_version' => $appVersion, |
338
|
|
|
]; |
339
|
|
|
|
340
|
|
|
return $this->request($method, [ |
341
|
|
|
'biz_content' => $params, |
342
|
|
|
]); |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* alipay.open.mini.version.audit.apply(小程序提交审核). |
347
|
|
|
* |
348
|
|
|
* @param array $params |
349
|
|
|
* |
350
|
|
|
* @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response |
351
|
|
|
* |
352
|
|
|
* @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException |
353
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
354
|
|
|
* @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException |
355
|
|
|
*/ |
356
|
|
|
public function submitAudit(array $params) |
357
|
|
|
{ |
358
|
|
|
$method = 'alipay.open.mini.version.rollback'; |
359
|
|
|
|
360
|
|
|
return $this->request($method, [ |
361
|
|
|
'biz_content' => $params, |
362
|
|
|
]); |
363
|
|
|
} |
364
|
|
|
} |
365
|
|
|
|