From 8726d3865d8a6703581e019fcbc81a43a27a60a0 Mon Sep 17 00:00:00 2001 From: ryh Date: Thu, 5 Nov 2020 18:33:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E4=BD=8D=E7=BD=AE=EF=BC=8C=E7=BB=91=E5=AE=9A=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E7=8A=B6=E6=80=81=E9=99=90=E5=88=B6=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dp2weixin.service/AreaLib.cs | 2 + dp2weixin.service/ChargeCommandContainer.cs | 4 + dp2weixin.service/SearchBiblioResult.cs | 34 +- dp2weixin.service/dp2WeiXinService.cs | 54 ++- dp2weixinP2P/Controllers/MenuController.cs | 12 +- dp2weixinP2P/Scripts/weixin.js | 4 + dp2weixinP2P/Views/Biblio/Index.cshtml | 8 - dp2weixinP2P/Views/Menu/Index.cshtml | 2 +- .../Views/Patron/PatronRegister.cshtml | 2 +- dp2weixinP2P/Views/Shared/_Layout.cshtml | 364 +++++++++--------- 10 files changed, 275 insertions(+), 211 deletions(-) diff --git a/dp2weixin.service/AreaLib.cs b/dp2weixin.service/AreaLib.cs index 90845f6b..8cc48044 100644 --- a/dp2weixin.service/AreaLib.cs +++ b/dp2weixin.service/AreaLib.cs @@ -110,6 +110,8 @@ public void SaveLib(LibEntity entity) lib.name = entity.libName; area.libs.Add(lib); + // todo,这里有bug,会把原来配置的信息清掉 + this.Save2Xml(); } } diff --git a/dp2weixin.service/ChargeCommandContainer.cs b/dp2weixin.service/ChargeCommandContainer.cs index 31afa64c..8036a6f5 100644 --- a/dp2weixin.service/ChargeCommandContainer.cs +++ b/dp2weixin.service/ChargeCommandContainer.cs @@ -70,6 +70,10 @@ public string getItemHtml(BiblioItem record) + "" + record.location + "" + "" + "" + + "当前位置" //2020/11/5加 + + "" + record.currentLocation + "" + + "" + + "" + "索取号" + "" + record.accessNo + "" + "" diff --git a/dp2weixin.service/SearchBiblioResult.cs b/dp2weixin.service/SearchBiblioResult.cs index 8c140670..fd607d42 100644 --- a/dp2weixin.service/SearchBiblioResult.cs +++ b/dp2weixin.service/SearchBiblioResult.cs @@ -61,7 +61,17 @@ public class BiblioItem public string state { get; set; } public string volume { get; set; } + + // 馆藏地 public string location { get; set; } + + // 当前位置 + public string currentLocation { get; set; } + + //shelfNo 法定架号 + public string shelfNo { get; set; } + + public string price { get; set; } // 索引号 @@ -74,26 +84,26 @@ public class BiblioItem //2016-6-17 jane 加借阅信息 public string borrower { get; set; } - public string borrowDate { get; set; } - public string borrowPeriod { get; set; } + public string borrowDate { get; set; } + public string borrowPeriod { get; set; } - public string reservationInfo { get; set; } + public string reservationInfo { get; set; } - public string imgHtml { get; set; } + public string imgHtml { get; set; } - public bool disable { get; set; } + public bool disable { get; set; } - public string refID { get; set; } - public string parentInfo { get; set; } //从属于,一般成员册会有该信息 + public string refID { get; set; } + public string parentInfo { get; set; } //从属于,一般成员册会有该信息 - public string recPath { get; set; } + public string recPath { get; set; } - public bool isGray = false; - public bool isNotCareLoc = false; + public bool isGray = false; + public bool isNotCareLoc = false; // 2020/4/4,注意如果调api的前端传上此参数,则一定要做成属性。 - public string batchNo { get; set; } - public string bookType { get; set; } + public string batchNo { get; set; } + public string bookType { get; set; } } } diff --git a/dp2weixin.service/dp2WeiXinService.cs b/dp2weixin.service/dp2WeiXinService.cs index 2fc57072..6a4ea963 100644 --- a/dp2weixin.service/dp2WeiXinService.cs +++ b/dp2weixin.service/dp2WeiXinService.cs @@ -5541,8 +5541,55 @@ public int Bind(string libId, return -1; } - // 把帐户信息保存到本地 + + + + + // 返回的读者xml string partonXml = result.Results[0]; + + // 2020//11/5 针对工行的临时方案,如果设置了状态,则不允许绑定。将来用读者库的角色来代替 + { + XmlDocument dom = new XmlDocument(); + dom.LoadXml(partonXml); + XmlNode root = dom.DocumentElement; + + //注销 + string strState = DomUtil.GetElementText(dom.DocumentElement, "state"); + if (string.IsNullOrEmpty(strState) == false) + { + string barcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); + // 调解绑 + id = Guid.NewGuid().ToString(); + request = new BindPatronRequest(id, + loginInfo, + "unbind", + barcode,//userItem.readerBarcode, + "",//password todo + fullWeixinId, + "multiple,null_password", + "xml"); + + result = connection.BindPatronTaskAsync( + lib.capoUserName, + request, + new TimeSpan(0, 1, 0), + cancel_token).Result; + if (result.Value == -1) + { + strError = result.ErrorInfo; + //return -1; + } + + strError = "用户状态值不支持绑定,请联系管理员。"; + return -1; + } + } + + + + + // 把帐户信息保存到本地 string recPath = result.RecPath; nRet = this.SaveUserToLocal1(weixinId, libId, @@ -8043,6 +8090,11 @@ public long GetItemInfo(string weixinId, //为了获取libraryCode } } + // 当前位置 + item.currentLocation = DomUtil.GetElementText(dom.DocumentElement, "currentLocation"); + // 架号 + item.shelfNo = DomUtil.GetElementText(dom.DocumentElement, "shelfNo"); + // 索引号 item.accessNo = DomUtil.GetElementText(dom.DocumentElement, "accessNo"); // 出版日期 diff --git a/dp2weixinP2P/Controllers/MenuController.cs b/dp2weixinP2P/Controllers/MenuController.cs index 63267301..38c61dfb 100644 --- a/dp2weixinP2P/Controllers/MenuController.cs +++ b/dp2weixinP2P/Controllers/MenuController.cs @@ -19,6 +19,7 @@ using Senparc.Weixin.MP.Entities.Menu; using dp2weixinWeb.Controllers; using dp2weixin.service; +using Senparc.Weixin.MP.Containers; namespace Senparc.Weixin.MP.Sample.Controllers { @@ -56,20 +57,19 @@ public ActionResult GetToken(string appId, string appSecret) { try { - //if (!AccessTokenContainer.CheckRegistered(appId)) - //{ - // AccessTokenContainer.Register(appId, appSecret); - //} + //全局只需注册一次 在公众号初始化时已经注册过了 + //AccessTokenContainer.RegisterAsync(appId, appSecret); + var result = Senparc.Weixin.MP.CommonAPIs.CommonApi.GetToken(appId, appSecret);//AccessTokenContainer.GetTokenResult(appId); //也可以直接一步到位: //var result = AccessTokenContainer.TryGetAccessToken(appId, appSecret); return Json(result, JsonRequestBehavior.AllowGet); } - catch (Exception) + catch (Exception ex) { //TODO:为简化代码,这里不处理异常(如Token过期) - return Json(new { error = "执行过程发生错误!" }, JsonRequestBehavior.AllowGet); + return Json(new { error = "执行过程发生错误!"+ex.Message }, JsonRequestBehavior.AllowGet); } } diff --git a/dp2weixinP2P/Scripts/weixin.js b/dp2weixinP2P/Scripts/weixin.js index 8d8705d5..688eed93 100644 --- a/dp2weixinP2P/Scripts/weixin.js +++ b/dp2weixinP2P/Scripts/weixin.js @@ -292,6 +292,10 @@ function getDetail(libId, recPath, obj, from,biblioName) { + "" + record.location + "" + "" + "" + + "当前位置" + + "" + record.currentLocation + "" + + "" + + "" + "索取号" + "" + record.accessNo + "" + "" diff --git a/dp2weixinP2P/Views/Biblio/Index.cshtml b/dp2weixinP2P/Views/Biblio/Index.cshtml index b1a1a851..1a5f8ccd 100644 --- a/dp2weixinP2P/Views/Biblio/Index.cshtml +++ b/dp2weixinP2P/Views/Biblio/Index.cshtml @@ -151,11 +151,7 @@ function loadJs(sid, jsurl, callback) { alert("抱歉,您扫描的不是合法的ISBN条码。\n扫描返回字符串为[" + code + "],"); return; } - - //alert("扫到的isbn=" + isbn); - - if (isbn != null && isbn != "") { if (bSimple == true) { $("#txtWordSimple").val(isbn); @@ -518,10 +514,6 @@ function loadJs(sid, jsurl, callback) { expand(expandId); } - - - - }, function (xhq, textStatus, errorThrown) { // 关闭等待层 diff --git a/dp2weixinP2P/Views/Menu/Index.cshtml b/dp2weixinP2P/Views/Menu/Index.cshtml index 75589b19..7fb57f1c 100644 --- a/dp2weixinP2P/Views/Menu/Index.cshtml +++ b/dp2weixinP2P/Views/Menu/Index.cshtml @@ -229,7 +229,7 @@
- + +