From ea51b3bef578b96f11ef7eb3f87692ca60e38e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=BA=E8=83=BD=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Tue, 22 Oct 2024 08:41:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91TraceItem=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=87=8F=E8=BE=83=E5=A4=A7=E6=97=B6=E7=9A=84=E6=80=A7=E8=83=BD?= =?UTF-8?q?=E6=B5=AA=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...347\224\250\350\267\237\350\270\252\345\231\250.Biz.cs" | 7 ++++--- .../Monitors/\350\267\237\350\270\252\351\241\271.Biz.cs" | 7 +++++++ Stardust.Server/Controllers/TraceController.cs | 3 ++- .../Areas/Monitors/Controllers/AppTracerController.cs | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git "a/Stardust.Data/Monitors/\345\272\224\347\224\250\350\267\237\350\270\252\345\231\250.Biz.cs" "b/Stardust.Data/Monitors/\345\272\224\347\224\250\350\267\237\350\270\252\345\231\250.Biz.cs" index 19f22663..346113cd 100644 --- "a/Stardust.Data/Monitors/\345\272\224\347\224\250\350\267\237\350\270\252\345\231\250.Biz.cs" +++ "b/Stardust.Data/Monitors/\345\272\224\347\224\250\350\267\237\350\270\252\345\231\250.Biz.cs" @@ -75,7 +75,7 @@ public override void Valid(Boolean isNew) } else { - ItemCount = TraceItems.Count; + ItemCount = TraceItem.FindCountByApp(ID); } } @@ -97,7 +97,7 @@ public override void Valid(Boolean isNew) /// 有效跟踪项集合 /// [XmlIgnore, IgnoreDataMember] - public IList TraceItems => Extends.Get(nameof(TraceItems), k => TraceItem.GetValids(ID, DateTime.Today.AddDays(-30))); + public IList TraceItems => Extends.Get(nameof(TraceItems), k => TraceItem.GetValids(ID, DateTime.Today.AddDays(-3))); #endregion #region 扩展查询 @@ -369,7 +369,8 @@ public void Fix() Days = list.Select(e => e.StatDate.ToFullString()).Distinct().Count(); Total = list.Sum(e => (Int64)e.Total); - ItemCount = TraceItems.Count; + //ItemCount = TraceItems.Count; + ItemCount = TraceItem.FindCountByApp(ID); } #endregion } \ No newline at end of file diff --git "a/Stardust.Data/Monitors/\350\267\237\350\270\252\351\241\271.Biz.cs" "b/Stardust.Data/Monitors/\350\267\237\350\270\252\351\241\271.Biz.cs" index 93b6218d..9c86890d 100644 --- "a/Stardust.Data/Monitors/\350\267\237\350\270\252\351\241\271.Biz.cs" +++ "b/Stardust.Data/Monitors/\350\267\237\350\270\252\351\241\271.Biz.cs" @@ -96,6 +96,13 @@ public static IList FindAllByApp(Int32 appId) return FindAll(_.AppId == appId); } + public static Int32 FindCountByApp(Int32 appId) + { + if (appId <= 0) return 0; + + return (Int32)FindCount(_.AppId == appId); + } + /// 根据应用、操作名查找 /// 应用 /// 操作名 diff --git a/Stardust.Server/Controllers/TraceController.cs b/Stardust.Server/Controllers/TraceController.cs index 3c346cbc..0e1a6d4f 100644 --- a/Stardust.Server/Controllers/TraceController.cs +++ b/Stardust.Server/Controllers/TraceController.cs @@ -54,7 +54,8 @@ public TraceResponse Report([FromBody] TraceModel model, String token) var (app, online) = Valid(model.AppId, model, model.ClientId, ip, token); // 插入数据 - if (builders != null && builders.Length > 0) Task.Run(() => ProcessData(app, model, online?.NodeId ?? 0, ip, builders)); + //if (builders != null && builders.Length > 0) Task.Run(() => ProcessData(app, model, online?.NodeId ?? 0, ip, builders)); + if (builders != null && builders.Length > 0) ProcessData(app, model, online?.NodeId ?? 0, ip, builders); // 构造响应 var rs = new TraceResponse diff --git a/Stardust.Web/Areas/Monitors/Controllers/AppTracerController.cs b/Stardust.Web/Areas/Monitors/Controllers/AppTracerController.cs index 484238cd..9ba37f31 100644 --- a/Stardust.Web/Areas/Monitors/Controllers/AppTracerController.cs +++ b/Stardust.Web/Areas/Monitors/Controllers/AppTracerController.cs @@ -280,7 +280,8 @@ public ActionResult FixOldData() } } - app.ItemCount = app.TraceItems.Count; + //app.ItemCount = app.TraceItems.Count; + app.ItemCount = TraceItem.FindCountByApp(app.ID); app.Update(); } }