开始增加支付-1

This commit is contained in:
yml
2026-06-03 12:21:23 +08:00
parent 6dcea2d56c
commit ae8928f458
22 changed files with 2098 additions and 33 deletions
+12 -1
View File
@@ -21,6 +21,7 @@ import (
"hfb_sys/backend/internal/modules/listing"
"hfb_sys/backend/internal/modules/notification"
"hfb_sys/backend/internal/modules/order"
"hfb_sys/backend/internal/modules/payment"
"hfb_sys/backend/internal/modules/realname"
"hfb_sys/backend/internal/modules/systemconfig"
"hfb_sys/backend/internal/modules/user"
@@ -98,6 +99,12 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
}
walletService := wallet.NewService(walletRepo)
walletHandler := wallet.NewHandler(walletService)
var paymentRepo *payment.Repository
if deps.DB != nil {
paymentRepo = payment.NewRepository(deps.DB, cfg.Payment, orderRepo, walletRepo)
}
paymentService := payment.NewService(paymentRepo)
paymentHandler := payment.NewHandler(paymentService)
var notificationRepo *notification.Repository
if deps.DB != nil {
notificationRepo = notification.NewRepository(deps.DB)
@@ -172,6 +179,7 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
api.GET("/home-announcements", systemConfigHandler.HomeAnnouncements)
api.GET("/mobile-home-config", systemConfigHandler.HomeConfig)
api.GET("/public/files/object", fileHandler.PublicObject)
api.POST("/payments/leshua/notify", paymentHandler.LeshuaNotify)
openRoutes := api.Group("/open")
{
@@ -214,7 +222,8 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
orderRoutes.GET("", orderHandler.List)
orderRoutes.GET("/:id", orderHandler.Detail)
orderRoutes.GET("/:id/chat", chatHandler.OrderConversation)
orderRoutes.POST("/:id/pay", orderHandler.Pay)
orderRoutes.POST("/:id/pay", paymentHandler.Start)
orderRoutes.POST("/:id/pay/query", paymentHandler.Query)
orderRoutes.POST("/:id/cancel", orderHandler.Cancel)
orderRoutes.POST("/:id/handoff", orderHandler.SubmitHandoff)
orderRoutes.GET("/:id/handoff-records", orderHandler.HandoffRecords)
@@ -239,6 +248,8 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
walletRoutes.GET("/balance", walletHandler.Balance)
walletRoutes.GET("/ledger", walletHandler.Ledger)
walletRoutes.POST("/recharge", walletHandler.Recharge)
walletRoutes.POST("/recharge/pay", paymentHandler.WalletRecharge)
walletRoutes.POST("/recharge/pay/:id/query", paymentHandler.WalletRechargeQuery)
}
fileRoutes := api.Group("/files", requireAuth)