From 1936559ec4565a4e9ac7ecf2844eca06c9712905 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期五, 23 七月 2021 10:42:47 +0800 Subject: [PATCH] 修改bug --- springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/WxOfficialApi.java | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/WxOfficialApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/WxOfficialApi.java index 9e3d6ca..7865967 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/WxOfficialApi.java +++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/WxOfficialApi.java @@ -66,7 +66,7 @@ HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); - connection.setRequestProperty("content-type", "application/json;charset=UTF-8"); + connection.setRequestProperty("content-type", "application/json;charset=utf-8"); connection.connect(); // post发送的参数 Map<String, Object> map = new HashMap<>(); @@ -82,11 +82,13 @@ bw.flush(); InputStream in = connection.getInputStream(); + BufferedReader br = new BufferedReader( + new InputStreamReader(in,"utf-8")); byte[] b = new byte[100]; int len = -1; StringBuffer sb = new StringBuffer(); - while((len = in.read(b)) != -1) { - sb.append(new String(b,0,len,"UTF-8")); + while((len = br.read()) != -1) { + sb.append(new String(b,0,len,"utf-8")); } in.close(); @@ -94,7 +96,7 @@ } @ApiOperation(value = "拉取公众号列表") - @GetMapping(value = "/list/noToken",produces="application/json;charset=UTF-8") + @GetMapping(value = "/list/noToken") public R pageDiscuss() throws Exception{ WxOfficialApi officialApi = new WxOfficialApi(); -- Gitblit v1.7.1