45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
package routes
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
adminhandler "wx_service/internal/admin"
|
|
)
|
|
|
|
func registerAdminRoutes(router *gin.Engine, handler *adminhandler.Handler) {
|
|
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("/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)
|
|
}
|
|
}
|
|
}
|