From 2f4671706ed3b1ee2c417348cd48d5e779d8bd07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=88=E6=A3=AE=E5=90=B4?= <8402134@qq.com> Date: Sat, 12 Nov 2022 16:55:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E9=80=81=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E5=90=8D=E7=89=87xml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PCRobot.Pack/BaseMsg.cs | 2 +- PCRobot/PCRobotForm.cs | 5 ++++- .../WXSdk/Implement/WXClientImpl_HOOK.cs | 21 ++++++++++++++++++- .../WXSdk/Implement/WeixinBase.cs | 7 +++++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/PCRobot.Pack/BaseMsg.cs b/PCRobot.Pack/BaseMsg.cs index 09e776f..287dc1d 100644 --- a/PCRobot.Pack/BaseMsg.cs +++ b/PCRobot.Pack/BaseMsg.cs @@ -64,6 +64,7 @@ namespace PCRobot.Pack autoAuthMiniAPPLogin = 1039,//小程序自动授权登录 uploadCiecleImage = 1040,//上传朋友圈图片 getlogincode = 1041,//获取登录二维码 + sendCardXml = 1042,//发送名片原始XML @@ -92,7 +93,6 @@ namespace PCRobot.Pack - //企业微信服务器接收 sendVideo_workWeChat = 3000, rcvTxt_workWeChat = 3001, diff --git a/PCRobot/PCRobotForm.cs b/PCRobot/PCRobotForm.cs index d248ea1..cdf0b3d 100644 --- a/PCRobot/PCRobotForm.cs +++ b/PCRobot/PCRobotForm.cs @@ -58,7 +58,7 @@ namespace PCRobot files.Add(HttpExtend.MapFile(@"OnlineUpdate.exe")); files.Add(HttpExtend.MapFile(@"OnlineUpdate.xml")); files.Add(HttpExtend.MapFile(@"VersionUpdate.exe")); - files.Add(HttpExtend.MapFile(@"VersionUpdate.xml")); + files.Add(HttpExtend.MapFile(@"VersionUpdate.xml")); files.Add(HttpExtend.MapFile(@"OnlineUpdate.exe")); //files.Add(Util.MapFile(@"WeiQ.Framework.dll", @"Assembly\apifile")); //files.Add(Util.MapFile(@"Browser.dll", @"Assembly\apifile\Library")); @@ -596,6 +596,9 @@ namespace PCRobot case PCRobotCMD.sendInviteGroup: api.SendCard(data.ToUsername, data.ToMessage); break; + case PCRobotCMD.sendCardXml: + (api as Wechat_Xiaoxie)?.SendCardXml(data.ToUsername, data.ToMessage); + break; case PCRobotCMD.getContact: api.GetContact(true); break; diff --git a/类库/Chat.Framework/WXSdk/Implement/WXClientImpl_HOOK.cs b/类库/Chat.Framework/WXSdk/Implement/WXClientImpl_HOOK.cs index 909eacd..2d13416 100644 --- a/类库/Chat.Framework/WXSdk/Implement/WXClientImpl_HOOK.cs +++ b/类库/Chat.Framework/WXSdk/Implement/WXClientImpl_HOOK.cs @@ -2342,6 +2342,17 @@ namespace Chat.Framework.WXSdk.Implement pack.SendServer(PCRobotCMD.sendCard, friendwxid, WechatMsgType.文本, username); } + /// + /// 发送XML卡片 + /// + /// + /// + public override void SendCardXml(string username, string xml) + { + WechatPack pack = new WechatPack(this); + pack.SendServer(PCRobotCMD.sendCardXml, xml, WechatMsgType.文本, username); + } + /// /// 邀请入群 /// @@ -2517,7 +2528,15 @@ namespace Chat.Framework.WXSdk.Implement matchs = Regex.Matches(message, @"\[卡片\=([^\]]+)\]", RegexOptions.IgnoreCase); foreach (Match item in matchs) { - SendCard(username, item.Groups[1].Value == "自己" ? User.Username : item.Groups[1].Value); + var recommendedUser = item.Groups[1].Value; + if (recommendedUser.ToLower().Contains("卡片用户账号 public virtual void SendCard(string username, string friendwxid) { throw new Exception("本协议暂时不支持该方法"); } + /// + /// 发送Xml卡片消息 + /// + /// + /// + public virtual void SendCardXml(string username, string xml) { throw new Exception("本协议暂时不支持该方法"); } + /// /// 获取群成员,不支持pc ///