feat(admin): 完善站点设置、内容回收站与后台菜单分组

新增站点设置与内容管理(含已删除恢复/清除),用户页改用独有运营指标,并按概览/内容/成员与经济/站点重组侧栏。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-16 05:56:27 +08:00
parent be47b38370
commit dd7bd010b8
25 changed files with 2193 additions and 323 deletions

View File

@@ -41,7 +41,8 @@ func Setup(cfg *config.Config) (*gin.Engine, error) {
// 服务
authSvc := service.NewAuthService(model.DB, cfg.JWTSecret)
boardSvc := service.NewBoardService(model.DB)
postSvc := service.NewPostService(model.DB)
settingSvc := service.NewSettingService(model.DB)
postSvc := service.NewPostService(model.DB).WithSetting(settingSvc)
commentSvc := service.NewCommentService(model.DB)
likeSvc := service.NewLikeService(model.DB)
notifSvc := service.NewNotificationService(model.DB)
@@ -51,7 +52,6 @@ func Setup(cfg *config.Config) (*gin.Engine, error) {
uploadSvc := service.NewUploadService(model.DB, filepath.Join(cfg.DataDir, "uploads"))
postFileSvc := service.NewPostFileService(model.DB, filepath.Join(cfg.DataDir, "private"))
pointsSvc := service.NewPointsService(model.DB)
settingSvc := service.NewSettingService(model.DB)
adminUserSvc := service.NewAdminUserService(model.DB)
moderationSvc := service.NewModerationService(model.DB, notifSvc)
chatSvc := service.NewChatService(model.DB, notifSvc)
@@ -205,6 +205,17 @@ func Setup(cfg *config.Config) (*gin.Engine, error) {
staffAPI.PUT("/moderation/comments/:id/approve", h.AdminApproveComment)
staffAPI.PUT("/moderation/comments/:id/reject", h.AdminRejectComment)
// 内容库:帖子/评论全量 + 回收站(恢复 / 彻底删除)
staffAPI.GET("/content/counts", h.AdminContentCounts)
staffAPI.GET("/content/posts", h.AdminListPosts)
staffAPI.GET("/content/comments", h.AdminListComments)
staffAPI.DELETE("/content/posts/:id", h.AdminSoftDeletePost)
staffAPI.PUT("/content/posts/:id/restore", h.AdminRestorePost)
staffAPI.DELETE("/content/posts/:id/purge", h.AdminPurgePost)
staffAPI.DELETE("/content/comments/:id", h.AdminSoftDeleteComment)
staffAPI.PUT("/content/comments/:id/restore", h.AdminRestoreComment)
staffAPI.DELETE("/content/comments/:id/purge", h.AdminPurgeComment)
// 积分与类型帖概览(管理员及以上)
staffAPI.GET("/economy", authMW.RequirePerm(service.PermAnnouncements), h.AdminPointsStats)