新增摸大红业务并修复后台链接按钮白字

支持分类筛选、搜索、下单支付建群与固定二维码;合并迁移种子数据;后台表格编辑/详情链接恢复主题色可见。
This commit is contained in:
yml2213
2026-07-16 18:08:18 +08:00
parent 97a34e0329
commit 6d61027318
49 changed files with 9533 additions and 20 deletions
+55 -1
View File
@@ -24,6 +24,7 @@ import (
"hfb_sys/backend/internal/modules/dispute"
filemodule "hfb_sys/backend/internal/modules/file"
"hfb_sys/backend/internal/modules/listing"
"hfb_sys/backend/internal/modules/mohong"
"hfb_sys/backend/internal/modules/notification"
"hfb_sys/backend/internal/modules/order"
"hfb_sys/backend/internal/modules/payment"
@@ -254,8 +255,21 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
paymentConfigHandler = paymentconfig.NewHandler(paymentConfigService)
}
var mohongRepo *mohong.Repository
var mohongService *mohong.Service
var mohongHandler *mohong.Handler
if deps.DB != nil {
paymentRepo = payment.NewRepository(deps.DB, paymentConfigRepo, orderRepo, payment.WithLogger(logger))
mohongRepo = mohong.NewRepository(deps.DB, chatRepo)
mohongService = mohong.NewService(mohongRepo)
mohongHandler = mohong.NewHandler(mohongService)
}
if deps.DB != nil {
paymentOpts := []payment.RepositoryOption{payment.WithLogger(logger)}
if mohongRepo != nil {
paymentOpts = append(paymentOpts, payment.WithMohongRepo(mohongRepo))
}
paymentRepo = payment.NewRepository(deps.DB, paymentConfigRepo, orderRepo, paymentOpts...)
}
paymentService := payment.NewService(paymentRepo)
paymentHandler := payment.NewHandler(paymentService, payment.WithHandlerLogger(logger))
@@ -414,6 +428,25 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
sellerPickupRoutes.GET("", pickupHandler.ListForSeller)
}
// 摸大红:商品公开,下单需登录+实名
if mohongHandler != nil {
mohongPublic := api.Group("/mohong")
{
mohongPublic.GET("/categories", mohongHandler.ListCategories)
mohongPublic.GET("/products", mohongHandler.ListProducts)
mohongPublic.GET("/products/:id", mohongHandler.GetProduct)
}
mohongAuth := api.Group("/mohong", requireAuth)
{
mohongAuth.POST("/orders", requireRealname, mohongHandler.CreateOrder)
mohongAuth.GET("/orders", mohongHandler.ListMyOrders)
mohongAuth.GET("/orders/:id", mohongHandler.GetMyOrder)
mohongAuth.POST("/orders/:id/cancel", mohongHandler.CancelMyOrder)
mohongAuth.POST("/orders/:id/start-payment", requireRealname, paymentHandler.StartMohong)
mohongAuth.GET("/orders/:id/query-payment", paymentHandler.QueryMohong)
}
}
orderRoutes := api.Group("/orders", requireAuth)
{
orderRoutes.POST("", requireRealname, orderHandler.Create)
@@ -565,6 +598,27 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
adminRoutes.POST("/listings/:id/reject", requirePerm("listing:reject"), listingHandler.Reject)
adminRoutes.POST("/listings/:id/offline", requirePerm("listing:offline"), listingHandler.AdminOffline)
adminRoutes.POST("/listings/:id/mark-abnormal", requirePerm("listing:offline"), listingHandler.AdminMarkAbnormal)
// 摸大红
if mohongHandler != nil {
// 商品编辑需要拉分类列表,故 GET 用 product_view
adminRoutes.GET("/mohong/categories", requirePerm("mohong:product_view"), mohongHandler.AdminListCategories)
adminRoutes.POST("/mohong/categories", requirePerm("mohong:category"), mohongHandler.AdminCreateCategory)
adminRoutes.PUT("/mohong/categories/:id", requirePerm("mohong:category"), mohongHandler.AdminUpdateCategory)
adminRoutes.DELETE("/mohong/categories/:id", requirePerm("mohong:category"), mohongHandler.AdminDeleteCategory)
adminRoutes.GET("/mohong/products", requirePerm("mohong:product_view"), mohongHandler.AdminListProducts)
adminRoutes.GET("/mohong/products/:id", requirePerm("mohong:product_view"), mohongHandler.AdminGetProduct)
adminRoutes.POST("/mohong/products", requirePerm("mohong:product_manage"), mohongHandler.AdminCreateProduct)
adminRoutes.PUT("/mohong/products/:id", requirePerm("mohong:product_manage"), mohongHandler.AdminUpdateProduct)
adminRoutes.DELETE("/mohong/products/:id", requirePerm("mohong:product_manage"), mohongHandler.AdminDeleteProduct)
adminRoutes.GET("/mohong/orders", requirePerm("mohong:order_view"), mohongHandler.AdminListOrders)
adminRoutes.GET("/mohong/orders/:id", requirePerm("mohong:order_view"), mohongHandler.AdminGetOrder)
adminRoutes.POST("/mohong/orders/:id/complete", requirePerm("mohong:order_manage"), mohongHandler.AdminCompleteOrder)
adminRoutes.POST("/mohong/orders/:id/cancel", requirePerm("mohong:order_manage"), mohongHandler.AdminCancelOrder)
adminRoutes.GET("/mohong/config", requirePerm("mohong:config"), mohongHandler.AdminGetConfig)
adminRoutes.PUT("/mohong/config", requirePerm("mohong:config"), mohongHandler.AdminUpdateConfig)
}
adminRoutes.GET("/disputes", requirePerm("dispute:view"), disputeHandler.AdminList)
adminRoutes.POST("/disputes/:id/arbitrate", requirePerm("dispute:arbitrate"), disputeHandler.AdminArbitrate)
adminRoutes.GET("/finance/dashboard", requirePerm("wallet:view"), adminFinanceHandler.Dashboard)