From 724183997ba56a62538603a753d181080ea795fe Mon Sep 17 00:00:00 2001
From: haoliang <821644@qq.com>
Date: Thu, 7 May 2026 01:00:52 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E7=8A=B6=E6=80=81=E6=98=BE?=
=?UTF-8?q?=E7=A4=BAPing=E5=BB=B6=E8=BF=9F=EF=BC=88=E5=9C=A8=E7=BA=BF-1ms/?=
=?UTF-8?q?=E7=A6=BB=E7=BA=BF-1ms=E6=A0=BC=E5=BC=8F=EF=BC=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
frontend/src/views/machine/MachineListPage.vue | 3 +--
src/CncCollector/Core/CollectWorker.cs | 4 ++--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/frontend/src/views/machine/MachineListPage.vue b/frontend/src/views/machine/MachineListPage.vue
index b4f8f9f..366010b 100644
--- a/frontend/src/views/machine/MachineListPage.vue
+++ b/frontend/src/views/machine/MachineListPage.vue
@@ -48,8 +48,7 @@
- {{ row.isOnline ? '在线' : '离线' }}
- {{ row.lastPingLatency }}ms
+ {{ row.isOnline ? '在线' : '离线' }}{{ row.lastPingLatency != null ? `-${row.lastPingLatency}ms` : '' }}
diff --git a/src/CncCollector/Core/CollectWorker.cs b/src/CncCollector/Core/CollectWorker.cs
index b7d4450..c723f03 100644
--- a/src/CncCollector/Core/CollectWorker.cs
+++ b/src/CncCollector/Core/CollectWorker.cs
@@ -253,10 +253,10 @@ namespace CncCollector.Core
conn.Execute(@"UPDATE cnc_machine SET last_ping_time = NOW(), last_ping_latency = @Latency, updated_at = NOW() WHERE id = @Id",
new { Id = kv.Key, Latency = kv.Value });
}
- // 离线机床:清空延迟,不更新 last_ping_time
+ // 离线机床:不更新 last_ping_time,保留上次延迟值
if (offlineIds.Count > 0)
{
- conn.Execute(@"UPDATE cnc_machine SET last_ping_latency = NULL, updated_at = NOW() WHERE id IN @Ids",
+ conn.Execute(@"UPDATE cnc_machine SET updated_at = NOW() WHERE id IN @Ids",
new { Ids = offlineIds });
}
}