第 5 阶段:纠纷、通知与后台-1
This commit is contained in:
@@ -5,9 +5,12 @@ import (
|
||||
"hfb_sys/backend/internal/handler"
|
||||
"hfb_sys/backend/internal/middleware"
|
||||
"hfb_sys/backend/internal/modules/auth"
|
||||
"hfb_sys/backend/internal/modules/dispute"
|
||||
"hfb_sys/backend/internal/modules/listing"
|
||||
"hfb_sys/backend/internal/modules/notification"
|
||||
"hfb_sys/backend/internal/modules/order"
|
||||
"hfb_sys/backend/internal/modules/realname"
|
||||
"hfb_sys/backend/internal/modules/systemconfig"
|
||||
"hfb_sys/backend/internal/modules/user"
|
||||
"hfb_sys/backend/internal/modules/wallet"
|
||||
|
||||
@@ -59,6 +62,24 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
}
|
||||
walletService := wallet.NewService(walletRepo)
|
||||
walletHandler := wallet.NewHandler(walletService)
|
||||
var notificationRepo *notification.Repository
|
||||
if deps.DB != nil {
|
||||
notificationRepo = notification.NewRepository(deps.DB)
|
||||
}
|
||||
notificationService := notification.NewService(notificationRepo)
|
||||
notificationHandler := notification.NewHandler(notificationService)
|
||||
var disputeRepo *dispute.Repository
|
||||
if deps.DB != nil {
|
||||
disputeRepo = dispute.NewRepository(deps.DB)
|
||||
}
|
||||
disputeService := dispute.NewService(disputeRepo)
|
||||
disputeHandler := dispute.NewHandler(disputeService)
|
||||
var systemConfigRepo *systemconfig.Repository
|
||||
if deps.DB != nil {
|
||||
systemConfigRepo = systemconfig.NewRepository(deps.DB)
|
||||
}
|
||||
systemConfigService := systemconfig.NewService(systemConfigRepo)
|
||||
systemConfigHandler := systemconfig.NewHandler(systemConfigService)
|
||||
requireAuth := middleware.Auth(jwtManager)
|
||||
requireRealname := middleware.RequireRealname(userRepo)
|
||||
|
||||
@@ -103,6 +124,13 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
orderRoutes.POST("/:id/confirm-receive", orderHandler.ConfirmReceive)
|
||||
orderRoutes.POST("/:id/return", orderHandler.SubmitReturn)
|
||||
orderRoutes.POST("/:id/confirm-return", orderHandler.ConfirmReturn)
|
||||
orderRoutes.POST("/:id/dispute", disputeHandler.Create)
|
||||
}
|
||||
|
||||
disputeRoutes := api.Group("/disputes", requireAuth)
|
||||
{
|
||||
disputeRoutes.GET("", disputeHandler.List)
|
||||
disputeRoutes.GET("/:id", disputeHandler.Detail)
|
||||
}
|
||||
|
||||
walletRoutes := api.Group("/wallet", requireAuth)
|
||||
@@ -111,11 +139,25 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
|
||||
walletRoutes.GET("/ledger", walletHandler.Ledger)
|
||||
}
|
||||
|
||||
notificationRoutes := api.Group("/notifications", requireAuth)
|
||||
{
|
||||
notificationRoutes.GET("", notificationHandler.List)
|
||||
notificationRoutes.POST("/:id/read", notificationHandler.MarkRead)
|
||||
}
|
||||
|
||||
realnameRoutes := api.Group("/realname", requireAuth)
|
||||
{
|
||||
realnameRoutes.POST("/start", realnameHandler.Start)
|
||||
realnameRoutes.GET("/status", realnameHandler.Status)
|
||||
}
|
||||
|
||||
adminRoutes := api.Group("/admin", requireAuth)
|
||||
{
|
||||
adminRoutes.GET("/disputes", disputeHandler.AdminList)
|
||||
adminRoutes.POST("/disputes/:id/arbitrate", disputeHandler.AdminArbitrate)
|
||||
adminRoutes.GET("/system-configs", systemConfigHandler.List)
|
||||
adminRoutes.PUT("/system-configs/:key", systemConfigHandler.Update)
|
||||
}
|
||||
}
|
||||
|
||||
return engine
|
||||
|
||||
Reference in New Issue
Block a user