后端(notify 模块) - 新增 notify 模块:DAO/Service/Pusher 接口/Controller/Router/CleanupTask - 数据库 DDL:notify_notifications 表 + 3 索引(user+created/user+is_read/user+category) - 11 种 type 枚举(好友/群聊 9 种 + meeting_* 2 种预留)+ 4 种 category - 跨模块集成:contact 3 处 Pusher(friend_request/accepted/rejected) - 跨模块集成:group 6 处 Pusher(invite/join_request/approved/rejected/kicked/role_changed) - WS handler 断线补偿:连接建立即推送 notify.unread.total - 5 REST API(4 用户 + 1 管理员广播)+ 2 WS 事件(notify.new / notify.unread.total) - 30 天已读通知定时清理(未读永久保留) - Provider/Wire 依赖注入(NotifyPusher、NotifyConnectHook、UserInfoResolver 接口) 前端 - 新增 notify 模块:API/Pinia Store(5 分类分页缓存 + 未读数 + WS 事件)/NotifyItem/通知中心主页 - profile 入口:铃铛 badge + 菜单项 badge + 数字显示 - App.vue/login 初始化 notifyStore WS 监听;logout 调用 notifyStore.reset() 清缓存 - 清理 contact.js/group.js 中散落 toast 与冗余 notify.friend.request/group.join.request 处理 - CustomTabBar 新增 hasDot() 聚合指示器:我的 Tab 显示纯红点(无数字), 当前聚合 notifyStore.unreadTotal,未来可扩展「资料待完善/安全提醒/新版本」等 文档 - 新增 Phase 2e 整体路线图 docs/plans/2026-04-20-phase2e-design.md - 新增 Phase 2e-1 专用设计 docs/plans/2026-04-20-phase2e-1-design.md(§6.4 TabBar 聚合红点) - 新增 Phase 2e-1 实施计划 docs/plans/2026-04-20-phase2e-1-implementation.plan.md - 新增 E2E 验证报告 test-report-phase2e-1-notification.md(含 Playwright MCP 2 个现场 Bug 修复记录) - 更新 docs/progress/CURRENT_STATUS.md、docs/api/README.md、docs/api/frontend/notify.md - 更新 .cursor/rules/project-context.mdc、docs/plans/2026-02-27-echochat-system-design.md 其他 - .gitignore 排除 .playwright-mcp/ MCP 临时快照 架构决策 - 单端 WS 连接:沿用现有 ws.Hub,多端已读同步推迟到 Phase 2f/二期 - 跨模块依赖:contact/group → notify 严格单向(接口注入模式) - 降级策略:Pusher 先入库后推送;WS 失败不回滚入库;入库失败仅 Warn 不影响业务 Playwright MCP 回归(4 类场景全通) - 实时推送(admin 广播 → 1s 内前端自动插入 + 角标 +1) - Deep-link 跳转(好友申请通知 → contact/request 页) - 批量清零(全部已读按钮) - TabBar 聚合红点(有未读亮/全部已读灭)与 notifyStore.unreadTotal 三层同步 Made-with: Cursor
115 lines
5.4 KiB
Go
115 lines
5.4 KiB
Go
// Code generated by Wire. DO NOT EDIT.
|
||
|
||
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
|
||
//go:build !wireinject
|
||
// +build !wireinject
|
||
|
||
package provider
|
||
|
||
import (
|
||
controller2 "github.com/echochat/backend/app/admin/controller"
|
||
dao2 "github.com/echochat/backend/app/admin/dao"
|
||
service2 "github.com/echochat/backend/app/admin/service"
|
||
"github.com/echochat/backend/app/auth/controller"
|
||
"github.com/echochat/backend/app/auth/dao"
|
||
"github.com/echochat/backend/app/auth/service"
|
||
controller3 "github.com/echochat/backend/app/contact/controller"
|
||
dao3 "github.com/echochat/backend/app/contact/dao"
|
||
service3 "github.com/echochat/backend/app/contact/service"
|
||
controller4 "github.com/echochat/backend/app/file/controller"
|
||
service4 "github.com/echochat/backend/app/file/service"
|
||
controller5 "github.com/echochat/backend/app/group/controller"
|
||
dao4 "github.com/echochat/backend/app/group/dao"
|
||
service5 "github.com/echochat/backend/app/group/service"
|
||
imApp "github.com/echochat/backend/app/im"
|
||
controller6 "github.com/echochat/backend/app/notify/controller"
|
||
dao5 "github.com/echochat/backend/app/notify/dao"
|
||
service6 "github.com/echochat/backend/app/notify/service"
|
||
task2 "github.com/echochat/backend/app/notify/task"
|
||
"github.com/echochat/backend/app/ws"
|
||
"github.com/echochat/backend/config"
|
||
"github.com/echochat/backend/pkg/db"
|
||
"github.com/echochat/backend/pkg/storage"
|
||
)
|
||
|
||
// Injectors from wire.go:
|
||
|
||
// InitializeApp 初始化整个应用(Wire 自动生成实现)
|
||
func InitializeApp(cfg *config.Config) (*App, error) {
|
||
databaseConfig := provideDBConfig(cfg)
|
||
gormDB, err := db.NewPostgres(databaseConfig)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
redisConfig := provideRedisConfig(cfg)
|
||
client, err := db.NewRedis(redisConfig)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
minioConfig := provideMinioConfig(cfg)
|
||
minioClient, err := storage.NewMinioClient(minioConfig)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
userDAO := dao.NewUserDAO(gormDB)
|
||
roleDAO := dao.NewRoleDAO(gormDB)
|
||
jwtConfig := provideJWTConfig(cfg)
|
||
tokenStore := service.NewTokenStore(client, jwtConfig)
|
||
authService := service.NewAuthService(userDAO, roleDAO, jwtConfig, tokenStore)
|
||
authController := controller.NewAuthController(authService)
|
||
adminAuthController := controller.NewAdminAuthController(authService)
|
||
userManageDAO := dao2.NewUserManageDAO(gormDB)
|
||
userManageService := service2.NewUserManageService(userManageDAO, userDAO, roleDAO)
|
||
userManageController := controller2.NewUserManageController(userManageService)
|
||
hub := ws.ProvideHub()
|
||
pubSub := ws.ProvidePubSub(client, hub)
|
||
friendshipDAO := dao3.NewFriendshipDAO(gormDB)
|
||
onlineService := ws.ProvideOnlineService(client, hub, pubSub, friendshipDAO)
|
||
onlineManageService := service2.NewOnlineManageService(onlineService, gormDB)
|
||
onlineController := controller2.NewOnlineController(onlineManageService)
|
||
contactManageService := service2.NewContactManageService(gormDB)
|
||
contactManageController := controller2.NewContactManageController(contactManageService)
|
||
handler := ws.ProvideWSHandler(hub, pubSub, jwtConfig, onlineService, authService)
|
||
friendGroupDAO := dao3.NewFriendGroupDAO(gormDB)
|
||
|
||
// Notify 模块初始化(contact/group 依赖 NotifyPusher)
|
||
notificationDAO := dao5.NewNotificationDAO(gormDB)
|
||
notifyService := service6.NewNotifyService(notificationDAO, pubSub, friendshipDAO)
|
||
notificationController := controller6.NewNotificationController(notifyService)
|
||
notifyCleanupTask := task2.NewCleanupTask(notificationDAO)
|
||
|
||
contactService := service3.NewContactService(friendshipDAO, friendGroupDAO, onlineService, notifyService)
|
||
contactController := controller3.NewContactController(contactService)
|
||
|
||
// IM 模块初始化
|
||
conversationDAO := imApp.ProvideConversationDAO(gormDB)
|
||
messageDAO := imApp.ProvideMessageDAO(gormDB)
|
||
groupDAO := dao4.NewGroupDAO(gormDB)
|
||
messageReadDAO := dao4.NewMessageReadDAO(gormDB)
|
||
imService := imApp.ProvideIMService(conversationDAO, messageDAO, pubSub, client, friendshipDAO, friendshipDAO, groupDAO, messageReadDAO)
|
||
imEventHandler := imApp.ProvideIMEventHandler(imService, hub)
|
||
offlinePusher := imApp.ProvideOfflinePusher(imService, conversationDAO, pubSub)
|
||
imController := imApp.ProvideIMController(imService)
|
||
|
||
// File 模块初始化
|
||
fileService := service4.NewFileService(minioClient, minioConfig)
|
||
fileController := controller4.NewFileController(fileService)
|
||
|
||
// Group 模块初始化
|
||
joinRequestDAO := dao4.NewJoinRequestDAO(gormDB)
|
||
groupService := service5.NewGroupService(groupDAO, joinRequestDAO, friendshipDAO, pubSub, messageDAO, notifyService)
|
||
groupController := controller5.NewGroupController(groupService)
|
||
|
||
// Admin 群组管理初始化
|
||
groupManageService := service2.NewGroupManageService(gormDB, groupDAO)
|
||
groupManageController := controller2.NewGroupManageController(groupManageService)
|
||
|
||
// Admin 消息管理初始化
|
||
messageManageDAO := dao2.NewMessageManageDAO(gormDB)
|
||
messageManageService := service2.NewMessageManageService(messageManageDAO, userDAO, conversationDAO, pubSub)
|
||
messageManageController := controller2.NewMessageManageController(messageManageService)
|
||
|
||
app := NewApp(cfg, gormDB, client, minioClient, authService, authController, adminAuthController, userManageController, onlineController, contactManageController, groupManageController, messageManageController, handler, hub, pubSub, onlineService, contactController, imController, imEventHandler, offlinePusher, fileController, groupController, notifyService, notificationController, notifyCleanupTask)
|
||
return app, nil
|
||
}
|