From e29917971be704b6db992102b93606b8d7e19e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=BB=B6=E5=8D=8E?= Date: Fri, 28 Jan 2022 15:53:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dp2mini | 1 + dp2weixin.service/dp2WeiXinService.cs | 105 +++++++----------- dp2weixin.service/mongodb/WxUserDatabase.cs | 1 + .../ApiControllers/BiblioApiController.cs | 2 +- .../ApiControllers/PatronApiController.cs | 7 +- dp2weixinP2P/Controllers/PatronController.cs | 26 ++++- .../PublishProfiles/FolderProfile.pubxml | 4 +- dp2weixinP2P/Scripts/weixin.js | 1 + .../Views/Account/ChangePassword.cshtml | 2 +- dp2weixinP2P/Views/Biblio/Index.cshtml | 8 +- dp2weixinP2P/Views/Patron/PatronReview.cshtml | 2 +- 11 files changed, 76 insertions(+), 83 deletions(-) create mode 160000 dp2mini diff --git a/dp2mini b/dp2mini new file mode 160000 index 00000000..c15f806e --- /dev/null +++ b/dp2mini @@ -0,0 +1 @@ +Subproject commit c15f806ef3e9c93cad236c125149a8971ded44e0 diff --git a/dp2weixin.service/dp2WeiXinService.cs b/dp2weixin.service/dp2WeiXinService.cs index 53db8d9a..9532fbe1 100644 --- a/dp2weixin.service/dp2WeiXinService.cs +++ b/dp2weixin.service/dp2WeiXinService.cs @@ -676,6 +676,8 @@ public void Close() #region 本方账号登录 + // 公众号登录dp2mserver的帐号 + // 如果连接串是开头,后面跟着libid,则表示用lib对应的weixin_xxx帐户,其它情况用全局weixin帐户 void _channels_Login(object sender, LoginEventArgs e) { MessageConnection connection = sender as MessageConnection; @@ -690,7 +692,6 @@ void _channels_Login(object sender, LoginEventArgs e) // 全局的联系我们 if (libId == C_ConnName_dp) { - e.UserName = GetUserName(); if (string.IsNullOrEmpty(e.UserName) == true) throw new Exception("尚未指定用户名,无法进行登录"); @@ -699,7 +700,6 @@ void _channels_Login(object sender, LoginEventArgs e) } else { - LibEntity lib = this.GetLibById(libId); if (lib == null) { @@ -711,7 +711,6 @@ void _channels_Login(object sender, LoginEventArgs e) throw new Exception("尚未指定微信本方用户名,无法进行登录"); e.Password = lib.wxPassword; } - } else { @@ -719,13 +718,10 @@ void _channels_Login(object sender, LoginEventArgs e) if (string.IsNullOrEmpty(e.UserName) == true) throw new Exception("尚未指定用户名,无法进行登录"); - e.Password = GetPassword(); - } e.Parameters = "notes=" + HttpUtility.UrlEncode(connection.Name); //"propertyList=biblio_search,libraryUID=xxx"; - } @@ -1042,7 +1038,7 @@ public int InternalDoMessage(MessageRecord record, nRet = this.UpdatePatron(lib, bodyDom, out strError); return 0;// nRet; } - if (strType == "登录验证码") + if (strType == "登录验证码")//opac找回密码,也是转到这儿来的 { /* @@ -5124,7 +5120,7 @@ public int GetTempPatrons(LoginInfo loginInfo, // 使用代理账号 //LoginInfo loginInfo = new LoginInfo("", false); - // 从远程dp2library中查 + // 从dp2library中查 string strWord = WxUserDatabase.C_PatronState_TodoReview; // 待审核 CancellationToken cancel_token = new CancellationToken(); string id = Guid.NewGuid().ToString(); @@ -5322,7 +5318,7 @@ public int ResetPassword(string weixinId, } string resultXml = ""; - string patronParam = "style=," //returnMessage + string patronParam = "style=," //2022/8 将style里的returnMessage这个参数去掉了,依靠dp2library的发送短信功能,dp2libraray也有两种方式:一是通过MSMQ和dp2capo到公众号转发(常用),二是依据自身配置的短信接口。如果是没有安装dp2capo则没法发短信,不过如果使用公众号模块,都会安装dp2capo,所以这里就不用返回消息了。 + "queryword=NB:" + name + "|," + "tel=" + tel + "," + "name=" + name; @@ -5606,10 +5602,10 @@ public int ChangePassword(string libId, "changePassword", patron, item, - "",//this.textBox_circulation_style.Text, - "",//this.textBox_circulation_patronFormatList.Text, - "",//this.textBox_circulation_itemFormatList.Text, - "");//this.textBox_circulation_biblioFormatList.Text); + "",//style + "",//patronFormatList + "",//itemFormatList + "");//biblioFormatList try { MessageConnection connection = this._channels.GetConnectionTaskAsync( @@ -6261,27 +6257,23 @@ public int Unbind(string userId, // 使用代理账号capo 20161024 jane LoginInfo loginInfo = new LoginInfo("", false); - string weixinIdTemp = userItem.weixinId; int nTemp = weixinIdTemp.IndexOf("@"); if (nTemp > 0) { weixinIdTemp = weixinIdTemp.Substring(0, nTemp); } - - weixinIdTemp += "*"; - - + weixinIdTemp += "*";// 支持通配符 // 调点对点解绑接口 - string fullWeixinId = WeiXinConst.C_WeiXinIdPrefix + weixinIdTemp;//userItem.weixinId + "*";// +userItem.appId; + string fullWeixinId = WeiXinConst.C_WeiXinIdPrefix + weixinIdTemp; CancellationToken cancel_token = new CancellationToken(); string id = Guid.NewGuid().ToString(); BindPatronRequest request = new BindPatronRequest(id, loginInfo, "unbind", queryWord,//userItem.readerBarcode, - "",//password todo + "",//password 绑定不需要输入密码 fullWeixinId, "multiple,null_password", "xml"); @@ -6684,6 +6676,7 @@ private long SearchBiblioInternal(string weixinId, start, //每次获取范围 count); + // 测试加的日志 //this.WriteErrorLog1("走进SearchBiblioInternal-7"); @@ -6901,12 +6894,10 @@ public static string GetObjectHtmlFragment(string libId, // } public static string GetImageHtmlFragment(string libId, - string strBiblioRecPath, - string strImageUrl, + string strBiblioRecPath, + string strImageUrl, bool addOnloadEvent) { - // - if (string.IsNullOrEmpty(strImageUrl) == true) return ""; @@ -6915,7 +6906,6 @@ public static string GetImageHtmlFragment(string libId, string strUri = MakeObjectUrl(strBiblioRecPath, strImageUrl); - strImageUrl = "../patron/getphoto?libId=" + HttpUtility.UrlEncode(libId) + "&objectPath=" + HttpUtility.UrlEncode(strUri); } @@ -6924,8 +6914,6 @@ public static string GetImageHtmlFragment(string libId, if (addOnloadEvent == true) onloadStr = " onload='setImgSize(this)' "; - - string html = ""; // 2016/8/19 不要人为把宽高固定了 width='100px' height='100px' return html; } @@ -7285,6 +7273,7 @@ private long SearchBiblioAll(string weixinId, #endregion + // from来源,是从index过来的,还是detail过来的,主要用于好书推荐的返回,发现后来注释掉了。 // 20170116 修改使用绑定的账户,如未绑定用public public BiblioDetailResult GetBiblioDetail(LoginInfo loginInfo, string weixinId, @@ -7390,8 +7379,8 @@ public BiblioDetailResult GetBiblioDetail(LoginInfo loginInfo, if (activeUser.type == WxUserDatabase.C_Type_Worker && activeUser.userName != WxUserDatabase.C_Public) { - // 检索是否有权限 _wx_setHomePage - string needRight = dp2WeiXinService.C_Right_SetHomePage; + // 检索是否有好书推荐权限 + string needRight = dp2WeiXinService.C_Right_SetBook;// C_Right_SetHomePage; int nHasRights = dp2WeiXinService.Instance.CheckRights(activeUser, lib, needRight, @@ -7420,7 +7409,6 @@ public BiblioDetailResult GetBiblioDetail(LoginInfo loginInfo, // + "&returnUrl=" + HttpUtility.UrlEncode(returnUrl); recommendBtn = "
"; - } } @@ -7571,7 +7559,6 @@ private int GetTableAndImgHtml(LibEntity lib, string tableXml = node.InnerXml; if (string.IsNullOrEmpty(tableXml) == false) { - string resHtml = ""; XmlDocument objectDom = new XmlDocument(); @@ -7615,7 +7602,6 @@ private int GetTableAndImgHtml(LibEntity lib, string imgSrc = "../patron/getphoto?libId=" + HttpUtility.UrlEncode(lib.id) + "&objectPath=" + HttpUtility.UrlEncode(strPdfUri); - string onClickStr = " onclick='gotoUrl(\"/Biblio/ViewPDF?libid=" + lib.id + "&uri=" + objectUri + "\")' "; string pdfImgHtml = ""; @@ -7645,7 +7631,6 @@ private int GetTableAndImgHtml(LibEntity lib, //否则将来数据中一旦出现逗号的时候就会出现故障。 // // - // 检查是不是拼音 if (this.CheckContainWord(type, "titlepinyin") == true) // name == "题名与责任说明拼音") { @@ -8373,6 +8358,8 @@ public long GetItemInfo(string weixinId, //为了获取libraryCode //卷册 item.volume = DomUtil.GetElementText(dom.DocumentElement, "volume"); + + // 馆藏地 item.location = DomUtil.GetElementText(dom.DocumentElement, "location"); // 检查该馆藏地的册记录是否可以显示出现 @@ -8390,7 +8377,6 @@ public long GetItemInfo(string weixinId, //为了获取libraryCode { // 馆员身份,灰色显示 item.isGray = true; - } } } @@ -8610,7 +8596,6 @@ public long GetItemInfo(string weixinId, //为了获取libraryCode { foreach (IssueString issueStr in issueList) { - // 获取期记录 string style = "query:父记录+期号|" + biblioId + "|" + issueStr.Query; string issueXml = ""; @@ -9208,22 +9193,19 @@ public Patron ParsePatronXml(string libId, //string temp = patron.barcode; //if (string.IsNullOrEmpty(temp) == true) // temp = "@path:" + recPath; - + // 二维码 string qrcodeUrl = "../patron/getphoto?libId=" + HttpUtility.UrlEncode(libId) + "&type=pqri" + "&barcode=" + HttpUtility.UrlEncode(patron.barcode); patron.qrcodeUrl = qrcodeUrl; //头像 - //recPath string imageUrl = ""; if (showPhoto == 1) { - //dprms:file - // 看看是不是已经有图像对象 + // 检查是不是已经有头像图片对象 usage='cardphoto' XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable()); - nsmgr.AddNamespace("dprms", DpNs.dprms); - // 全部元素 + nsmgr.AddNamespace("dprms", DpNs.dprms); //注意xml有命令空间dprms:file XmlNodeList fileNodes = dom.DocumentElement.SelectNodes("//dprms:file[@usage='cardphoto']", nsmgr); if (fileNodes.Count > 0) { @@ -9233,7 +9215,7 @@ public Patron ParsePatronXml(string libId, + "&objectPath=" + HttpUtility.UrlEncode(strPhotoPath); } } - patron.imageUrl = imageUrl; + patron.imageUrl = imageUrl; //给patron对象设置头像url // 违约 @@ -10620,7 +10602,6 @@ public int GetQRcode(string libId, //Item: //ResultValue返回1表示成功,-1或0表示不成功。 //成功的情况下,ErrorInfo成员里面返回了二维码字符串,形如” PQR:R0000001@00JDURE5FT1JEOOWGJV0R1JXMYI” - string patron = "!getpatrontempid:" + patronBarcode; @@ -10636,10 +10617,10 @@ public int GetQRcode(string libId, "verifyPassword", patron, "", - "",//this.textBox_circulation_style.Text, - "",//this.textBox_circulation_patronFormatList.Text, - "",//this.textBox_circulation_itemFormatList.Text, - "");//this.textBox_circulation_biblioFormatList.Text); + "", // style, + "", // patronFormatList, + "", // itemFormatList, + ""); //biblioFormatList); try { MessageConnection connection = this._channels.GetConnectionTaskAsync( @@ -10677,12 +10658,13 @@ public int GetQRcode(string libId, return -1; } + // 把特征码转成二维码图片 public void GetQrImage( - string strCode, - int nWidth, - int nHeight, + string strCode, + int nWidth, + int nHeight, Stream outputStream, - out string strError) + out string strError) { strError = ""; try @@ -10771,7 +10753,6 @@ public int GetObjectMetadata(LoginInfo loginInfo, // loginInfo = new LoginInfo("", false); //} - CancellationToken cancel_token = new CancellationToken(); string id = Guid.NewGuid().ToString(); @@ -10795,8 +10776,8 @@ public int GetObjectMetadata(LoginInfo loginInfo, new TimeSpan(0, 1, 0), cancel_token).Result; - // GetResResponse result = connection.GetResAsyncLite( - //lib.capoUserName, + // GetResResponse result = connection.GetResAsyncLite( + // lib.capoUserName, // request, // outputStream, // null, @@ -11338,17 +11319,16 @@ private int GetMessageInternal(string action, string libName = ""; // string connName - string connName = C_ConnPrefix_Myself + libId; + string connName = C_ConnPrefix_Myself + libId; //":"; if (group == C_Group_dp_home) { - connName = C_ConnPrefix_Myself + C_ConnName_dp; + connName = C_ConnPrefix_Myself + C_ConnName_dp; //"_dp_"; wxUserName = this.GetUserName(); libName = ""; } else { - if (string.IsNullOrEmpty(libId) == true) { strError = "libId参数不能为空"; @@ -11366,10 +11346,6 @@ private int GetMessageInternal(string action, libName = lib.libName; } - - - - // 这里要转换一下,接口传进来的是转义后的 //subjectCondition = HttpUtility.HtmlDecode(subjectCondition); @@ -11520,8 +11496,6 @@ public int CoverMessage(WxUserItem worker, + ""; } - - List records = new List(); MessageRecord record = new MessageRecord(); record.id = item.id; @@ -11552,7 +11526,6 @@ public int CoverMessage(WxUserItem worker, "", records); CancellationToken cancel_token = new CancellationToken(); - SetMessageResult result = connection.SetMessageTaskAsync(param, new TimeSpan(0, 1, 0), cancel_token).Result; @@ -11818,7 +11791,7 @@ public int GetSubject(string libId, // 获取栏目 List records = null; - int nRet = this.GetMessageInternal(C_Active_EnumSubject, + int nRet = this.GetMessageInternal(C_Active_EnumSubject, //enumSubject group, libId, "", @@ -11837,7 +11810,7 @@ public int GetSubject(string libId, if (subjects == null || subjects.Length == 0) continue; - string subject = subjects[0];//2016-8-20 jane 这里的栏目是从服务器上得到了,不用管首尾空白的问题,如果管了反而暴露不出来问题 + string subject = subjects[0];//2016-8-20 jane 这里的栏目是从服务器上得到的,不用管首尾空白的问题,如果管了反而暴露不出来问题 subject = StringUtil.UnescapeString(subject); int no = 0; diff --git a/dp2weixin.service/mongodb/WxUserDatabase.cs b/dp2weixin.service/mongodb/WxUserDatabase.cs index cfa63bab..f4b4a1e7 100644 --- a/dp2weixin.service/mongodb/WxUserDatabase.cs +++ b/dp2weixin.service/mongodb/WxUserDatabase.cs @@ -796,6 +796,7 @@ public bool IsdpAdmin // 读者姓名 public string readerName { get; set; } + // todo这里应该后来没有再用到 // 20210729由于要求显示已绑定清单脱敏,所以增加了两个用读者身份获取的字段 public string readerBarcodeByReaderGet { get; set; } public string readerNameByReaderGet { get; set; } diff --git a/dp2weixinP2P/ApiControllers/BiblioApiController.cs b/dp2weixinP2P/ApiControllers/BiblioApiController.cs index 82f6e04b..cac89ac3 100644 --- a/dp2weixinP2P/ApiControllers/BiblioApiController.cs +++ b/dp2weixinP2P/ApiControllers/BiblioApiController.cs @@ -94,7 +94,7 @@ public SearchBiblioResult Search(string loginUserName, WeiXinConst.C_OnePage_Count); goto END1; } - else if (from == "_ReView") + else if (from == "_ReView") //刷新的情况,显示从0至当前最大数字 { if (resultSet.Substring(0, 1) == "#") resultSet = resultSet.Substring(1); diff --git a/dp2weixinP2P/ApiControllers/PatronApiController.cs b/dp2weixinP2P/ApiControllers/PatronApiController.cs index c2aea5cc..b4469875 100644 --- a/dp2weixinP2P/ApiControllers/PatronApiController.cs +++ b/dp2weixinP2P/ApiControllers/PatronApiController.cs @@ -214,8 +214,8 @@ public SetReaderInfoResult SetPatron(string libId, /// /// 发送验证码 /// - /// - /// + /// 图书馆id + /// 手机号 /// public GetVerifyCodeResult GetVerifyCode(string libId, string phone) @@ -252,8 +252,6 @@ public ApiResult IncrementPatronBarcode(string libId, string libraryCode) { ApiResult result = new ApiResult(); - - LibModel libCfg = dp2WeiXinService.Instance._areaMgr.GetLibCfg( libId, libraryCode); @@ -284,7 +282,6 @@ public ApiResult IncrementPatronBarcode(string libId, result.errorInfo = "未找到lib=["+libId+"] libraryCode=["+libraryCode+"]对应的配置。"; } - return result; } diff --git a/dp2weixinP2P/Controllers/PatronController.cs b/dp2weixinP2P/Controllers/PatronController.cs index 4c8751e1..16bfda2b 100644 --- a/dp2weixinP2P/Controllers/PatronController.cs +++ b/dp2weixinP2P/Controllers/PatronController.cs @@ -276,6 +276,7 @@ public bool CheckIsBind(List list, LibModel lib, out WxUserItem outU #endregion + #region 修改手机号 /// /// 修改手机号界面 @@ -326,6 +327,12 @@ public ActionResult ChangePhone(string code, string state) } + #endregion + + + + + #region 馆员审核读者 /// /// 检查读者界面 @@ -708,6 +715,11 @@ public string GetReaderTypeHtml(string readerTypes, string currentPatronType) } + #endregion + + #region 读者注册 + + /// /// 读者自助注册功能 /// @@ -829,6 +841,10 @@ public ActionResult PatronRegister(string code, string state, string userId) return View(userItem); } + #endregion + + #region 馆员登记读者 + /// /// 工作人员登记读者 或者 编辑读者信息 /// @@ -921,6 +937,9 @@ public ActionResult PatronEdit(string code, string state) return View(); } + #endregion + + #region 我的信息 /// /// 我的信息主界面 @@ -1187,12 +1206,14 @@ public ActionResult BorrowInfo(string code, string state) } + #endregion + #region 内部函数 /// - /// + /// 获取读者信息 /// /// /// @@ -1230,8 +1251,7 @@ private int GetReaderXml(WxUserItem activeUser, string libId = activeUser.libId; string patronBarcode = activeUser.readerBarcode; - // 20210730 因为涉及到读者信息脱敏,所以还是改为读者自己的帐户登录 - // 登录人是读者自己 + // 2021/07/30 因为涉及到读者信息脱敏,所以还是采用读者自己的帐户登录 LoginInfo loginInfo = new LoginInfo(patronBarcode, true); // 20210730 因为涉及到读者信息脱敏,所以还是改为读者自己的帐户登录 diff --git a/dp2weixinP2P/Properties/PublishProfiles/FolderProfile.pubxml b/dp2weixinP2P/Properties/PublishProfiles/FolderProfile.pubxml index 8be209f5..7d55f402 100644 --- a/dp2weixinP2P/Properties/PublishProfiles/FolderProfile.pubxml +++ b/dp2weixinP2P/Properties/PublishProfiles/FolderProfile.pubxml @@ -12,7 +12,7 @@ True False - C:\publish - False + d:\publish\i + True \ No newline at end of file diff --git a/dp2weixinP2P/Scripts/weixin.js b/dp2weixinP2P/Scripts/weixin.js index 9c6cd038..5f89a8cb 100644 --- a/dp2weixinP2P/Scripts/weixin.js +++ b/dp2weixinP2P/Scripts/weixin.js @@ -170,6 +170,7 @@ function deleteItem(worker,libId,biblioPath,itemPath,barcode) { //======书目详细信息========== // 获取详细书目记录 +// from表示是从哪个界面过来的? function getDetail(libId, recPath, obj, from,biblioName) { //alert(biblioName); diff --git a/dp2weixinP2P/Views/Account/ChangePassword.cshtml b/dp2weixinP2P/Views/Account/ChangePassword.cshtml index 34e5d309..93a08c6b 100644 --- a/dp2weixinP2P/Views/Account/ChangePassword.cshtml +++ b/dp2weixinP2P/Views/Account/ChangePassword.cshtml @@ -72,7 +72,7 @@ //var index = loadLayer(); showMaskLayer(); - // 调web api获取临时密码 + // 调web api修改密码 var url = "/api/wxuserApi?libId=" + libId + "&patron=" + encodeURIComponent(patron) + "&oldPassword=" + encodeURIComponent(oldPassword) diff --git a/dp2weixinP2P/Views/Biblio/Index.cshtml b/dp2weixinP2P/Views/Biblio/Index.cshtml index d577af68..aad3bdb8 100644 --- a/dp2weixinP2P/Views/Biblio/Index.cshtml +++ b/dp2weixinP2P/Views/Biblio/Index.cshtml @@ -318,8 +318,6 @@ function loadJs(sid, jsurl, callback) { $("#more").addClass("nextdisabled"); $("#more").css("display", "block"); } - - else if (bNext == '_ReView') { from = "_ReView"; word = $("#maxNo").val(); @@ -539,7 +537,8 @@ function loadJs(sid, jsurl, callback) { } - // 2016-6-17 jane 为了返回时记住展开项,expand函数由原来传一个对象,改为传一个id + // expId 需要展开的节点的id + // 2016-6-17 为了返回时记住展开项,expand函数由原来传一个对象,改为传一个id function expand(expId) { //根据id找到
  • 元素 var id = "#" + expId; @@ -574,7 +573,8 @@ function loadJs(sid, jsurl, callback) { if (o.length == 0) { return; } - else { + else // 未装载详细信息的情况,调接口获取详细信息 + { //alert("走进1"); var recPath = o.children("label").text(); diff --git a/dp2weixinP2P/Views/Patron/PatronReview.cshtml b/dp2weixinP2P/Views/Patron/PatronReview.cshtml index 2812918d..c4bc8dff 100644 --- a/dp2weixinP2P/Views/Patron/PatronReview.cshtml +++ b/dp2weixinP2P/Views/Patron/PatronReview.cshtml @@ -66,7 +66,7 @@ //显示等待图层 showLoading(); - // 调patron发送验证码接口 + // 自动生成一个增量的证条码号 IncrementPatronBarcode var url = "/api/patronapi?libId=" + encodeURIComponent(libId) + "&libraryCode=" + encodeURIComponent(libraryCode)