From 379c9650894921633f6a6c8cb5a14f12cef2f6e8 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期日, 26 五月 2024 02:48:58 +0800
Subject: [PATCH] 入侵抓拍转人脸添加小图
---
service/subscribe.go | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/service/subscribe.go b/service/subscribe.go
index 0a6ce89..ccc9b5c 100644
--- a/service/subscribe.go
+++ b/service/subscribe.go
@@ -109,10 +109,11 @@
}
type SubscribeTask struct {
- ctx context.Context
- conf *models.Subscribe
- faceList []*vo.FaceObject
- mutex sync.Mutex
+ ctx context.Context
+ conf *models.Subscribe
+ faceList []*vo.FaceObject
+ mutex sync.Mutex
+ lastExecTime int64
}
func (task *SubscribeTask) Start() {
@@ -148,8 +149,8 @@
for _, subType := range subDetails {
triggerTime := time.Now().Format("20060102150405")
- // 涓婃姤璁惧
- if subType == vo.SubscribeApe {
+ // 涓婃姤璁惧 鎺у埗璁惧閫氱煡鎺у埗棰戠巼, 閬垮厤棰戠箒, 涓婄骇涓�鑸細涓嬪彂绉掔骇鐨勪换鍔�, 浣嗚澶囦笉浼氶绻佹洿鏂�,
+ if subType == vo.SubscribeApe && time.Now().Unix()-task.lastExecTime > 60*10 {
var notification = vo.DeviceNotification{
NotificationID: triggerTime + snowflake.GenerateIdStr(),
SubscribeID: task.conf.Id,
@@ -218,4 +219,6 @@
client.Notify(task.conf.Ext.ReceiveAddr, b)
}
}
+
+ task.lastExecTime = time.Now().Unix()
}
--
Gitblit v1.8.0