业务更名为撞车并切换crash路由

用户可见文案与页面/API路径改为撞车与crash,保留mohong表与权限码兼容;移动端入口去掉租/撞图标。
This commit is contained in:
yml2213
2026-07-16 21:19:35 +08:00
parent 8b637cf499
commit a4189db4ca
38 changed files with 232 additions and 179 deletions
+37 -30
View File
@@ -428,23 +428,26 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
sellerPickupRoutes.GET("", pickupHandler.ListForSeller)
}
// 摸大红:商品公开,下单需登录+实名
// 撞车(对外路径 /crash;兼容旧路径 /mohong:商品公开,下单需登录+实名
if mohongHandler != nil {
mohongPublic := api.Group("/mohong")
{
mohongPublic.GET("/categories", mohongHandler.ListCategories)
mohongPublic.GET("/products", mohongHandler.ListProducts)
mohongPublic.GET("/products/:id", mohongHandler.GetProduct)
registerCrashPublic := func(g *gin.RouterGroup) {
g.GET("/categories", mohongHandler.ListCategories)
g.GET("/products", mohongHandler.ListProducts)
g.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)
registerCrashAuth := func(g *gin.RouterGroup) {
g.POST("/orders", requireRealname, mohongHandler.CreateOrder)
g.GET("/orders", mohongHandler.ListMyOrders)
g.GET("/orders/:id", mohongHandler.GetMyOrder)
g.POST("/orders/:id/cancel", mohongHandler.CancelMyOrder)
g.POST("/orders/:id/start-payment", requireRealname, paymentHandler.StartMohong)
g.GET("/orders/:id/query-payment", paymentHandler.QueryMohong)
}
registerCrashPublic(api.Group("/crash"))
registerCrashAuth(api.Group("/crash", requireAuth))
// 兼容旧 API 前缀
registerCrashPublic(api.Group("/mohong"))
registerCrashAuth(api.Group("/mohong", requireAuth))
}
orderRoutes := api.Group("/orders", requireAuth)
@@ -599,24 +602,28 @@ func New(cfg config.Config, deps Dependencies, logger *zap.Logger) *gin.Engine {
adminRoutes.POST("/listings/:id/offline", requirePerm("listing:offline"), listingHandler.AdminOffline)
adminRoutes.POST("/listings/:id/mark-abnormal", requirePerm("listing:offline"), listingHandler.AdminMarkAbnormal)
// 摸大红
// 撞车后台(/admin/crash;兼容 /admin/mohong
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)
registerCrashAdmin := func(prefix string) {
adminRoutes.GET(prefix+"/categories", requirePerm("mohong:product_view"), mohongHandler.AdminListCategories)
adminRoutes.POST(prefix+"/categories", requirePerm("mohong:category"), mohongHandler.AdminCreateCategory)
adminRoutes.PUT(prefix+"/categories/:id", requirePerm("mohong:category"), mohongHandler.AdminUpdateCategory)
adminRoutes.DELETE(prefix+"/categories/:id", requirePerm("mohong:category"), mohongHandler.AdminDeleteCategory)
adminRoutes.GET(prefix+"/products", requirePerm("mohong:product_view"), mohongHandler.AdminListProducts)
adminRoutes.GET(prefix+"/products/:id", requirePerm("mohong:product_view"), mohongHandler.AdminGetProduct)
adminRoutes.POST(prefix+"/products", requirePerm("mohong:product_manage"), mohongHandler.AdminCreateProduct)
adminRoutes.PUT(prefix+"/products/:id", requirePerm("mohong:product_manage"), mohongHandler.AdminUpdateProduct)
adminRoutes.DELETE(prefix+"/products/:id", requirePerm("mohong:product_manage"), mohongHandler.AdminDeleteProduct)
adminRoutes.GET(prefix+"/orders", requirePerm("mohong:order_view"), mohongHandler.AdminListOrders)
adminRoutes.GET(prefix+"/orders/:id", requirePerm("mohong:order_view"), mohongHandler.AdminGetOrder)
adminRoutes.POST(prefix+"/orders/:id/complete", requirePerm("mohong:order_manage"), mohongHandler.AdminCompleteOrder)
adminRoutes.POST(prefix+"/orders/:id/cancel", requirePerm("mohong:order_manage"), mohongHandler.AdminCancelOrder)
adminRoutes.GET(prefix+"/config", requirePerm("mohong:config"), mohongHandler.AdminGetConfig)
adminRoutes.PUT(prefix+"/config", requirePerm("mohong:config"), mohongHandler.AdminUpdateConfig)
}
registerCrashAdmin("/crash")
registerCrashAdmin("/mohong")
}
adminRoutes.GET("/disputes", requirePerm("dispute:view"), disputeHandler.AdminList)