From 288f5a0db684bb94219746886bf2ee8f375599f3 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Mon, 3 Mar 2025 14:04:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87=E7=9B=91?= =?UTF-8?q?=E6=8E=A7=EF=BC=8C=E7=AC=AC=E4=B8=80=E6=AC=A1=E4=B8=8A=E7=BA=BF?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/tool.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/handler/tool.go b/handler/tool.go index 25b6f28..f132126 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -76,7 +76,8 @@ func SetDeviceStatusV2(c *gin.Context) { if v == req.ID { // 继续处理请求 //是否是暂停之后第一次上线,如果是则发送邮件通知 - if worker.IsContainKey("monitor_"+req.ID) == false { + device_status := worker.GetRedis("monitor_" + req.ID) + if device_status == "2" { //发送邮件通知 title := "设备上线" content := "设备上线\n设备:" + req.ID + "\t状态:" + req.Status + "\t时间:" + time.Now().String() @@ -329,7 +330,7 @@ func ScanDeviceStatus() { for _, v := range devices { c := worker.IsContainKey("monitor_" + v) if c == false { - worker.SetRedisWithExpire("monitor_"+v, "1", time.Hour*24) + worker.SetRedisWithExpire("monitor_"+v, "2", time.Hour*24) offline += v + "," } }