34 lines
947 B
Go
34 lines
947 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
)
|
|
|
|
// initServices 初始化服务
|
|
func initServices() error {
|
|
// 服务自动初始化,无需手动调用
|
|
return nil
|
|
}
|
|
|
|
// 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(context.Background(), "路由初始化完成")
|
|
}
|