- 微信jsapi发起支付,回调解析body是空的?
微信jsapi发起支付,回调解析body是空的? private String getRequestBody(HttpServletRequest request) { try { InputStream inStream = request.getInputStream(); ByteArrayOutputStream outSteam = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int len = 0; while ((len = inStream.read(buffer)) != -1) { outSteam.write(buffer, 0, len); } outSteam.close(); inStream.close(); String result = new String(outSteam.toByteArray(), "utf-8");// 获取微信调用我们notify_url的返回信息 return result; } catch (IOException e) { throw new RuntimeException(e); } } /** * 读取请求数据流 * body空值 */ private String getRequestBody1(HttpServletRequest request) { StringBuffer sb = new StringBuffer(); try (ServletInputStream inputStream = request.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); ) { String line; while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException e) { throw new IllegalArgumentException(e); } return sb.toString(); } /** * 返回空 * @param request * @return */ private String getRequestBody2(HttpServletRequest request) { ByteArrayOutputStream body = new ByteArrayOutputStream(); try { ServletInputStream inputStream = request.getInputStream(); byte[] buffer = new byte[1024]; for (int length; (length = inputStream.read(buffer)) != -1; ) { body.write(buffer, 0, length); } } catch (IOException ex) { logger.error("支付回调,读取数据流异常", ex); } logger.info("支付回调,通知消息体:"+ body); return body.toString(); } String body = null; try { body = IOUtils.toString(request.getInputStream()); } catch (IOException e) { throw new RuntimeException(e); } 这是微信返回时,解析body的4种方法,返回body都是空的,后台报错 [图片] out_trade_no: 98d1328ee5f04a039fa59005311f9e64 24d4f66459fb4fb08daa763f7f31a8f3 1322dc6e96784df0a273c983d1561e35 48ce7137e59b4de9bc32c43c2676b297 05c3e8b9bbec4e3190dcd625bfd9f3f9 d55a45f8137a45538b8150f3e746d800 66804d1f8ab84d1da15a558ebf6b7f4e c46849e2fa0e45aba98848e1c316bcec
06-27 - 内容安全验证?
{"errcode":0,"errmsg":"ok"} 检查一段文本是否含有违法违规内容(POST) http://127.0.0.1/hfitsOA//upload/images/2019-11-14/head_cx.png {"errcode":0,"errmsg":"ok","trace_id":"9e63416bca510d92f55f632d90225065"} 异步校验图片/音频是否含有违法违规内容(POST) y已近加了内容验证,调取POST https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN接口,现在返回的就是正常的,这个这样,小程序审核不过,很无奈啊
2021-02-11