接收到微信验证请求 返回纯文本

This commit is contained in:
wangw 2025-10-20 16:27:23 +08:00
parent a826af831c
commit 166d550fe6
1 changed files with 7 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import com.czg.account.service.UserInfoService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Controller;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
@ -16,7 +16,7 @@ import java.util.Arrays;
* @description
*/
@Slf4j
@Controller
@RestController
@RequestMapping("/notify")
public class NotifyController {
@ -27,12 +27,15 @@ public class NotifyController {
private static final String TOKEN = "DZjyHBq3nTujF0NM1dnXikU8ZCvy";
@GetMapping
@GetMapping(produces = MediaType.TEXT_PLAIN_VALUE)
public String notify(@RequestParam String signature, @RequestParam String timestamp, @RequestParam String nonce, @RequestParam String echostr) {
log.info("接收到微信验证请求 - signature: {}, timestamp: {}, nonce: {}, echostr: {}",
signature, timestamp, nonce, echostr);
return echostr;
// // 1. 校验参数完整性
}
// // 1. 校验参数完整性
// if (signature == null || timestamp == null || nonce == null) {
// log.error("验证失败:参数不完整");
// return "";
@ -58,5 +61,4 @@ public class NotifyController {
// log.error("签名验证失败 - 本地加密: {}, 微信签名: {}", encryptedStr, signature);
// return "";
// }
}
}