微信公衆平臺-服務器配置

/**
* 服務器配置(微信公衆平臺)
* @param request
* @param response
* @throws IOException
*/
@GetMapping(value = "/conf")
public void wxconf(HttpServletRequest request, HttpServletResponse response) throws IOException {
String signature=request.getParameter("signature");
String timestamp=request.getParameter("timestamp");
String nonce=request.getParameter("nonce");
String echostr=request.getParameter("echostr");
String token = "abc";//這裏填基本配置中的token
String jiami = "";
try {
jiami=SHA1.getSHA1(token, timestamp, nonce,"");//這裏是對三個參數進行加密
} catch (AesException e) {
e.printStackTrace();
}
System.out.println("加密"+jiami);
System.out.println("本身"+signature);
PrintWriter out=response.getWriter();
if(jiami.equals(signature))
out.print(echostr);
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章