package routes import ( "github.com/gin-gonic/gin" adminhandler "wx_service/internal/admin" marketinghandler "wx_service/internal/marketing/handler" ) func registerAdminRoutes( router *gin.Engine, handler *adminhandler.Handler, categoryHandler *marketinghandler.CategoryHandler, templateHandler *marketinghandler.TemplateHandler, downloadHandler *marketinghandler.DownloadHandler, ) { if handler == nil { return } admin := router.Group("/api/admin") { admin.POST("/login", handler.Login) protected := admin.Group("") protected.Use(handler.AuthMiddleware()) { protected.GET("/profile", handler.Profile) protected.POST("/logout", handler.Logout) protected.GET("/stats/overview", handler.StatsOverview) protected.GET("/stats/mini-programs", handler.StatsMiniPrograms) protected.GET("/stats/user-growth", handler.StatsUserGrowth) protected.GET("/mini-programs", handler.ListMiniPrograms) protected.GET("/mini-programs/:id", handler.GetMiniProgram) protected.GET("/mini-programs/:id/stats", handler.GetMiniProgramStats) protected.POST("/mini-programs", handler.CreateMiniProgram) protected.PUT("/mini-programs/:id", handler.UpdateMiniProgram) protected.DELETE("/mini-programs/:id", handler.DeleteMiniProgram) protected.GET("/users", handler.ListUsers) protected.GET("/users/:id", handler.GetUserDetail) protected.GET("/settings", handler.GetSettings) protected.PUT("/settings/profile", handler.UpdateProfile) protected.GET("/settings/system", handler.GetSystemConfig) protected.PUT("/settings/system", handler.UpdateSystemConfig) protected.PUT("/settings/password", handler.UpdatePassword) protected.GET("/watermark/video-parse-logs", handler.ListVideoParseLogs) protected.GET("/watermark/video-parse-unlocks", handler.ListVideoParseUnlocks) protected.GET("/watermark/video-download-failures", handler.ListVideoDownloadFailures) protected.GET("/memberships/overview", handler.MembershipOverview) protected.GET("/memberships/redeem-codes", handler.ListMembershipRedeemCodes) protected.POST("/memberships/redeem-codes", handler.CreateMembershipRedeemCodes) protected.POST("/memberships/redeem-codes/:id/status", handler.UpdateMembershipRedeemCodeStatus) if categoryHandler != nil && templateHandler != nil && downloadHandler != nil { marketing := protected.Group("/marketing") { marketing.GET("/categories", categoryHandler.AdminList) marketing.POST("/categories", categoryHandler.AdminCreate) marketing.PUT("/categories/:id", categoryHandler.AdminUpdate) marketing.DELETE("/categories/:id", categoryHandler.AdminDelete) marketing.GET("/templates", templateHandler.AdminList) marketing.POST("/templates", templateHandler.AdminCreate) marketing.PUT("/templates/:id", templateHandler.AdminUpdate) marketing.DELETE("/templates/:id", templateHandler.AdminDelete) marketing.GET("/stats", downloadHandler.AdminStats) marketing.POST("/upload/qiniu/token", downloadHandler.AdminQiniuToken) } } } } }