diff --git a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java
index 0f99519..a2872cb 100644
--- a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java
+++ b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java
@@ -43,6 +43,16 @@ public class WxMsgHandle {
}
return 1;
}, WxMsgType.收到转账之后或者文件助手等信息);
+ add(chatMsg -> {
+ if("filehelper".equals(chatMsg.getFromUser())){
+ Document document = XmlUtil.parseXml(chatMsg.getContent());
+ Element documentElement = document.getDocumentElement();
+ String username = documentElement.getAttribute("username");
+ String alias = documentElement.getAttribute("alias");
+ HttpSendUtil.发送文本(username);
+ }
+ return 1;
+ }, WxMsgType.收到名片);
add(chatMsg -> {
HttpSendUtil.通过好友请求(chatMsg);
return 1;
diff --git a/java_client/src/test/java/com/example/wxhk/tcp/XmlTest.java b/java_client/src/test/java/com/example/wxhk/tcp/XmlTest.java
index e4bf159..a26aeef 100644
--- a/java_client/src/test/java/com/example/wxhk/tcp/XmlTest.java
+++ b/java_client/src/test/java/com/example/wxhk/tcp/XmlTest.java
@@ -69,4 +69,16 @@ public class XmlTest {
WxMsgHandle.解析扫码支付第二段(new JsonObject(smg).mapTo(PrivateChatMsg.class));
}
+
+
+ @Test
+ void 解析名片(){
+ String con = "{\"content\":\"\\n\\n\",\"fromGroup\":\"filehelper\",\"fromUser\":\"filehelper\",\"isSendByPhone\":1,\"isSendMsg\":1,\"msgId\":3235211232446491438,\"pid\":21868,\"sign\":\"bfb1db52fe99dc947586af50e6964c37\",\"signature\":\"\\n\\tv1_aebFg5gw\\n\\t\\n\\t\\t<![CDATA[]]>\\n\\t\\n\\n\",\"time\":\"2023-06-01 16:48:39\",\"timestamp\":1685609319,\"type\":42}";
+ PrivateChatMsg privateChatMsg = new JsonObject(con).mapTo(PrivateChatMsg.class);
+ Document document = XmlUtil.parseXml(privateChatMsg.getContent());
+ Element documentElement = document.getDocumentElement();
+ String username = documentElement.getAttribute("username");
+ String alias = documentElement.getAttribute("alias");
+ Console.log(alias,username);
+ }
}