All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m52s
81 lines
2.5 KiB
Go
81 lines
2.5 KiB
Go
package routes
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
|
"github.com/break/junhong_cmp_fiber/internal/handler/callback"
|
|
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
|
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
|
)
|
|
|
|
// registerAdminOrderRoutes 注册后台订单路由
|
|
func registerAdminOrderRoutes(router fiber.Router, handler *admin.OrderHandler, doc *openapi.Generator, basePath string) {
|
|
Register(router, doc, basePath, "POST", "/orders", handler.Create, RouteSpec{
|
|
Summary: "创建订单",
|
|
Tags: []string{"订单管理"},
|
|
Input: new(dto.CreateAdminOrderRequest),
|
|
Output: new(dto.OrderResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(router, doc, basePath, "GET", "/orders", handler.List, RouteSpec{
|
|
Summary: "获取订单列表",
|
|
Tags: []string{"订单管理"},
|
|
Input: new(dto.OrderListRequest),
|
|
Output: new(dto.OrderListResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(router, doc, basePath, "GET", "/orders/:id", handler.Get, RouteSpec{
|
|
Summary: "获取订单详情",
|
|
Tags: []string{"订单管理"},
|
|
Input: new(dto.GetOrderRequest),
|
|
Output: new(dto.OrderResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(router, doc, basePath, "POST", "/orders/:id/cancel", handler.Cancel, RouteSpec{
|
|
Summary: "取消订单",
|
|
Tags: []string{"订单管理"},
|
|
Input: new(dto.CancelOrderRequest),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
|
|
Register(router, doc, basePath, "POST", "/orders/purchase-check", handler.PurchaseCheck, RouteSpec{
|
|
Summary: "套餐购买预检",
|
|
Tags: []string{"订单管理"},
|
|
Input: new(dto.PurchaseCheckRequest),
|
|
Output: new(dto.PurchaseCheckResponse),
|
|
Auth: true,
|
|
})
|
|
}
|
|
|
|
// registerPaymentCallbackRoutes 注册支付回调路由
|
|
func registerPaymentCallbackRoutes(router fiber.Router, handler *callback.PaymentHandler, doc *openapi.Generator, basePath string) {
|
|
Register(router, doc, basePath, "POST", "/wechat-pay", handler.WechatPayCallback, RouteSpec{
|
|
Summary: "微信支付回调",
|
|
Tags: []string{"支付回调"},
|
|
Input: nil,
|
|
Output: nil,
|
|
Auth: false,
|
|
})
|
|
|
|
Register(router, doc, basePath, "POST", "/alipay", handler.AlipayCallback, RouteSpec{
|
|
Summary: "支付宝回调",
|
|
Tags: []string{"支付回调"},
|
|
Input: nil,
|
|
Output: nil,
|
|
Auth: false,
|
|
})
|
|
|
|
Register(router, doc, basePath, "POST", "/fuiou-pay", handler.FuiouPayCallback, RouteSpec{
|
|
Summary: "富友支付回调",
|
|
Tags: []string{"支付回调"},
|
|
Input: nil,
|
|
Output: nil,
|
|
Auth: false,
|
|
})
|
|
}
|