feat: 注册 aiot 路由并更新主程序配置

- main.py:注册 aiot_alarm 和 aiot_edge 路由,保留旧路由兼容
- config.py/alert_service.py/mqtt_service.py:同步更新配置和服务
- 添加 CLAUDE.md 项目说明文档

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 16:39:53 +08:00
parent 5a2d887f1f
commit b3cf544343
5 changed files with 200 additions and 11 deletions

View File

@@ -26,6 +26,8 @@ from app.services.mqtt_service import get_mqtt_service
from app.services.notification_service import get_notification_service
from app.services.device_service import get_device_service
from app.utils.logger import logger
from app.routers import yudao_alert_router, yudao_auth_router, yudao_aiot_alarm_router, yudao_aiot_edge_router
from app.yudao_compat import yudao_exception_handler
import json
@@ -100,6 +102,19 @@ app.add_middleware(
allow_headers=["*"],
)
# ==================== 芋道兼容路由 ====================
# 提供与芋道主平台一致的接口规范,便于前端统一对接
app.include_router(yudao_auth_router)
app.include_router(yudao_alert_router)
# ==================== AIoT 统一路由 ====================
# aiot 命名空间下的新路由,与旧路由并存
app.include_router(yudao_aiot_alarm_router)
app.include_router(yudao_aiot_edge_router)
# 注册芋道格式异常处理器
app.add_exception_handler(HTTPException, yudao_exception_handler)
def get_alert_svc():
return alert_service