|
@@ -65,7 +65,8 @@ public class WechatServerServiceImpl implements WechatServerService {
|
|
String nonce = request.getParameter("nonce");
|
|
String nonce = request.getParameter("nonce");
|
|
String echostr = request.getParameter("echostr");
|
|
String echostr = request.getParameter("echostr");
|
|
log.info("验证消息的确来自微信服务器,signature:"+signature+",timestamp:"+timestamp+",nonce:"+nonce+",echostr:"+echostr);
|
|
log.info("验证消息的确来自微信服务器,signature:"+signature+",timestamp:"+timestamp+",nonce:"+nonce+",echostr:"+echostr);
|
|
- boolean flag = SignUtil.checkSignature(signature, timestamp, nonce);
|
|
|
|
|
|
+ boolean flag = StringUtils.hasLength(signature) && StringUtils.hasLength(timestamp) && StringUtils.hasLength(nonce);
|
|
|
|
+ flag = flag && SignUtil.checkSignature(signature, timestamp, nonce);
|
|
if (flag) {
|
|
if (flag) {
|
|
return echostr;
|
|
return echostr;
|
|
} else {
|
|
} else {
|
|
@@ -277,6 +278,7 @@ public class WechatServerServiceImpl implements WechatServerService {
|
|
*/
|
|
*/
|
|
private String setXmlByDatabaseReply(String openid, String wxType, WechatReply reply) {
|
|
private String setXmlByDatabaseReply(String openid, String wxType, WechatReply reply) {
|
|
if (null != reply) {
|
|
if (null != reply) {
|
|
|
|
+ log.info(">>>>>>>>>>匹配到自动回复:" + reply.getTitle() + ",素材Id:" + reply.getRelateId());
|
|
if ("news".equals(reply.getResponseType())) {
|
|
if ("news".equals(reply.getResponseType())) {
|
|
// 回复图文
|
|
// 回复图文
|
|
List<WechatArticleDetail> articleList = weChatDao.getArticleDetailList(reply.getRelateId());
|
|
List<WechatArticleDetail> articleList = weChatDao.getArticleDetailList(reply.getRelateId());
|
|
@@ -287,6 +289,7 @@ public class WechatServerServiceImpl implements WechatServerService {
|
|
} else {
|
|
} else {
|
|
// 回复文本
|
|
// 回复文本
|
|
String textContent = weChatDao.getTextContent(reply.getRelateId());
|
|
String textContent = weChatDao.getTextContent(reply.getRelateId());
|
|
|
|
+ log.info(">>>>>>>>>>匹配到回复文本字数:" + textContent.length());
|
|
if (StringUtils.hasLength(textContent)) {
|
|
if (StringUtils.hasLength(textContent)) {
|
|
return MessageUtil.setTextXml(openid, wxType, textContent);
|
|
return MessageUtil.setTextXml(openid, wxType, textContent);
|
|
}
|
|
}
|