|
@@ -743,7 +743,12 @@ class DevicePushService:
|
|
|
for item in event_list
|
|
|
)
|
|
|
elif not msg_type and event_type not in DATA_PUSH_EVENT_TYPE_LIST:
|
|
|
- msg_type = DevicePushService.get_event_type_text_v2(lang, event_type, None, redis_obj)
|
|
|
+ # --- 新增代码:高频事件拦截 ---
|
|
|
+ cache_key_tuple = (lang, event_type)
|
|
|
+ if cache_key_tuple in DevicePushService._HIGH_FREQ_CACHE:
|
|
|
+ msg_type = DevicePushService._HIGH_FREQ_CACHE[cache_key_tuple]
|
|
|
+ else:
|
|
|
+ msg_type = DevicePushService.get_event_type_text_v2(lang, event_type, None, redis_obj)
|
|
|
|
|
|
if is_sys:
|
|
|
if device_type in MULTI_CHANNEL_TYPE_LIST:
|
|
@@ -1277,3 +1282,36 @@ class DevicePushService:
|
|
|
now_data = CommonService.get_now_time_str(now_time, tz, 'cn')
|
|
|
week = LocalDateTimeUtil.date_to_week(now_data)
|
|
|
return now_data, week
|
|
|
+
|
|
|
+ # 新增内存缓存专用字典(线程安全,无需锁)
|
|
|
+ _HIGH_FREQ_CACHE = {
|
|
|
+ # 格式: (lang, event_type, dealings_type) : msg
|
|
|
+ ('cn', 51): '检测到画面变化',
|
|
|
+ ('cn', 57): '有人出现',
|
|
|
+ ('en', 51): 'Detected scene change',
|
|
|
+ ('en', 57): 'Person detected',
|
|
|
+ ('es', 51): 'Cambio de pantalla detectado',
|
|
|
+ ('es', 57): 'Persona detectada',
|
|
|
+ ('fr', 51): "Changement d'écran détecté",
|
|
|
+ ('fr', 57): "Présence d'une personne",
|
|
|
+ ('de', 51): "Bildschirmänderung erkannt",
|
|
|
+ ('de', 57): "Jemand anwesend",
|
|
|
+ ('cn_tw', 51): "檢測到畫面變化",
|
|
|
+ ('cn_tw', 57): "有人出現",
|
|
|
+ ('pt', 51): "Alteração do ecrã detectada",
|
|
|
+ ('pt', 57): "Pessoa detectada",
|
|
|
+ ('ru', 51): "Обнаружено изменение сцены",
|
|
|
+ ('ru', 57): "Обнаружен человек",
|
|
|
+ ('ja', 51): "画面変化を検知",
|
|
|
+ ('ja', 57): "人を検知",
|
|
|
+ ('it', 51): "Rilevato Cambio di Schermata",
|
|
|
+ ('it', 57): "Presenza Umana",
|
|
|
+ ('pl', 51): "Wykryto zmianę obrazu",
|
|
|
+ ('pl', 57): "Wykryto osobę",
|
|
|
+ ('nl', 51): "Schermverandering gedetecteerd",
|
|
|
+ ('nl', 57): "Iemand aanwezig",
|
|
|
+ ('ko', 51): "화면 변화 감지됨",
|
|
|
+ ('ko', 57): "사람 출현",
|
|
|
+ ('ar', 51): "تم اكتشاف تغيير في الصورة",
|
|
|
+ ('ar', 57): "وجود شخص",
|
|
|
+ }
|