瀏覽代碼

新增微信接口校验

hsj 1 月之前
父節點
當前提交
cb6222443b
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/main/java/top/husj/husj_wx/controller/WeChatController.java

+ 2 - 2
src/main/java/top/husj/husj_wx/controller/WeChatController.java

@@ -27,10 +27,10 @@ public class WeChatController {
             @RequestParam("echostr") String echostr) throws AesException {
 
         log.info("收到微信服务器验证请求 - signature: {}, timestamp: {}, nonce: {}",
-                weChatProperties.getToken(), timestamp, nonce);
+                signature, timestamp, nonce);
 
         // 校验签名
-        String sha1 = SHA1.getSHA1("", timestamp, nonce);
+        String sha1 = SHA1.getSHA1(weChatProperties.getToken(), timestamp, nonce);
         if (sha1.equals(echostr)) {
             log.info("微信服务器验证成功");
             return echostr;