This commit is contained in:
jxxghp
2024-07-04 07:13:49 +08:00
parent dde2d22d93
commit 5f01dd5625
14 changed files with 51 additions and 19 deletions
+14 -5
View File
@@ -1,7 +1,7 @@
from typing import List
from app.db.systemconfig_oper import SystemConfigOper
from app.schemas import NotificationConf
from app.schemas import NotificationConf, NotificationSwitchConf
from app.schemas.types import SystemConfigKey
@@ -13,11 +13,20 @@ class NotificationHelper:
def __init__(self):
self.systemconfig = SystemConfigOper()
def get_notifications(self) -> List[NotificationConf]:
def get_clients(self) -> List[NotificationConf]:
"""
获取消息通知渠道
"""
notification_confs: List[dict] = self.systemconfig.get(SystemConfigKey.Notifications)
if not notification_confs:
client_confs: List[dict] = self.systemconfig.get(SystemConfigKey.Notifications)
if not client_confs:
return []
return [NotificationConf(**conf) for conf in notification_confs]
return [NotificationConf(**conf) for conf in client_confs]
def get_switchs(self) -> List[dict]:
"""
获取消息通知场景开关
"""
switchs: List[dict] = self.systemconfig.get(SystemConfigKey.NotificationSwitchs)
if not switchs:
return []
return [NotificationSwitchConf(**switch) for switch in switchs]