| | |
| | | */ |
| | | package me.zhengjie.modules.temp.service.impl; |
| | | |
| | | import ch.ethz.ssh2.crypto.digest.SHA1; |
| | | import me.zhengjie.modules.temp.domain.WechatSendHistory; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.temp.repository.WechatSendHistoryRepository; |
| | | import me.zhengjie.modules.temp.service.WechatSendHistoryService; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.io.PrintWriter; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String approvalBack(String msgSignature, String timestamp, String nonce, String echostr, HttpServletResponse response) { |
| | | public void approvalBack(String msgSignature, String timestamp, String nonce, String echostr, HttpServletResponse response) { |
| | | try { |
| | | WXBizJsonMsgCrypt wxcpt = new WXBizJsonMsgCrypt(TOKEN, ENCODING_AES_KEY, CORP_ID); |
| | | return wxcpt.VerifyURL(msgSignature, timestamp, nonce, echostr); |
| | | // 设置响应内容类型为纯文本 |
| | | response.setContentType("text/plain; charset=UTF-8"); |
| | | // 获取PrintWriter对象 |
| | | PrintWriter out = response.getWriter(); |
| | | // 直接返回 |
| | | String message = wxcpt.VerifyURL(msgSignature, timestamp, nonce, echostr); |
| | | out.print(message); |
| | | // 刷新并关闭PrintWriter |
| | | out.flush(); |
| | | out.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |