From 79e2b47e0b2e914d8e346c556949aa84fbea1a9c Mon Sep 17 00:00:00 2001 From: renyh Date: Mon, 23 Dec 2024 20:19:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E8=AF=81=E6=9D=A1=E7=A0=81=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=EF=BC=8C=E4=B8=8D=E5=8F=91=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dp2weixin.service/dp2WeiXinService.cs | 50 ++++++++++++++++----------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/dp2weixin.service/dp2WeiXinService.cs b/dp2weixin.service/dp2WeiXinService.cs index 8814a23b..5dd80494 100644 --- a/dp2weixin.service/dp2WeiXinService.cs +++ b/dp2weixin.service/dp2WeiXinService.cs @@ -1299,32 +1299,42 @@ public int InternalDoMessage(MessageRecord record, } } - - - // 从微信本地库获取有多少用户绑定这个读者,给绑定这位读者的用户都要发通知 - List bindPatronList = WxUserDatabase.Current.Get("", - libId, - libraryCode, //null, 2020/8/3发现这里传的null,应该是传librarycode - WxUserDatabase.C_Type_Patron, - patronBarcode, - "", - true); - - // 写一下日志,2020/8/1发现会收到两条消息 - if (bindPatronList.Count > 0) + // 2024/12/23 加固程序,消息传过来的读者证条码可能为空,为空的话,不能去库中匹配,要不会匹配到所有读者 + List bindPatronList = new List(); + if (string.IsNullOrEmpty(patronBarcode) == true) { - string temp = ""; - foreach (WxUserItem u in bindPatronList) - { - temp += "weixinid=[" + u.weixinId + "],id=[" + u.id + "],readerBarcode=[" + u.readerBarcode + "],readerName=[" + u.readerName + "]\r\n"; - } - this.WriteDebug("根据patronBarcode=[" + patronBarcode + "]从本地库找到[" + bindPatronList.Count + "]条绑定了该读者帐号,详情如下:\r\n" + temp); + this.WriteDebug("patronBarcode为空,无法匹配绑定该读者的帐号。"); } else { - this.WriteDebug("根据patronBarcode=[" + patronBarcode + "]从本地库找到[0]条绑定了该读者帐号。"); + // 从微信本地库获取有多少用户绑定这个读者,给绑定这位读者的用户都要发通知 + bindPatronList = WxUserDatabase.Current.Get("", + libId, + libraryCode, //null, 2020/8/3发现这里传的null,应该是传librarycode + WxUserDatabase.C_Type_Patron, + patronBarcode, + "", + true); + + // 写一下日志,2020/8/1发现会收到两条消息 + if (bindPatronList.Count > 0) + { + string temp = ""; + foreach (WxUserItem u in bindPatronList) + { + temp += "weixinid=[" + u.weixinId + "],id=[" + u.id + "],readerBarcode=[" + u.readerBarcode + "],readerName=[" + u.readerName + "]\r\n"; + } + this.WriteDebug("根据patronBarcode=[" + patronBarcode + "]从本地库找到[" + bindPatronList.Count + "]条绑定了该读者帐号,详情如下:\r\n" + temp); + } + else + { + this.WriteDebug("根据patronBarcode=[" + patronBarcode + "]从本地库找到[0]条绑定了该读者帐号。"); + } } + + + // 2021/8/3 屏蔽读者信息,配置在libcfg中 bool send2PatronIsMask = false; string maskDef = this.GetMaskDef(libId, libraryCode, out send2PatronIsMask);