diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WechatCalllbackController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WechatCalllbackController.java index c0cac16db..aa0694fa1 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WechatCalllbackController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WechatCalllbackController.java @@ -12,8 +12,12 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; +import java.io.InputStream; + @RestController -@RequestMapping("wxOpen") +@RequestMapping("/wxOpen") public class WechatCalllbackController extends BaseController { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @@ -21,10 +25,15 @@ public class WechatCalllbackController extends BaseController { protected WxOpenService wxOpenService; @RequestMapping("/notify") - public Object receiveTicket(@RequestBody(required = false) String requestBody, @RequestParam("timestamp") String timestamp, - @RequestParam("nonce") String nonce, @RequestParam("signature") String signature, - @RequestParam(name = "encrypt_type", required = false) String encType, - @RequestParam(name = "msg_signature", required = false) String msgSignature) { + public Object receiveTicket(HttpServletRequest request) throws IOException { + logger.info("[" +getIpAddr() + "]接收微信请求"); + InputStream inStream = request.getInputStream(); + byte[] buffer = new byte[1024]; + int len = 0; + while ((len = inStream.read(buffer)) != -1) { + logger.debug(buffer.toString()); + } + /* logger.info( "\n接收微信请求:[signature=[{}], encType=[{}], msgSignature=[{}]," + " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ", @@ -45,7 +54,7 @@ public class WechatCalllbackController extends BaseController { } catch (WxErrorException e) { this.logger.error("notify", e); } - + */ return "success"; }