feat: 管理首页帖子总数统计(总数/已发布/待审核)
- PostRepo 新增 CountPostsByStatus 和 CountPending 方法 - Service 层定义 postAdminStatStore 接口 (ISP) - AdminService 注入 postRepo,新增 PostStats 结构体和 GetPostStats 方法 - AdminController.Dashboard 调用 GetPostStats 并传参到模板 - Dashboard 帖子卡片显示总数 + 已发布 + 待审核(橙色徽章) - DI 层将 AdminController 创建从 buildDepsCore 移至 buildDeps,以便注入 postRepo
This commit is contained in:
@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func buildDeps(db *gorm.DB, cfg *config.Config, siteSettings *config.SiteSettings, redisClient *redis.Client) *dependencies {
|
||||
userRepo, sessionMgr, authService, _, authCtrl, avatarSvc, authMdw, adminController := buildDepsCore(db, cfg, siteSettings, redisClient)
|
||||
userRepo, sessionMgr, authService, _, authCtrl, avatarSvc, authMdw := buildDepsCore(db, cfg, siteSettings, redisClient)
|
||||
|
||||
auditRepo := repository.NewAuditRepo(db)
|
||||
notificationRepo := repository.NewNotificationRepo(db)
|
||||
@ -37,6 +37,7 @@ func buildDeps(db *gorm.DB, cfg *config.Config, siteSettings *config.SiteSetting
|
||||
shortcodeSvc := service.NewShortcodeService()
|
||||
postCtrl := controller.NewPostController(postService, shortcodeSvc)
|
||||
adminPostCtrl := adminCtrl.NewAdminPostController(postService)
|
||||
adminController := adminCtrl.NewAdminController(service.NewAdminService(userRepo, postRepo, sessionMgr))
|
||||
studioCtrl := controller.NewStudioController(postService)
|
||||
|
||||
// 用户空间
|
||||
|
||||
Reference in New Issue
Block a user