新增订单群聊

This commit is contained in:
yml
2026-05-25 14:57:19 +08:00
parent 1a3886f8d1
commit 7e7e6dc166
18 changed files with 2152 additions and 225 deletions
+22
View File
@@ -9,6 +9,7 @@ import (
"hfb_sys/backend/internal/modules/admindashboard"
"hfb_sys/backend/internal/modules/adminuser"
"hfb_sys/backend/internal/modules/auth"
"hfb_sys/backend/internal/modules/chat"
"hfb_sys/backend/internal/modules/dispute"
filemodule "hfb_sys/backend/internal/modules/file"
"hfb_sys/backend/internal/modules/listing"
@@ -95,6 +96,12 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
}
notificationService := notification.NewService(notificationRepo)
notificationHandler := notification.NewHandler(notificationService)
var chatRepo *chat.Repository
if deps.DB != nil {
chatRepo = chat.NewRepository(deps.DB)
}
chatService := chat.NewService(chatRepo)
chatHandler := chat.NewHandler(chatService)
var disputeRepo *dispute.Repository
if deps.DB != nil {
disputeRepo = dispute.NewRepository(deps.DB)
@@ -166,6 +173,7 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
orderRoutes.POST("", orderHandler.Create)
orderRoutes.GET("", orderHandler.List)
orderRoutes.GET("/:id", orderHandler.Detail)
orderRoutes.GET("/:id/chat", chatHandler.OrderConversation)
orderRoutes.POST("/:id/pay", orderHandler.Pay)
orderRoutes.POST("/:id/cancel", orderHandler.Cancel)
orderRoutes.POST("/:id/handoff", orderHandler.SubmitHandoff)
@@ -205,6 +213,15 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
notificationRoutes.POST("/:id/read", notificationHandler.MarkRead)
}
chatRoutes := api.Group("/chats", requireAuth)
{
chatRoutes.GET("", chatHandler.List)
chatRoutes.GET("/:id", chatHandler.Detail)
chatRoutes.GET("/:id/messages", chatHandler.Messages)
chatRoutes.POST("/:id/messages", chatHandler.Send)
chatRoutes.POST("/:id/read", chatHandler.MarkRead)
}
realnameRoutes := api.Group("/realname", requireAuth)
{
realnameRoutes.POST("/start", realnameHandler.Start)
@@ -246,6 +263,11 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
adminRoutes.GET("/system-configs", systemConfigHandler.List)
adminRoutes.PUT("/system-configs/:key", systemConfigHandler.Update)
adminRoutes.GET("/audit-logs", adminAuditHandler.List)
adminRoutes.GET("/chats", chatHandler.AdminList)
adminRoutes.GET("/chats/:id", chatHandler.AdminDetail)
adminRoutes.GET("/chats/:id/messages", chatHandler.AdminMessages)
adminRoutes.POST("/chats/:id/messages", chatHandler.AdminSend)
adminRoutes.POST("/chats/:id/read", chatHandler.AdminMarkRead)
}
}