feat(platform-ops): 增加平台只读统计接口与超管入口
This commit is contained in:
@@ -36,6 +36,7 @@ import (
|
||||
"hfb_sys/backend/internal/modules/paymentaccount"
|
||||
"hfb_sys/backend/internal/modules/paymentconfig"
|
||||
"hfb_sys/backend/internal/modules/pickup"
|
||||
"hfb_sys/backend/internal/modules/platformops"
|
||||
"hfb_sys/backend/internal/modules/pointsmall"
|
||||
"hfb_sys/backend/internal/modules/qualityowner"
|
||||
"hfb_sys/backend/internal/modules/realname"
|
||||
@@ -112,6 +113,11 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
}
|
||||
adminDashboardService := admindashboard.NewService(adminDashboardRepo)
|
||||
adminDashboardHandler := admindashboard.NewHandler(adminDashboardService)
|
||||
var platformOpsRepo *platformops.Repository
|
||||
if deps.DB != nil {
|
||||
platformOpsRepo = platformops.NewRepository(deps.DB)
|
||||
}
|
||||
platformOpsHandler := platformops.NewHandler(platformops.NewService(platformOpsRepo))
|
||||
var manualEntryRepo *csmanualentry.Repository
|
||||
if deps.DB != nil {
|
||||
manualEntryRepo = csmanualentry.NewRepository(deps.DB)
|
||||
@@ -357,6 +363,7 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
}
|
||||
}
|
||||
// 先识别经营租户,再兼容旧分销站点。经营租户识别成功后,后续旧分销参数和域名兜底均不生效。
|
||||
engine.Use(middleware.PlatformOpsContext(cfg.OpsDomain))
|
||||
if tenantRepo != nil {
|
||||
engine.Use(middleware.TenantContext(tenantRepo, cfg.AppEnv, logger, "dachui"))
|
||||
}
|
||||
@@ -365,6 +372,7 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
engine.Use(middleware.SiteDomainFallback(distributionRepo, logger))
|
||||
}
|
||||
engine.Use(middleware.BlockTenantLegacyDistributionAdmin())
|
||||
engine.Use(middleware.PlatformOpsReadOnlyGuard())
|
||||
distributionHandler := distribution.NewHandler(distributionService)
|
||||
if invitationHandler != nil && distributionService != nil {
|
||||
invitationHandler.SetSiteScoper(distributionService)
|
||||
@@ -771,6 +779,12 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
adminRoutes.GET("/me", adminAuthHandler.Me)
|
||||
adminRoutes.PUT("/me/support-status", adminAuthHandler.UpdateSupportStatus)
|
||||
adminRoutes.POST("/auth/logout", adminAuthHandler.Logout)
|
||||
adminRoutes.GET(
|
||||
"/platform/overview",
|
||||
middleware.RequirePlatformOps(),
|
||||
requirePerm("dashboard:view"),
|
||||
platformOpsHandler.Overview,
|
||||
)
|
||||
adminRoutes.GET("/distribution/auth/me", distributionHandler.Me)
|
||||
adminRoutes.POST("/distribution/auth/logout", distributionHandler.Logout)
|
||||
adminRoutes.POST("/files/upload", fileHandler.Upload)
|
||||
|
||||
Reference in New Issue
Block a user