Skip to content

Commit c6b5ce6

Browse files
committed
fix binarywang#53 模板 消息发送后,微信服务推送的发送状态的xml结构信息内的msgID 没有被WxMpXmlMessage 识别
1 parent 28312a7 commit c6b5ce6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpXmlMessage.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ public void setFromUserName(String fromUserName) {
381381

382382
public static WxMpXmlMessage fromXml(String xml) {
383383
try {
384+
// 操蛋的微信,模板消息推送成功的消息是MsgID,其他消息推送过来是MsgId
385+
xml = xml.replaceAll("<MsgID>", "<MsgId>").replaceAll("</MsgID>", "</MsgID>");
384386
return XmlTransformer.fromXml(WxMpXmlMessage.class, xml);
385387
} catch (JAXBException e) {
386388
throw new RuntimeException(e);
@@ -389,8 +391,8 @@ public static WxMpXmlMessage fromXml(String xml) {
389391

390392
public static WxMpXmlMessage fromXml(InputStream is) {
391393
try {
392-
return XmlTransformer.fromXml(WxMpXmlMessage.class, is);
393-
} catch (JAXBException e) {
394+
return fromXml(IOUtils.toString(is, "UTF-8"));
395+
} catch (IOException e) {
394396
throw new RuntimeException(e);
395397
}
396398
}

0 commit comments

Comments
 (0)