feat(payment): 支付&付费菜单按参考主题重构并新增提现策略页
- 子菜单重组为知识付费/余额充值/VIP会员/创作分成/推广返佣/收款接口/提现策略 - 收款接口页 1:1 复刻 Zibll 双下拉结构,仅保留支付宝/微信/PayPal/Stripe/易支付 - 订单前缀/流水号前缀/提现单号前缀配置保留并移入收款接口页 - 知识付费/推广返佣按参考主题全字段复刻,余额充值并入充值卡配置 - 新增 tabbed/between_number/page_select 表单控件及后端 pages 搜索源 - 清理旧 SPA 组件、无消费者 REST 端点与废弃配置键(不写双路兼容) - 更新存量契约测试至新 schema 文件
This commit is contained in:
+44
-3
@@ -45,7 +45,7 @@ class Gateway {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用网关列表(已配置的)
|
||||
* 获取可用网关列表(已配置的),按「收款接口显示顺序」配置排序。
|
||||
*/
|
||||
public function get_available(): array {
|
||||
$available = [];
|
||||
@@ -54,7 +54,48 @@ class Gateway {
|
||||
$available[$id] = $gateway;
|
||||
}
|
||||
}
|
||||
return $available;
|
||||
return $this->apply_sdk_order($available);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 pay_sdk_order(收款接口显示顺序)重排可用网关。
|
||||
* 易支付子通道跟随对应渠道槽位(epay_wxpay 跟随 wechat、epay_alipay 跟随 alipay);
|
||||
* 未配置顺序时保持注册顺序,未纳入槽位的扩展网关保持在末尾。
|
||||
*
|
||||
* @param array<string,GatewayInterface> $available
|
||||
* @return array<string,GatewayInterface>
|
||||
*/
|
||||
private function apply_sdk_order(array $available): array {
|
||||
$settings = \AKSRT\Settings\Settings::get_all();
|
||||
$configured = (array) ($settings['pay_sdk_order'] ?? []);
|
||||
$order = array_values(array_filter(array_map('sanitize_key', array_keys($configured))));
|
||||
if (!$order) {
|
||||
return $available;
|
||||
}
|
||||
|
||||
$slot_map = [
|
||||
'wechat' => ['wechatpay', 'epay_wxpay'],
|
||||
'alipay' => ['alipay', 'epay_alipay'],
|
||||
'paypal' => ['paypal'],
|
||||
'stripe' => ['stripe'],
|
||||
'balance' => ['balance'],
|
||||
'card_pass' => ['card_pass'],
|
||||
];
|
||||
|
||||
$sorted = [];
|
||||
foreach ($order as $slot) {
|
||||
foreach (($slot_map[$slot] ?? []) as $id) {
|
||||
if (isset($available[$id]) && !isset($sorted[$id])) {
|
||||
$sorted[$id] = $available[$id];
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($available as $id => $gateway) {
|
||||
if (!isset($sorted[$id])) {
|
||||
$sorted[$id] = $gateway;
|
||||
}
|
||||
}
|
||||
return $sorted;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,7 +352,7 @@ class Gateway {
|
||||
}
|
||||
|
||||
$gateway_id = sanitize_key((string) ($order['payment_method'] ?? ''));
|
||||
if ($gateway_id === '' || in_array($gateway_id, ['balance', 'points', 'manual_review'], true)) {
|
||||
if ($gateway_id === '' || in_array($gateway_id, ['balance', 'points'], true)) {
|
||||
return null;
|
||||
}
|
||||
$gateway = $this->get_gateway($gateway_id);
|
||||
|
||||
Reference in New Issue
Block a user