|
6 | 6 | import java.io.IOException; |
7 | 7 | import java.io.InputStream; |
8 | 8 | import java.nio.charset.Charset; |
| 9 | +import java.nio.charset.StandardCharsets; |
9 | 10 |
|
10 | 11 | import javax.imageio.ImageIO; |
11 | 12 |
|
@@ -273,6 +274,38 @@ public static BaseResult release(String access_token){ |
273 | 274 | .build(); |
274 | 275 | return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); |
275 | 276 | } |
| 277 | + |
| 278 | + /** |
| 279 | + * 代码管理<br> |
| 280 | + * 小程序审核撤回(仅供第三方代小程序调用) |
| 281 | + * @since 2.8.30 |
| 282 | + * @param access_token access_token |
| 283 | + * @return result |
| 284 | + */ |
| 285 | + public static BaseResult undocodeaudit(String access_token) { |
| 286 | + HttpUriRequest httpUriRequest = RequestBuilder.get() |
| 287 | + .setHeader(jsonHeader) |
| 288 | + .setUri(BASE_URI + "/wxa/undocodeaudit") |
| 289 | + .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) |
| 290 | + .build(); |
| 291 | + return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); |
| 292 | + } |
| 293 | + |
| 294 | + /** |
| 295 | + * 代码管理<br> |
| 296 | + * 小程序版本回退(仅供第三方代小程序调用) |
| 297 | + * @since 2.8.30 |
| 298 | + * @param access_token access_token |
| 299 | + * @return result |
| 300 | + */ |
| 301 | + public static BaseResult revertcoderelease(String access_token) { |
| 302 | + HttpUriRequest httpUriRequest = RequestBuilder.get() |
| 303 | + .setHeader(jsonHeader) |
| 304 | + .setUri(BASE_URI + "/wxa/revertcoderelease") |
| 305 | + .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) |
| 306 | + .build(); |
| 307 | + return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); |
| 308 | + } |
276 | 309 |
|
277 | 310 | /** |
278 | 311 | * 代码管理<br> |
@@ -364,7 +397,55 @@ public static BufferedImage getwxacodeunlimit(String access_token,Getwxacodeunli |
364 | 397 | } |
365 | 398 | return null; |
366 | 399 | } |
367 | | - |
| 400 | + |
| 401 | + /** |
| 402 | + * 获取小程序码 B<br> |
| 403 | + * 适用于需要的码数量极多,或仅临时使用的业务场景<br> |
| 404 | + * 注意:通过该接口生成的小程序码,永久有效,数量暂无限制。用户扫描该码进入小程序后,将统一打开首页,开发者需在首页根据获取的码中 scene 字段的值,再做处理逻辑。 |
| 405 | + * @since 2.8.30 |
| 406 | + * @param access_token access_token |
| 407 | + * @param getwxacodeunlimit getwxacodeunlimit |
| 408 | + * @return WxaCodeResult WxaCodeResult |
| 409 | + */ |
| 410 | + public static WxaCodeResult getwxacodeunlimitresult(String access_token,Getwxacodeunlimit getwxacodeunlimit){ |
| 411 | + String json = JsonUtil.toJSONString(getwxacodeunlimit); |
| 412 | + HttpUriRequest httpUriRequest = RequestBuilder.post() |
| 413 | + .setHeader(jsonHeader) |
| 414 | + .setUri(BASE_URI + "/wxa/getwxacodeunlimit") |
| 415 | + .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) |
| 416 | + .setEntity(new StringEntity(json,Charset.forName("utf-8"))) |
| 417 | + .build(); |
| 418 | + CloseableHttpResponse httpResponse = LocalHttpClient.execute(httpUriRequest); |
| 419 | + try { |
| 420 | + int status = httpResponse.getStatusLine().getStatusCode(); |
| 421 | + WxaCodeResult wxaCodeResult; |
| 422 | + byte[] bytes = null; |
| 423 | + if (status == 200) { |
| 424 | + bytes = EntityUtils.toByteArray(httpResponse.getEntity()); |
| 425 | + BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(bytes)); |
| 426 | + if(bufferedImage != null) { |
| 427 | + wxaCodeResult = new WxaCodeResult(); |
| 428 | + wxaCodeResult.setBufferedImage(bufferedImage); |
| 429 | + return wxaCodeResult; |
| 430 | + } |
| 431 | + } |
| 432 | + if (status >= 200 && status < 300 && bytes != null) { |
| 433 | + String str = new String(bytes, StandardCharsets.UTF_8); |
| 434 | + wxaCodeResult = JsonUtil.parseObject(str, WxaCodeResult.class); |
| 435 | + return wxaCodeResult; |
| 436 | + } |
| 437 | + } catch (IOException e) { |
| 438 | + logger.error("", e); |
| 439 | + } finally { |
| 440 | + try { |
| 441 | + httpResponse.close(); |
| 442 | + } catch (IOException e) { |
| 443 | + logger.error("", e); |
| 444 | + } |
| 445 | + } |
| 446 | + return null; |
| 447 | + } |
| 448 | + |
368 | 449 | /** |
369 | 450 | * 附近 添加地点 |
370 | 451 | * @since 2.8.18 |
|
0 commit comments