初始化项目
This commit is contained in:
32
init.go
Normal file
32
init.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"order/service"
|
||||
)
|
||||
|
||||
// initServices 初始化服务
|
||||
func initServices() error {
|
||||
return service.InitServices()
|
||||
}
|
||||
|
||||
// initRoutes 初始化路由
|
||||
func initRoutes() {
|
||||
s := g.Server()
|
||||
|
||||
// 订单相关路由
|
||||
orderGroup := s.Group("/api/order")
|
||||
orderGroup.POST("/create", "order.controller.Order.Create")
|
||||
orderGroup.POST("/pay", "order.controller.Order.Pay")
|
||||
orderGroup.GET("/query", "order.controller.Order.Query")
|
||||
orderGroup.POST("/cancel", "order.controller.Order.Cancel")
|
||||
orderGroup.POST("/refund", "order.controller.Order.Refund")
|
||||
orderGroup.GET("/list", "order.controller.Order.List")
|
||||
|
||||
// 支付回调路由
|
||||
paymentGroup := s.Group("/api/payment")
|
||||
paymentGroup.POST("/notify", "order.controller.Order.PaymentNotify")
|
||||
paymentGroup.POST("/refund-notify", "order.controller.Order.RefundNotify")
|
||||
|
||||
g.Log().Info(g.Request().GetCtx(), "路由初始化完成")
|
||||
}
|
||||
Reference in New Issue
Block a user