From c0a22479225d8cce92a2204721382e926b4da6c2 Mon Sep 17 00:00:00 2001 From: lihualing Date: Fri, 30 Aug 2019 10:59:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?WxaAPI=20=E6=96=B0=E5=A2=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=92=A4=E5=9B=9E=20WxaAPI=20=E6=96=B0=E5=A2=9E=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/weixin/popular/api/WxaAPI.java | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/main/java/weixin/popular/api/WxaAPI.java b/src/main/java/weixin/popular/api/WxaAPI.java index 966b2187..ece4be33 100644 --- a/src/main/java/weixin/popular/api/WxaAPI.java +++ b/src/main/java/weixin/popular/api/WxaAPI.java @@ -273,6 +273,38 @@ public static BaseResult release(String access_token){ .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); } + + /** + * 代码管理
+ * 小程序审核撤回(仅供第三方代小程序调用) + * @since 2.8.29 + * @param access_token access_token + * @return result + */ + public static BaseResult undocodeaudit(String access_token) { + HttpUriRequest httpUriRequest = RequestBuilder.get() + .setHeader(jsonHeader) + .setUri(BASE_URI + "/wxa/undocodeaudit") + .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) + .build(); + return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); + } + + /** + * 代码管理
+ * 小程序版本回退(仅供第三方代小程序调用) + * @since 2.8.29 + * @param access_token access_token + * @return result + */ + public static BaseResult revertcoderelease(String access_token) { + HttpUriRequest httpUriRequest = RequestBuilder.get() + .setHeader(jsonHeader) + .setUri(BASE_URI + "/wxa/revertcoderelease") + .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) + .build(); + return LocalHttpClient.executeJsonResult(httpUriRequest,BaseResult.class); + } /** * 代码管理
From fd655747be74981270426e65056d0a1b0ddcb71f Mon Sep 17 00:00:00 2001 From: lihualing Date: Tue, 3 Dec 2019 11:16:19 +0800 Subject: [PATCH 2/3] change version undocodeaudit & revertcoderelease --- src/main/java/weixin/popular/api/WxaAPI.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/weixin/popular/api/WxaAPI.java b/src/main/java/weixin/popular/api/WxaAPI.java index ece4be33..71f727fe 100644 --- a/src/main/java/weixin/popular/api/WxaAPI.java +++ b/src/main/java/weixin/popular/api/WxaAPI.java @@ -277,7 +277,7 @@ public static BaseResult release(String access_token){ /** * 代码管理
* 小程序审核撤回(仅供第三方代小程序调用) - * @since 2.8.29 + * @since 2.8.30 * @param access_token access_token * @return result */ @@ -293,7 +293,7 @@ public static BaseResult undocodeaudit(String access_token) { /** * 代码管理
* 小程序版本回退(仅供第三方代小程序调用) - * @since 2.8.29 + * @since 2.8.30 * @param access_token access_token * @return result */ From 6e5c2501b277953ff31e7d81683e66305e502012 Mon Sep 17 00:00:00 2001 From: lihualing Date: Tue, 3 Dec 2019 11:59:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Add:=20=E6=96=B0=E5=A2=9E=E7=94=9F=E6=88=90?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=A0=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=88=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/weixin/popular/api/WxaAPI.java | 51 ++++++++++++++++++- .../popular/bean/wxa/WxaCodeResult.java | 18 +++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 src/main/java/weixin/popular/bean/wxa/WxaCodeResult.java diff --git a/src/main/java/weixin/popular/api/WxaAPI.java b/src/main/java/weixin/popular/api/WxaAPI.java index 71f727fe..653e07cb 100644 --- a/src/main/java/weixin/popular/api/WxaAPI.java +++ b/src/main/java/weixin/popular/api/WxaAPI.java @@ -6,6 +6,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import javax.imageio.ImageIO; @@ -396,7 +397,55 @@ public static BufferedImage getwxacodeunlimit(String access_token,Getwxacodeunli } return null; } - + + /** + * 获取小程序码 B
+ * 适用于需要的码数量极多,或仅临时使用的业务场景
+ * 注意:通过该接口生成的小程序码,永久有效,数量暂无限制。用户扫描该码进入小程序后,将统一打开首页,开发者需在首页根据获取的码中 scene 字段的值,再做处理逻辑。 + * @since 2.8.30 + * @param access_token access_token + * @param getwxacodeunlimit getwxacodeunlimit + * @return WxaCodeResult WxaCodeResult + */ + public static WxaCodeResult getwxacodeunlimitresult(String access_token,Getwxacodeunlimit getwxacodeunlimit){ + String json = JsonUtil.toJSONString(getwxacodeunlimit); + HttpUriRequest httpUriRequest = RequestBuilder.post() + .setHeader(jsonHeader) + .setUri(BASE_URI + "/wxa/getwxacodeunlimit") + .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) + .setEntity(new StringEntity(json,Charset.forName("utf-8"))) + .build(); + CloseableHttpResponse httpResponse = LocalHttpClient.execute(httpUriRequest); + try { + int status = httpResponse.getStatusLine().getStatusCode(); + WxaCodeResult wxaCodeResult; + byte[] bytes = null; + if (status == 200) { + bytes = EntityUtils.toByteArray(httpResponse.getEntity()); + BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(bytes)); + if(bufferedImage != null) { + wxaCodeResult = new WxaCodeResult(); + wxaCodeResult.setBufferedImage(bufferedImage); + return wxaCodeResult; + } + } + if (status >= 200 && status < 300 && bytes != null) { + String str = new String(bytes, StandardCharsets.UTF_8); + wxaCodeResult = JsonUtil.parseObject(str, WxaCodeResult.class); + return wxaCodeResult; + } + } catch (IOException e) { + logger.error("", e); + } finally { + try { + httpResponse.close(); + } catch (IOException e) { + logger.error("", e); + } + } + return null; + } + /** * 附近 添加地点 * @since 2.8.18 diff --git a/src/main/java/weixin/popular/bean/wxa/WxaCodeResult.java b/src/main/java/weixin/popular/bean/wxa/WxaCodeResult.java new file mode 100644 index 00000000..a992387e --- /dev/null +++ b/src/main/java/weixin/popular/bean/wxa/WxaCodeResult.java @@ -0,0 +1,18 @@ +package weixin.popular.bean.wxa; + +import weixin.popular.bean.BaseResult; + +import java.awt.image.BufferedImage; + +public class WxaCodeResult extends BaseResult { + + private BufferedImage bufferedImage; + + public BufferedImage getBufferedImage() { + return bufferedImage; + } + + public void setBufferedImage(BufferedImage bufferedImage) { + this.bufferedImage = bufferedImage; + } +}