From d67c5450d07477d43897318803d9c7f49536465a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=BB=B6=E5=8D=8E?= Date: Thu, 2 Nov 2023 16:58:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E5=88=B0=E4=B9=A6=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=8F=91=E9=80=9A=E7=9F=A5=EF=BC=8C=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E9=A6=86=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dp2weixin.service/dp2WeiXinService.cs | 80 +++++++++++++++++++++++-- dp2weixinP2P/Views/Home/LibraryM.cshtml | 11 ++-- 2 files changed, 81 insertions(+), 10 deletions(-) diff --git a/dp2weixin.service/dp2WeiXinService.cs b/dp2weixin.service/dp2WeiXinService.cs index e259c0d3..86886ab0 100644 --- a/dp2weixin.service/dp2WeiXinService.cs +++ b/dp2weixin.service/dp2WeiXinService.cs @@ -3395,7 +3395,6 @@ private int SendArrived(XmlDocument bodyDom, libName = ""; - /* body元素里面是预约到书通知记录(注意这是一个字符串,需要另行装入一个XmlDocument解析),其格式如下: @@ -3425,6 +3424,8 @@ private int SendArrived(XmlDocument bodyDom, */ + + XmlNode root = bodyDom.DocumentElement; //false // 2天 @@ -3450,10 +3451,38 @@ private int SendArrived(XmlDocument bodyDom, //if (bOnShelf == true // && string.IsNullOrEmpty(lib.comment) == false // && lib.comment.IndexOf("OnshelfArrivedNoNotice") != -1) - if (lib.IsSendArrivedNotice == "N") //2020/3/22 改为直接使用变量 + + // //2020/3/22 改为直接使用变量 + // 2023/11/2 改为一个丰富信息的字符串 + if (lib.IsSendArrivedNotice.Contains("N") == true) { - //return 0; //2020-3-9改为不给读者立即发,还是给监控的工作人员发送 - bindPatronList.Clear(); //bindWeixinIds.Clear(); + + if (lib.IsSendArrivedNotice == "N") + { + //return 0; //2020-3-9改为不给读者立即发,还是给监控的工作人员发送 + bindPatronList.Clear(); //bindWeixinIds.Clear(); + } + else + { + + // 将不发通知的分馆过滤掉。 + + List sendPatrons = new List(); + + // 2023/11/2 解析字符串,格式为: 分馆1:N;分馆2:N + List fenguanList = SplitArrivedParam(lib.IsSendArrivedNotice); + foreach (WxUserItem one in bindPatronList) + { + // 读者不属于不发消息的分馆,才会给这个读者发通知 + if (fenguanList.Contains(one.libraryCode) == false) + { + //bindPatronList.Remove(one); //这样写会报错 + sendPatrons.Add(one); + } + } + + bindPatronList = sendPatrons; + } } } @@ -3628,6 +3657,24 @@ private int SendArrived(XmlDocument bodyDom, } + public List SplitArrivedParam(string text) + { + //lib.IsSendArrivedNotice + List list = new List(); + + string[] array=text.Trim().Split(new char[] { ';' }); + foreach (string one in array) + { + string[] temp = one.Split(new char[] { ':' }); + if (temp.Length==2 && temp[1]=="N") + { + list.Add(temp[0]); + } + } + + return list; + } + #endregion @@ -11578,9 +11625,30 @@ public int Reservation(string weixinId, // 2021/3/22改为如果设置了不给读者发送通知,则简化提示,以前是根据是否只有在架预约的 //if (lib.ReserveScope == LibDatabase.C_ReserveScope_OnlyOnshelf) // 2020/3/22 改为使用参数 - if (lib.IsSendArrivedNotice == "N") //2020/3/22 改为直接使用变量 + //2020/3/22 改为直接使用变量 + // 2023/11/2 改为支持分馆,这个参数是一个复杂格式的字符串,例如:分馆1:N;分馆2:N + if (lib.IsSendArrivedNotice.Contains("N")==true) { - strError = ""; //将在架预约的提示清掉。 + // 全局配置 + if (lib.IsSendArrivedNotice == "N") + { + strError = ""; //将在架预约的提示清掉。 + } + else //分馆配置 + { + WxUserItem user = WxUserDatabase.Current.GetActive(weixinId); + if (user != null && user.type == WxUserDatabase.C_Type_Patron) + { + List noSendArricedFenguanList = SplitArrivedParam(lib.IsSendArrivedNotice); + // 读者不属于不发消息的分馆,才会给这个读者发通知 + if (noSendArricedFenguanList.Contains(user.libraryCode) == true) + { + strError = ""; //将在架预约的提示清掉。 + } + } + } + + } } diff --git a/dp2weixinP2P/Views/Home/LibraryM.cshtml b/dp2weixinP2P/Views/Home/LibraryM.cshtml index c6fabb6d..8860d678 100644 --- a/dp2weixinP2P/Views/Home/LibraryM.cshtml +++ b/dp2weixinP2P/Views/Home/LibraryM.cshtml @@ -888,10 +888,13 @@
- + +