重构(yudao_aiot_alarm): 核心告警类型名从 constants 派生,扩展类型保留
This commit is contained in:
@@ -20,6 +20,7 @@ import os
|
||||
import httpx
|
||||
|
||||
from app.yudao_compat import YudaoResponse, get_current_user
|
||||
from app.constants import ALARM_TYPE_NAMES as _BASE_TYPE_NAMES
|
||||
from app.services.alarm_event_service import get_alarm_event_service, AlarmEventService
|
||||
from app.services.notification_service import get_notification_service
|
||||
from app.services.oss_storage import get_oss_storage
|
||||
@@ -557,9 +558,8 @@ async def _notify_ops_platform(data: dict):
|
||||
|
||||
def _get_alarm_type_name(alarm_type: Optional[str]) -> str:
|
||||
"""获取告警类型名称"""
|
||||
type_names = {
|
||||
"leave_post": "离岗检测",
|
||||
"intrusion": "周界入侵",
|
||||
_EXTENDED_TYPE_NAMES = {
|
||||
**_BASE_TYPE_NAMES,
|
||||
"crowd": "人群聚集",
|
||||
"fire": "火焰检测",
|
||||
"smoke": "烟雾检测",
|
||||
@@ -567,4 +567,4 @@ def _get_alarm_type_name(alarm_type: Optional[str]) -> str:
|
||||
"helmet": "安全帽检测",
|
||||
"unknown": "未知类型",
|
||||
}
|
||||
return type_names.get(alarm_type, alarm_type or "未知类型")
|
||||
return _EXTENDED_TYPE_NAMES.get(alarm_type, alarm_type or "未知类型")
|
||||
|
||||
Reference in New Issue
Block a user