Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,9 @@ public static String wxMpOutXmlMessageToEncryptedXml(WxMpXmlOutMessage message,

public static WxOpenXmlMessage fromXml(String xml) {
//修改微信变态的消息内容格式,方便解析
xml = xml.replace("</PicList><PicList>", "");
if (xml != null) {
xml = xml.replace("</PicList><PicList>", "");
}
return XStreamTransformer.fromXml(WxOpenXmlMessage.class, xml);
}

Expand All @@ -321,6 +323,11 @@ public static WxOpenXmlMessage fromEncryptedXml(String encryptedXml, WxOpenConfi
WxOpenCryptUtil cryptUtil = new WxOpenCryptUtil(wxOpenConfigStorage);
String plainText = cryptUtil.decryptXml(msgSignature, timestamp, nonce, encryptedXml);
log.debug("解密后的原始xml消息内容:{}", plainText);

if (plainText == null || plainText.trim().isEmpty()) {
throw new WxRuntimeException("解密后的xml消息内容为空,请检查加密参数是否正确");
}

WxOpenXmlMessage wxOpenXmlMessage = fromXml(plainText);
wxOpenXmlMessage.setContext(plainText);
return wxOpenXmlMessage;
Expand Down