From d23ad73d71e1b7937fddcf1097823a1b352735f4 Mon Sep 17 00:00:00 2001 From: 8402134 <8402134@qq.com> Date: Thu, 22 Sep 2022 11:39:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=9C=8B=E5=8F=8B=E5=9C=88=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E8=B7=9F=E5=8F=91=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 应用/Weixin.CircleTools/Class1.cs | 1 + 应用/Weixin.CircleTools/MonitorThread.cs | 6 +++--- 类库/Api.Framework/Tools/SqlSugarEx.cs | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/应用/Weixin.CircleTools/Class1.cs b/应用/Weixin.CircleTools/Class1.cs index acd7de1..e84666b 100644 --- a/应用/Weixin.CircleTools/Class1.cs +++ b/应用/Weixin.CircleTools/Class1.cs @@ -76,6 +76,7 @@ namespace CircleFriendsTools Config = this.ReadConfig(); var thread = TimerTask.NewTimer(1) as MonitorThread; //创建线程 - 监听好友朋友圈和接口的线程 1秒 + thread.Init(); thread.plugin = this; } catch (Exception ex) diff --git a/应用/Weixin.CircleTools/MonitorThread.cs b/应用/Weixin.CircleTools/MonitorThread.cs index 8a8444f..3420eed 100644 --- a/应用/Weixin.CircleTools/MonitorThread.cs +++ b/应用/Weixin.CircleTools/MonitorThread.cs @@ -52,12 +52,11 @@ namespace CircleFriendsTools /// private static BlockingCollection waitSendCircleInfoList = new BlockingCollection(); - - static MonitorThread() + public void Init() { var th = new Thread(() => { - foreach (var circleInfo in waitSendCircleInfoList) + foreach (var circleInfo in waitSendCircleInfoList.GetConsumingEnumerable()) { try { @@ -364,6 +363,7 @@ namespace CircleFriendsTools if (isNews) { + EventClient.OnEvent(this, $"朋友圈工具 - 采集到新朋友圈内容 等待发送数量 => {waitSendCircleInfoList.Count}"); if (!string.IsNullOrWhiteSpace(newestTime)) { Class1.Config.MonitorInfoHistoryTime = newestTime; diff --git a/类库/Api.Framework/Tools/SqlSugarEx.cs b/类库/Api.Framework/Tools/SqlSugarEx.cs index 81e754c..4e9a515 100644 --- a/类库/Api.Framework/Tools/SqlSugarEx.cs +++ b/类库/Api.Framework/Tools/SqlSugarEx.cs @@ -10,6 +10,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using Api.Framework.Utils; namespace Api.Framework.Tools { @@ -403,7 +404,7 @@ namespace Api.Framework.Tools if (reg.Success) db_name = reg.Groups["db_name"].ToString(); - var row = session.FindRow("SELECT * FROM information_schema.statistics WHERE table_schema = @db_name and table_name = @tableName AND index_name = @indexName", new { db_name = db_name, tableName = tableName, indexName = tableName+ "__" + indexName }); + var row = session.FindRow("SELECT * FROM information_schema.statistics WHERE table_schema = @db_name and table_name = @tableName AND index_name = @indexName", new { db_name = db_name, tableName = tableName, indexName = tableName + "__" + indexName }); if (row != null) return true; } else if (session.CurrentConnectionConfig.DbType == DbType.Sqlite) @@ -427,7 +428,7 @@ namespace Api.Framework.Tools if (indexName.Length > 64) indexName = indexName.Substring(0, 64); - + if (session.CurrentConnectionConfig.DbType == DbType.Sqlite) @@ -724,7 +725,7 @@ namespace Api.Framework.Tools } catch (Exception ex) { - EventClient.OnEvent("", $"增加字段异常:{ex.Message} - {tableName} - {columnName} - {sqlType}"); + LogHelper.GetSingleObj().Error("启动表字段检测", $"增加字段异常:{ex.Message} - {tableName} - {columnName} - {sqlType}"); } }