|
|
@@ -1,6 +1,7 @@
|
|
|
package com.kym.miniapp.controller;
|
|
|
|
|
|
|
|
|
+import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
import com.kym.common.annotation.ApiLog;
|
|
|
import com.kym.common.annotation.SysLog;
|
|
|
import com.kym.common.utils.wx.WxPbUtil;
|
|
|
@@ -34,11 +35,11 @@ public class WeixinMPController {
|
|
|
* @param request
|
|
|
*/
|
|
|
|
|
|
- @PostMapping(value = "notify", produces = MediaType.TEXT_XML_VALUE)
|
|
|
- @ApiLog(value = "微信公众号服务器推送消息", ignoreParams = true)
|
|
|
- public void handleMessage(HttpServletRequest request, HttpServletResponse response) {
|
|
|
- weixinMPService.handleWxMPNotify(request, response);
|
|
|
- }
|
|
|
+// @PostMapping(value = "notify", produces = MediaType.TEXT_XML_VALUE)
|
|
|
+// @ApiLog(value = "微信公众号服务器推送消息", ignoreParams = true)
|
|
|
+// public void handleMessage(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+// weixinMPService.handleWxMPNotify(request, response);
|
|
|
+// }
|
|
|
|
|
|
|
|
|
/*
|
|
|
@@ -49,30 +50,31 @@ public class WeixinMPController {
|
|
|
/**
|
|
|
* 微信服务器token验证
|
|
|
*/
|
|
|
-// @GetMapping(value = "notify")
|
|
|
-// @SysLog("微信服务器token验证")
|
|
|
-// public void checkSign(HttpServletResponse response, String signature, String timestamp, String nonce, String echostr) {
|
|
|
-// String responseVal = echostr;
|
|
|
-// try {
|
|
|
-//
|
|
|
-// boolean resp = WxPbUtil.checkSign(signature, timestamp, nonce);
|
|
|
-// if (!resp) {
|
|
|
-// responseVal = "failure";
|
|
|
-// log.error("wxpb check sign ERR!!!!");
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// responseVal = "failure";
|
|
|
-// } finally {
|
|
|
-// try {
|
|
|
-// PrintWriter writer = response.getWriter();
|
|
|
-// writer.print(responseVal);
|
|
|
-// writer.flush();
|
|
|
-// writer.close();
|
|
|
-// } catch (Exception e) {
|
|
|
-// log.error(e.getMessage(), e);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ @GetMapping(value = "notify")
|
|
|
+ @SaIgnore
|
|
|
+ @SysLog("微信服务器token验证")
|
|
|
+ public void checkSign(HttpServletResponse response, String signature, String timestamp, String nonce, String echostr) {
|
|
|
+ String responseVal = echostr;
|
|
|
+ try {
|
|
|
+
|
|
|
+ boolean resp = WxPbUtil.checkSign(signature, timestamp, nonce);
|
|
|
+ if (!resp) {
|
|
|
+ responseVal = "failure";
|
|
|
+ log.error("wxpb check sign ERR!!!!");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ responseVal = "failure";
|
|
|
+ } finally {
|
|
|
+ try {
|
|
|
+ PrintWriter writer = response.getWriter();
|
|
|
+ writer.print(responseVal);
|
|
|
+ writer.flush();
|
|
|
+ writer.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// @GetMapping(value = "/test")
|
|
|
// public void test() throws WxErrorException {
|