57 lines
2.1 KiB
Go
57 lines
2.1 KiB
Go
package routes
|
|
|
|
import (
|
|
"PaymentCenter/app/http/controllers"
|
|
"PaymentCenter/app/http/controllers/backend"
|
|
"PaymentCenter/app/http/middlewares"
|
|
"PaymentCenter/app/http/trace"
|
|
"PaymentCenter/app/utils"
|
|
"PaymentCenter/config"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/qit-team/snow-core/http/middleware"
|
|
)
|
|
|
|
func RegisterAdminRoute(router *gin.Engine) {
|
|
router.Use(middlewares.ServerRecovery(), middleware.GenRequestId, middleware.GenContextKit, middleware.AccessLog())
|
|
router.NoRoute(controllers.Error404)
|
|
if len(config.GetConf().SkyWalkingOapServer) > 0 && config.IsEnvEqual(config.ProdEnv) {
|
|
err := trace.InitTracer(config.GetConf().ServiceName, config.GetConf().SkyWalkingOapServer)
|
|
if err != nil {
|
|
utils.Log(nil, "InitTracer", err.Error())
|
|
} else {
|
|
router.Use(middlewares.Trace())
|
|
}
|
|
}
|
|
|
|
v1 := router.Group("/admin/pay/api/v1", middlewares.ValidateRequest())
|
|
{
|
|
// 商户管理
|
|
merchant := v1.Group("/merchant")
|
|
merchant.GET("/list", backend.MerchantList) // 商户列表
|
|
merchant.POST("/create", backend.MerchantCreate) // 商户创建
|
|
merchant.PUT("/update", backend.MerchantUpdate) // 商户更新
|
|
merchant.DELETE("/delete", backend.MerchantDelete) // 商户删除
|
|
// 支付方式
|
|
pay := v1.Group("/paychannel")
|
|
pay.GET("/list", backend.PayChannelList) // 支付方式列表
|
|
pay.POST("/create", backend.PayChannelCreate) // 支付方式创建
|
|
pay.PUT("/update", backend.PayChannelUpdate) // 支付方式更新
|
|
pay.DELETE("/delete", backend.PayChannelDelete) // 支付方式删除
|
|
|
|
// 应用管理
|
|
app := v1.Group("/app")
|
|
app.GET("/list", backend.AppList) // 应用列表
|
|
app.POST("/create", backend.AppCreate) // 应用创建
|
|
app.PUT("/update", backend.AppUpdate) // 应用更新
|
|
app.DELETE("/delete", backend.AppDelete) // 应用删除
|
|
app.GET("/decrypt", backend.GenerateDecrypt) // 生成密钥对
|
|
|
|
// 订单
|
|
order := v1.Group("/order")
|
|
order.GET("/list", backend.OrderList) // 订单列表
|
|
order.GET("/log/list", backend.OrderLogsList) // 订单日志列表
|
|
|
|
}
|
|
|
|
}
|