增加支付功能

This commit is contained in:
2026-09-15 12:46:29 +08:00
parent 943c3708b0
commit a82b300b1a
46 changed files with 11675 additions and 21 deletions
+42
View File
@@ -0,0 +1,42 @@
package platform
import (
"server/controllers"
beego "github.com/beego/beego/v2/server/web"
)
// RegisterPaymentRoutes 注册平台端支付模块路由(表结构见 docs/sql/create_platform_payment.sql)。
// 注意:/reconcile/handle/:id、/commission/markPaid/:id 刻意避开与静态段同级,
// 避免 beego 路由树中通配段与静态段混用带来的匹配歧义。
func RegisterPaymentRoutes() {
// 渠道配置
beego.Router("/platform/payment/channels", &controllers.PlatformPaymentController{}, "get:ListChannels")
beego.Router("/platform/payment/channels/:channel", &controllers.PlatformPaymentController{}, "get:GetChannel;post:SaveChannel")
beego.Router("/platform/payment/channels/:channel/test", &controllers.PlatformPaymentController{}, "post:TestChannel")
beego.Router("/platform/payment/channels/:channel/status", &controllers.PlatformPaymentController{}, "post:ToggleChannel")
beego.Router("/platform/payment/channels/:channel/certificate", &controllers.PlatformPaymentController{}, "post:UploadCertificate")
// 支付订单
beego.Router("/platform/payment/orders", &controllers.PlatformPaymentController{}, "get:ListOrders")
beego.Router("/platform/payment/orders/:payNo", &controllers.PlatformPaymentController{}, "get:OrderDetail")
beego.Router("/platform/payment/orders/:payNo/query", &controllers.PlatformPaymentController{}, "post:QueryOrder")
beego.Router("/platform/payment/refund", &controllers.PlatformPaymentController{}, "post:Refund")
// 对账
beego.Router("/platform/payment/reconcile", &controllers.PlatformPaymentReconcileController{}, "get:ListReconcile")
beego.Router("/platform/payment/reconcile/run", &controllers.PlatformPaymentReconcileController{}, "post:RunReconcile")
beego.Router("/platform/payment/reconcile/import", &controllers.PlatformPaymentReconcileController{}, "post:ImportBill")
beego.Router("/platform/payment/reconcile/handle/:id", &controllers.PlatformPaymentReconcileController{}, "post:HandleReconcile")
// 渠道异步通知(渠道服务器调用,无平台鉴权;鉴权由各渠道适配器验签完成)
beego.Router("/api/payment/callback/:channel", &controllers.PlatformPaymentController{}, "post:Notify")
// 推广佣金
beego.Router("/platform/commission/list", &controllers.PlatformCommissionController{}, "get:List")
beego.Router("/platform/commission/stats", &controllers.PlatformCommissionController{}, "get:Stats")
beego.Router("/platform/commission/markPaid/:id", &controllers.PlatformCommissionController{}, "post:MarkPaid")
beego.Router("/platform/commission/rules", &controllers.PlatformCommissionController{}, "get:RulesList;post:RuleCreate")
beego.Router("/platform/commission/rules/:id", &controllers.PlatformCommissionController{}, "post:RuleUpdate;delete:RuleDelete")
beego.Router("/platform/commission/rules/:id/status", &controllers.PlatformCommissionController{}, "post:RuleToggle")
}
+3
View File
@@ -8,6 +8,9 @@ import (
// Register 注册平台端路由
func Register() {
// 支付模块(渠道配置 / 支付订单 / 对账 / 佣金 / 渠道回调)
RegisterPaymentRoutes()
// 平台登录相关
beego.Router("/platform/login", &controllers.PlatformAuthController{}, "post:LoginPlatform")
beego.Router("/platform/currentUser", &controllers.PlatformAuthController{}, "get:GetCurrentUser")