Skip to content

Commit ee94e6d

Browse files
authored
🆕 #2958 【企业微信】增加第三放服务商应用消息推送时转换加密的XML格式方法
1 parent a726e37 commit ee94e6d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlOutMessage.java

+13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
77
import me.chanjar.weixin.cp.bean.outxmlbuilder.*;
88
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
9+
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
910
import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil;
11+
import me.chanjar.weixin.cp.util.crypto.WxCpTpCryptUtil;
1012
import me.chanjar.weixin.cp.util.xml.XStreamTransformer;
1113

1214
import java.io.Serializable;
@@ -141,4 +143,15 @@ public String toEncryptedXml(WxCpConfigStorage wxCpConfigStorage) {
141143
WxCpCryptUtil pc = new WxCpCryptUtil(wxCpConfigStorage);
142144
return pc.encrypt(plainXml);
143145
}
146+
147+
/**
148+
* 企业微信服务商 转换加密的xml 格式
149+
* @param wxCpTpConfigStorage th wx cp tp config storage
150+
* @return the string
151+
*/
152+
public String toEncryptedXml(WxCpTpConfigStorage wxCpTpConfigStorage) {
153+
String plainXml = toXml();
154+
WxCpTpCryptUtil pc = new WxCpTpCryptUtil(wxCpTpConfigStorage);
155+
return pc.encrypt(plainXml);
156+
}
144157
}

0 commit comments

Comments
 (0)