提交 c98ea8a3 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 6c1a3542
package com.zrqx.pay.bg.controller;
import java.io.BufferedReader;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -54,12 +61,44 @@ public class AssetsController {
public CallBack<PageInfo<AssetsRecordVo>> getRecord(AssetsRecordQueryForm form, PageParam pageParam){
return CallBack.success(assetsService.getRecord(form, pageParam));
}
//======================================测试微信登录需要===================================
@ApiOperation(value = "获取授权Code", notes = "获取授权Code")
@GetMapping(value= "/vote/getCode")
public CallBack<String> getCode(String code){
return CallBack.success(code);
public CallBack<String> getCode(HttpServletRequest request, HttpServletResponse response) throws IOException{
processAuthorizeEvent(request);
log.info("==========接收推送参数11111111==============="+request);
log.info("==========接收推送参数10分钟一次==============="+request);
log.info("==========接收推送参数22222222==============="+response);
return CallBack.success();
}
public void processAuthorizeEvent(HttpServletRequest request) throws IOException{
String postStr = request.toString();
String nonce = request.getParameter("nonce");
String timestamp = request.getParameter("timestamp");
String signature = request.getParameter("signature");
String msgSignature = request.getParameter("msg_signature");
log.info("noce:{},timestamp:{}", nonce, timestamp);
log.info("signature:{},msgSignature:{}", signature, msgSignature);
if (!StringUtils.isNotBlank(msgSignature))
return;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息
StringBuilder sb = new StringBuilder();
BufferedReader in = request.getReader();
String line;
while ((line = in.readLine()) != null) {
sb.append(line);
}
String xml = sb.toString();
log.info("解密前:{}", xml);
/*
WXBizMsgCrypt wxBizMsgCrypt = new WXBizMsgCrypt(Constants.COMPONENT_TOKEN, Constants.COMPONENT_ENCODINGAESKEY, Constants.COMPONENT_APPID);
xml = wxBizMsgCrypt.decryptMsgTwo(msgSignature, timestamp, nonce, xml);
logger.info("解密后:{}", xml);
//把ticket放入缓存
openWxService.saveTicketToRedis(xml);*/
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论