优化结构

This commit is contained in:
Yvan
2026-08-20 21:46:52 +08:00
parent 23bc29ce0f
commit 63dbb4cfbc
78 changed files with 767 additions and 1082 deletions
+13 -13
View File
@@ -1,31 +1,31 @@
package payment
import (
"kra/internal/data/system"
"kra/internal/adminsurface"
"kra/internal/data/migration"
"gorm.io/gorm"
)
// Migrate creates the persistence owned by the payment module.
func Migrate(db *gorm.DB) error {
return db.AutoMigrate(&integrationConfigPO{}, &paymentOrderPO{})
}
// Reconcile seeds disabled configuration rows for all built-in providers.
func Reconcile(db *gorm.DB) error {
return ensurePaymentIntegrationConfigs(db)
func Migrations() []migration.Step {
return []migration.Step{
{ID: "202608200003_payment_schema", Migrate: func(db *gorm.DB) error {
return db.AutoMigrate(&paymentOrderPO{})
}},
{ID: "202608200004_payment_defaults", Migrate: ensurePaymentIntegrationConfigs},
}
}
// AdminSurface describes the payment-owned entries shown in the system
// administration UI. The system module persists these records because it owns
// the menu/API/policy tables.
func AdminSurface() system.AdminSurface {
return system.AdminSurface{
Menus: []system.AdminMenu{
func AdminSurface() adminsurface.Surface {
return adminsurface.Surface{
Menus: []adminsurface.Menu{
{Name: "paymentOrders", Path: "paymentOrders", ParentName: "extensions", Component: "view/systemTools/payment/orders.vue", Title: "支付订单", Icon: "wallet", Sort: 6},
{Name: "paymentConfig", Path: "paymentConfig", ParentName: "extensions", Component: "view/systemTools/payment/config.vue", Title: "支付配置", Icon: "credit-card", Sort: 7},
},
APIs: []system.AdminAPI{
APIs: []adminsurface.API{
{Path: "/payment/configs", Method: "GET", APIGroup: "支付", Description: "获取支付渠道配置"},
{Path: "/payment/config", Method: "POST", APIGroup: "支付", Description: "保存支付渠道配置"},
{Path: "/payment/orders", Method: "GET", APIGroup: "支付", Description: "分页查询支付订单"},