优化结构
This commit is contained in:
@@ -3,7 +3,10 @@
|
||||
package payment
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
datapayment "kra/internal/data/payment"
|
||||
"kra/internal/routecatalog"
|
||||
"kra/pkg/module"
|
||||
)
|
||||
|
||||
@@ -17,18 +20,18 @@ func Definition() module.Definition {
|
||||
{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: []module.API{
|
||||
{Path: "/payment/orders", Method: "GET", Group: "支付", Description: "分页查询支付订单"},
|
||||
{Path: "/payment/order", Method: "POST", Group: "支付", Description: "查询支付订单"},
|
||||
{Path: "/payment/orders/:provider/:tradeNo", Method: "GET", Group: "支付", Description: "按路径查询支付订单"},
|
||||
{Path: "/payment/create", Method: "POST", Group: "支付", Description: "创建支付订单"},
|
||||
{Path: "/payment/query", Method: "POST", Group: "支付", Description: "同步支付订单状态"},
|
||||
{Path: "/payment/refund", Method: "POST", Group: "支付", Description: "申请支付订单退款"},
|
||||
{Path: "/payment/orders/:provider/:tradeNo/refund", Method: "POST", Group: "支付", Description: "按路径申请支付订单退款"},
|
||||
{Path: "/payment/fulfill", Method: "POST", Group: "支付", Description: "重试支付订单发货"},
|
||||
{Path: "/payment/orders/:provider/:tradeNo/fulfill", Method: "POST", Group: "支付", Description: "按路径重试支付订单发货"},
|
||||
{Path: "/payment/providers/:provider/test", Method: "POST", Group: "支付", Description: "测试支付渠道"},
|
||||
},
|
||||
APIs: paymentAPIs(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func paymentAPIs() []module.API {
|
||||
items := make([]module.API, 0, 10)
|
||||
for _, descriptor := range routecatalog.Descriptors() {
|
||||
if descriptor.Public || !strings.HasPrefix(descriptor.Path, "/payment") || descriptor.Description == "" {
|
||||
continue
|
||||
}
|
||||
items = append(items, module.API{Path: descriptor.Path, Method: descriptor.Method, Group: descriptor.Group, Description: descriptor.Description})
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
datasystem "kra/internal/data/repository"
|
||||
"kra/internal/routecatalog"
|
||||
"kra/pkg/module"
|
||||
)
|
||||
|
||||
@@ -12,13 +15,7 @@ import (
|
||||
func Definition() module.Definition {
|
||||
communication := module.Surface{
|
||||
Menus: []module.Menu{{Name: "integrationConfig", Path: "integrationConfig", ParentName: "extensions", Component: "view/systemTools/integration/config.vue", Title: "通信集成", Icon: "connection", Sort: 8}},
|
||||
APIs: []module.API{
|
||||
{Path: "/integration/configs/:kind", Method: "GET", Group: "集成配置", Description: "按类型获取集成配置"},
|
||||
{Path: "/integration/configs/:kind/:provider", Method: "GET", Group: "集成配置", Description: "获取指定集成配置"},
|
||||
{Path: "/integration/configs/:kind/:provider", Method: "PUT", Group: "集成配置", Description: "保存集成配置"},
|
||||
{Path: "/integration/configs/:kind/:provider/test", Method: "POST", Group: "集成配置", Description: "测试通信集成连接"},
|
||||
{Path: "/integration/configs/:kind/:provider", Method: "DELETE", Group: "集成配置", Description: "删除集成配置"},
|
||||
},
|
||||
APIs: integrationAPIs(),
|
||||
}
|
||||
return module.Definition{
|
||||
Name: "system",
|
||||
@@ -30,3 +27,14 @@ func Definition() module.Definition {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func integrationAPIs() []module.API {
|
||||
items := make([]module.API, 0, 5)
|
||||
for _, descriptor := range routecatalog.Descriptors() {
|
||||
if descriptor.Public || !strings.HasPrefix(descriptor.Path, "/integration/configs") || descriptor.Description == "" {
|
||||
continue
|
||||
}
|
||||
items = append(items, module.API{Path: descriptor.Path, Method: descriptor.Method, Group: descriptor.Group, Description: descriptor.Description})
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user