zhaops 5 yıl önce
ebeveyn
işleme
178dcea86f

+ 11 - 1
zzcx-service/src/main/java/com/diagbot/web/WexinController.java

@@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
@@ -42,11 +44,19 @@ public class WexinController {
     @RequestMapping(value = "/test", method = RequestMethod.GET, produces = { "application/json;charset=utf-8" })
     @ApiOperation(value = "测试微信公众号的接口配置信息", notes = "接口配置信息", httpMethod = "GET")
     public String getWxUserInfo(HttpServletRequest request,
-                                @ApiParam(value = "微信求的 echostr") @RequestParam(required = true) String echostr
+                                @ApiParam(value = "微信求的 echostr") String echostr
     ) {
         try {
+            Map<String, String> map = new LinkedHashMap<>();
             //只需要把微信请求的 echostr, 返回给微信就可以了
             log.info("测试来过===================" + echostr);
+            Enumeration pNames = request.getParameterNames();
+            while (pNames.hasMoreElements()) {
+                String name = (String) pNames.nextElement();
+                String value = request.getParameter(name);
+                map.put(name, value);
+            }
+            log.info(map.toString());
             return echostr;
         } catch (Exception e) {
             log.info("测试微信公众号的接口配置信息发生异常:", e);