后端提现增加

This commit is contained in:
yml
2026-06-06 10:08:39 +08:00
parent 082fd908e9
commit 8a2d2f2a18
15 changed files with 2763 additions and 0 deletions
+39
View File
@@ -27,6 +27,8 @@ import (
"hfb_sys/backend/internal/modules/systemconfig"
"hfb_sys/backend/internal/modules/user"
"hfb_sys/backend/internal/modules/wallet"
"hfb_sys/backend/internal/modules/paymentaccount"
"hfb_sys/backend/internal/modules/withdrawal"
_ "hfb_sys/backend/docs" // Swagger 文档
@@ -109,6 +111,18 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
}
walletService := wallet.NewService(walletRepo)
walletHandler := wallet.NewHandler(walletService)
var paymentAccountRepo *paymentaccount.Repository
if deps.DB != nil {
paymentAccountRepo = paymentaccount.NewRepository(deps.DB)
}
paymentAccountService := paymentaccount.NewService(paymentAccountRepo)
paymentAccountHandler := paymentaccount.NewHandler(paymentAccountService)
var withdrawalRepo *withdrawal.Repository
if deps.DB != nil {
withdrawalRepo = withdrawal.NewRepository(deps.DB, walletRepo)
}
withdrawalService := withdrawal.NewService(withdrawalRepo)
withdrawalHandler := withdrawal.NewHandler(withdrawalService)
var paymentRepo *payment.Repository
if deps.DB != nil {
paymentRepo = payment.NewRepository(deps.DB, cfg.Payment, orderRepo, walletRepo)
@@ -283,6 +297,24 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
walletRoutes.POST("/withdraw", walletHandler.Withdraw)
}
paymentAccountRoutes := api.Group("/payment-accounts", requireAuth)
{
paymentAccountRoutes.GET("", paymentAccountHandler.List)
paymentAccountRoutes.GET("/:id", paymentAccountHandler.FindByID)
paymentAccountRoutes.POST("", paymentAccountHandler.Create)
paymentAccountRoutes.PUT("/:id", paymentAccountHandler.Update)
paymentAccountRoutes.DELETE("/:id", paymentAccountHandler.Delete)
paymentAccountRoutes.POST("/:id/set-default", paymentAccountHandler.SetDefault)
}
withdrawalRoutes := api.Group("/withdrawals", requireAuth)
{
withdrawalRoutes.POST("", withdrawalHandler.Create)
withdrawalRoutes.GET("", withdrawalHandler.List)
withdrawalRoutes.GET("/:id", withdrawalHandler.FindByID)
withdrawalRoutes.POST("/:id/cancel", withdrawalHandler.Cancel)
}
fileRoutes := api.Group("/files", requireAuth)
{
fileRoutes.POST("/upload", fileHandler.Upload)
@@ -356,6 +388,13 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
adminRoutes.GET("/disputes", requirePerm("dispute:view"), disputeHandler.AdminList)
adminRoutes.POST("/disputes/:id/arbitrate", requirePerm("dispute:arbitrate"), disputeHandler.AdminArbitrate)
adminRoutes.GET("/wallet/ledger", requirePerm("wallet:view"), walletHandler.AdminLedger)
// 提现管理
adminRoutes.GET("/withdrawals", requirePerm("withdrawal:list"), withdrawalHandler.AdminList)
adminRoutes.GET("/withdrawals/:id", requirePerm("withdrawal:detail"), withdrawalHandler.AdminFindByID)
adminRoutes.POST("/withdrawals/:id/review", requirePerm("withdrawal:review"), withdrawalHandler.Review)
adminRoutes.POST("/withdrawals/:id/confirm-payment", requirePerm("withdrawal:pay"), withdrawalHandler.ConfirmPayment)
adminRoutes.GET("/system-configs", requirePerm("system_config:view"), systemConfigHandler.List)
adminRoutes.PUT("/system-configs/:key", requirePerm("system_config:update"), systemConfigHandler.Update)
adminRoutes.GET("/audit-logs", requirePerm("audit_log:view"), adminAuditHandler.List)