1.朋友圈工具跟发逻辑优化

This commit is contained in:
老道 2022-09-22 11:39:51 +08:00
parent b7c634141e
commit d23ad73d71
3 changed files with 8 additions and 6 deletions

View File

@ -76,6 +76,7 @@ namespace CircleFriendsTools
Config = this.ReadConfig<Config>();
var thread = TimerTask.NewTimer<MonitorThread>(1) as MonitorThread; //创建线程 - 监听好友朋友圈和接口的线程 1秒
thread.Init();
thread.plugin = this;
}
catch (Exception ex)

View File

@ -52,12 +52,11 @@ namespace CircleFriendsTools
/// </summary>
private static BlockingCollection<WaitSendCircleInfo> waitSendCircleInfoList = new BlockingCollection<WaitSendCircleInfo>();
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;

View File

@ -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}");
}
}