From 74e08cfc61ae23cd216b57ba642e74d16b2df741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E5=BB=B6=E5=8D=8E?= Date: Tue, 6 Dec 2022 12:50:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E8=8E=B7=E5=8F=96=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dp2weixin.service/LibraryManager.cs | 3 ++- dp2weixin.service/dp2WeiXinService.cs | 35 ++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/dp2weixin.service/LibraryManager.cs b/dp2weixin.service/LibraryManager.cs index 1327536d..50cc41fa 100644 --- a/dp2weixin.service/LibraryManager.cs +++ b/dp2weixin.service/LibraryManager.cs @@ -77,8 +77,9 @@ public void CheckIsHangup(Library library) return; } - // 设置版本 + // 给内存中的lib设置上版本 library.Version = capoVersion; + // 比较capo版本是否满足需求 nRet = StringUtil.CompareVersion(library.Version, LibraryManager.C_RequestCapoVersion); diff --git a/dp2weixin.service/dp2WeiXinService.cs b/dp2weixin.service/dp2WeiXinService.cs index 1f6fb3d1..26fc3c0b 100644 --- a/dp2weixin.service/dp2WeiXinService.cs +++ b/dp2weixin.service/dp2WeiXinService.cs @@ -3659,6 +3659,13 @@ public MessageInterface GetMessageInterface(string strType) public const string C_State_Expire = "到期"; + /// + /// 检查图书馆是否在线 + /// + /// + /// + /// + /// public bool CheckIsOnline(LibEntity libEntity, out string clock, out string strError) @@ -3929,6 +3936,7 @@ public void WarnOfflineLib() // 查找绑定了这个图书馆的工作人员 weixinid List libWorkers = this.getWarningWorkerWeixinIds(lib.Entity); + this.WriteDebug("找到 " + libWorkers.Count.ToString() + " 位图书馆 " + lib.Entity.libName + " 工作人员"); // 当这个图书馆和数字平台都没有可收警告的工作人员,则不再发送通知 @@ -8529,7 +8537,10 @@ public int GetInfo(LibEntity lib, strError = ""; dataList = new List(); - + int redocount = 0; + + REDO1: + CancellationToken cancel_token = new CancellationToken(); string id = Guid.NewGuid().ToString(); SearchRequest request = new SearchRequest(id, @@ -8556,9 +8567,16 @@ public int GetInfo(LibEntity lib, cancel_token).Result; if (result.ResultCount == -1) { - bool bOffline = false; + //bool bOffline = false; strError = "图书馆[" + lib.libName + "]返回错误:" + result.ErrorInfo; + // 通道断了,重来一次 + if (result.ErrorCode == "ChannelReleased" && redocount == 0) + { + redocount++; + goto REDO1; + } + //strError = this.GetFriendlyErrorInfo(result, lib.libName, out bOffline);// result.ErrorInfo; return -1; } @@ -8574,17 +8592,28 @@ public int GetInfo(LibEntity lib, dataList.Add(result.Records[i].Data); } } - return 1; } catch (AggregateException ex) { strError = MessageConnection.GetExceptionText(ex); + if (redocount == 0) + { + redocount++; + goto REDO1; + } + goto ERROR1; } catch (Exception ex) { strError = ex.Message; + if (redocount == 0) + { + redocount++; + goto REDO1; + } + goto ERROR1; } ERROR1: