This commit is contained in:
Administrator committed 2026-06-06 00:29:45 +08:00
commit e0c949bde9
4 files changed
+92 -46

No files matched your search

+23 -2
View File
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using TouchSocket.Core;
namespace SunlightAggregationTerminal.Models
{
@@ -11,7 +12,8 @@ namespace SunlightAggregationTerminal.Models
{
public static SqliteHelper sqliteHelper = SQLiteConfig.Config(Path.Combine(FileSystem.AppDataDirectory, "MyAppData.db"))!; //数据库连接路径(获取各平台的应用数据目录)
private Timer timer;
private static int TimerNotifications = -1440;
public AppModels()
{
if(sqliteHelper != null)
@@ -43,7 +45,24 @@ namespace SunlightAggregationTerminal.Models
}
}
}
}
}
//启动通知轮询延迟120s启动周期600s
timer = new Timer(TimerNotification, null, TimeSpan.FromSeconds(120), TimeSpan.FromSeconds(300));
}
//轮询通知的定时任务
static void TimerNotification(object? state)
{
if (App.GlobalData.LogNo)//已经登录
{
Dictionary<string, object> NotificationDictionary = new Dictionary<string, object>();
NotificationDictionary.Add("Command", "Notification");
NotificationDictionary.Add("StartTime", DateTime.Now.AddMinutes(TimerNotifications).ToString("yyyy-MM-dd HH:mm:ss.fff"));
NotificationDictionary.Add("EndTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
DataReceived.Transmit(NotificationDictionary.ToJsonString());
TimerNotifications = -6;
}
}
public static void Updata(string sql)
@@ -115,6 +134,8 @@ namespace SunlightAggregationTerminal.Models
}
}
public static string GetAppUniqueId()
{
const string key = "sunlight_app_unique_id";