From cdbcb4198cb4b242c517a1b07b10b5f212a55fd0 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 23 七月 2021 10:22:00 +0800
Subject: [PATCH] 修改bug

---
 springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/WxOfficialApi.java |   10 ++++------
 1 files changed, 4 insertions(+), 6 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 9aa69de..9e3d6ca 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
@@ -6,7 +6,6 @@
 import com.panzhihua.common.utlis.StringUtils;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.checkerframework.checker.units.qual.A;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.*;
@@ -67,13 +66,13 @@
         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<>();
         map.put("type", "news"); // news表示图文类型的素材,具体看API文档
         map.put("offset", 0);
-        map.put("count", 10);
+        map.put("count", 5);
         // 将map转换成json字符串
         String paramBody = JSON.toJSONString(map); // 这里用了Alibaba的fastjson
 
@@ -87,16 +86,15 @@
         int len = -1;
         StringBuffer sb = new StringBuffer();
         while((len = in.read(b)) != -1) {
-            sb.append(new String(b,0,len));
+            sb.append(new String(b,0,len,"UTF-8"));
         }
 
         in.close();
         return sb.toString();
     }
 
-
     @ApiOperation(value = "拉取公众号列表")
-    @GetMapping("/list/noToken")
+    @GetMapping(value = "/list/noToken",produces="application/json;charset=UTF-8")
     public R pageDiscuss() throws Exception{
         WxOfficialApi officialApi = new WxOfficialApi();
 

--
Gitblit v1.7.1