Skip to content

Commit

Permalink
预约到书是否发通知,支持分馆配置
Browse files Browse the repository at this point in the history
  • Loading branch information
renyh committed Nov 2, 2023
1 parent 90495ed commit d67c545
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 10 deletions.
80 changes: 74 additions & 6 deletions dp2weixin.service/dp2WeiXinService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3395,7 +3395,6 @@ private int SendArrived(XmlDocument bodyDom,
libName = "";



/*
body元素里面是预约到书通知记录(注意这是一个字符串,需要另行装入一个XmlDocument解析),其格式如下:
<?xml version="1.0" encoding="utf-8"?>
Expand Down Expand Up @@ -3425,6 +3424,8 @@ private int SendArrived(XmlDocument bodyDom,
</patronRecord>
</root>
*/


XmlNode root = bodyDom.DocumentElement;
//<onShelf>false</onShelf>
// <reserveTime>2天</reserveTime>
Expand All @@ -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<WxUserItem> sendPatrons = new List<WxUserItem>();

// 2023/11/2 解析字符串,格式为: 分馆1:N;分馆2:N
List<string> fenguanList = SplitArrivedParam(lib.IsSendArrivedNotice);
foreach (WxUserItem one in bindPatronList)
{
// 读者不属于不发消息的分馆,才会给这个读者发通知
if (fenguanList.Contains(one.libraryCode) == false)
{
//bindPatronList.Remove(one); //这样写会报错
sendPatrons.Add(one);
}
}

bindPatronList = sendPatrons;
}
}
}

Expand Down Expand Up @@ -3628,6 +3657,24 @@ private int SendArrived(XmlDocument bodyDom,
}


public List<string> SplitArrivedParam(string text)
{
//lib.IsSendArrivedNotice
List<string> list = new List<string>();

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

Expand Down Expand Up @@ -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<string> noSendArricedFenguanList = SplitArrivedParam(lib.IsSendArrivedNotice);
// 读者不属于不发消息的分馆,才会给这个读者发通知
if (noSendArricedFenguanList.Contains(user.libraryCode) == true)
{
strError = ""; //将在架预约的提示清掉。
}
}
}


}

}
Expand Down
11 changes: 7 additions & 4 deletions dp2weixinP2P/Views/Home/LibraryM.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,13 @@

<div class="mui-input-row">
<label class="leftLabel">是否给读者发到书通知</label>
<select id="selIsSendArrivedNotice">
<option value="Y" selected>是</option>
<option value="N">否</option>
</select>
<input id="selIsSendArrivedNotice" type="text" class="mui-input" data-bind="value:model.editor.IsSendArrivedNotice">
<!--
<select id="selIsSendArrivedNotice">
<option value="Y" selected>是</option>
<option value="N">否</option>
</select>
-->
</div>

<div class="mui-input-row">
Expand Down

0 comments on commit d67c545

Please sign in to comment.