@RequestMapping(value = "member/getSignature", method = {RequestMethod.POST, RequestMethod.GET})
@NoRepeatSubmit
@ApiOperation(value = "消息回调")
@NoRepeatWebLog
public String getSignature(HttpServletRequest request, HttpServletResponse response) throws Exception {
//微信加密签名,signature结合了开发者填写的token参数和请求中的timestamp参数、nonce参数
boolean isGet = request.getMethod().toLowerCase().equals("get");
if (isGet) {
String signature = request.getParameter("signature");
// 时间戳
String timestamp = request.getParameter("timestamp");
// 随机数
String nonce = request.getParameter("nonce");
// 随机字符串
String echostr = request.getParameter("echostr");
log.info("echostr>>>>>>>>>>" + echostr);
//通过检验signature对请求进行校验,若校验成功则原样返回echostr,否则接入失败
if (WechatUtil.checkSignature(signature, timestamp, nonce)) {
log.info("echostr>>>>>>>>>>>>" + echostr);
System.out.println(echostr);
return echostr;
}
log.info("客服消息验证url验证结果:{}", echostr);
} else {
WechatUtil.response(request, response);
}
return null;
}
echostr>>>>>>>>>>5347601719758867709
客服消息验证url验证结果:5347601719758867709
乱七八糟的啥玩意啊,咋看