feat: 增加推送通知配置

This commit is contained in:
yml2213
2026-06-19 16:28:49 +08:00
parent a4cdc3e806
commit 5ff1ea40b0
15 changed files with 1376 additions and 51 deletions
+14
View File
@@ -14,6 +14,7 @@ import (
"hfb_sys/backend/internal/modules/adminfinance"
"hfb_sys/backend/internal/modules/adminmgr"
"hfb_sys/backend/internal/modules/adminnotification"
"hfb_sys/backend/internal/modules/adminpush"
"hfb_sys/backend/internal/modules/adminrole"
"hfb_sys/backend/internal/modules/adminuser"
"hfb_sys/backend/internal/modules/announcement"
@@ -152,6 +153,12 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
}
adminNotificationService := adminnotification.NewService(adminNotificationRepo)
adminNotificationHandler := adminnotification.NewHandler(adminNotificationService)
var adminPushRepo *adminpush.Repository
if deps.DB != nil {
adminPushRepo = adminpush.NewRepository(deps.DB)
}
adminPushService := adminpush.NewService(adminPushRepo)
adminPushHandler := adminpush.NewHandler(adminPushService)
userHandler := user.NewHandler(userRepo)
var realnameRepo *realname.Repository
if deps.DB != nil {
@@ -555,6 +562,13 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
adminRoutes.GET("/notifications/unread-count", requirePerm("notification:view"), adminNotificationHandler.UnreadCount)
adminRoutes.PUT("/notifications/read-all", requirePerm("notification:view"), adminNotificationHandler.MarkAllRead)
adminRoutes.POST("/notifications/:id/read", requirePerm("notification:view"), adminNotificationHandler.MarkRead)
adminRoutes.GET("/push-channels", requirePerm("system_config:view"), adminPushHandler.ListChannels)
adminRoutes.POST("/push-channels", requirePerm("system_config:update"), adminPushHandler.CreateChannel)
adminRoutes.PUT("/push-channels/:id", requirePerm("system_config:update"), adminPushHandler.UpdateChannel)
adminRoutes.DELETE("/push-channels/:id", requirePerm("system_config:update"), adminPushHandler.DeleteChannel)
adminRoutes.POST("/push-channels/:id/test", requirePerm("system_config:update"), adminPushHandler.TestChannel)
adminRoutes.GET("/push-rules", requirePerm("system_config:view"), adminPushHandler.ListRules)
adminRoutes.PUT("/push-rules/:id", requirePerm("system_config:update"), adminPushHandler.UpdateRule)
adminRoutes.GET("/audit-logs", requirePerm("audit_log:view"), adminAuditHandler.List)
if chatHubHandler != nil {
adminRoutes.GET("/chats/events", requirePerm("chat:view"), chatHubHandler.AdminEvents)