From 6a7bcc8bf752075cfceb2761da3ed091304b068d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Jul 2026 23:46:41 +0800 Subject: [PATCH] =?UTF-8?q?Schema=20=E6=94=B6=E5=8F=A3=E7=AC=AC=E5=9B=9B?= =?UTF-8?q?=E8=BD=AE=EF=BC=9A=E8=A1=A5=E9=BD=90=20payment=20gateway=20?= =?UTF-8?q?=E7=9A=84=20PHP=20=E4=BE=9D=E8=B5=96=E5=A5=91=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 继续 Workstream C,对 payment.gateway 做 PHP schema 收口: - 为 wechat / alipay / paypal 三组网关配置补齐 dependsOn,确保 provider 配置只在对应 payment_*_enabled 开启后展开。 - 延续前几轮的目标:让 PHP schema 与前端 schema 一样,真正承担“总开关 -> 子配置”的 单一真理源角色,而不是仅前端层面做折叠展示。 说明:本轮原计划同时继续推进 page_display,但审阅后发现 page_display 的剩余问题以 结构性差异(缺少真正的 home 主 section、float-btn 在前端 schema 层未建模完整)为主, 不适合和本轮 payment gateway 的机械对齐混在一个提交里,因此先独立完成 gateway 收口。 验证: - php -l 通过:class-aksrt-admin-schema-payment.php - node --check 已复核 payment/post-list 前几轮前端 schema 文件仍通过 Co-Authored-By: Claude Fable 5 --- .../class-aksrt-admin-schema-payment.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/inc/classes/admin/schema/class-aksrt-admin-schema-payment.php b/inc/classes/admin/schema/class-aksrt-admin-schema-payment.php index 7e5f4498..9fbd9818 100644 --- a/inc/classes/admin/schema/class-aksrt-admin-schema-payment.php +++ b/inc/classes/admin/schema/class-aksrt-admin-schema-payment.php @@ -228,24 +228,24 @@ class AKSRT_Admin_Schema_Payment { ['key' => 'payment_stripe_enabled', 'label' => 'Stripe', 'type' => 'switch', 'default' => false], ]], ['key' => 'wechat', 'title' => '微信支付配置', 'fields' => [ - ['key' => 'wechat_merchantid', 'label' => '商户号', 'type' => 'input', 'default' => ''], - ['key' => 'wechat_jsapi', 'label' => 'JSAPI密钥', 'type' => 'input', 'default' => ''], - ['key' => 'wechat_appsecret', 'label' => 'AppSecret', 'type' => 'input', 'default' => ''], - ['key' => 'wechat_cert_path', 'label' => '证书路径', 'type' => 'input', 'default' => ''], - ['key' => 'wechat_key_path', 'label' => '密钥路径', 'type' => 'input', 'default' => ''], + ['key' => 'wechat_merchantid', 'label' => '商户号', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]], + ['key' => 'wechat_jsapi', 'label' => 'JSAPI密钥', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]], + ['key' => 'wechat_appsecret', 'label' => 'AppSecret', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]], + ['key' => 'wechat_cert_path', 'label' => '证书路径', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]], + ['key' => 'wechat_key_path', 'label' => '密钥路径', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_wechat_enabled', 'value' => true]], ]], ['key' => 'alipay', 'title' => '支付宝配置', 'fields' => [ - ['key' => 'alipay_appid', 'label' => 'AppID', 'type' => 'input', 'default' => ''], - ['key' => 'alipay_privatekey', 'label' => '应用私钥', 'type' => 'input', 'default' => ''], - ['key' => 'alipay_publickey', 'label' => '支付宝公钥', 'type' => 'input', 'default' => ''], - ['key' => 'alipay_return_url', 'label' => '同步回调地址', 'type' => 'input', 'default' => ''], - ['key' => 'alipay_notify_url', 'label' => '异步回调地址', 'type' => 'input', 'default' => ''], + ['key' => 'alipay_appid', 'label' => 'AppID', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]], + ['key' => 'alipay_privatekey', 'label' => '应用私钥', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]], + ['key' => 'alipay_publickey', 'label' => '支付宝公钥', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]], + ['key' => 'alipay_return_url', 'label' => '同步回调地址', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]], + ['key' => 'alipay_notify_url', 'label' => '异步回调地址', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_alipay_enabled', 'value' => true]], ]], ['key' => 'paypal', 'title' => 'PayPal配置', 'fields' => [ - ['key' => 'paypal_client_id', 'label' => 'Client ID', 'type' => 'input', 'default' => ''], - ['key' => 'paypal_client_secret', 'label' => 'Client Secret', 'type' => 'input', 'default' => ''], - ['key' => 'paypal_currency', 'label' => '货币', 'type' => 'input', 'default' => 'USD'], - ['key' => 'paypal_sandbox', 'label' => '沙箱模式', 'type' => 'switch', 'default' => true], + ['key' => 'paypal_client_id', 'label' => 'Client ID', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]], + ['key' => 'paypal_client_secret', 'label' => 'Client Secret', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]], + ['key' => 'paypal_currency', 'label' => '货币', 'type' => 'input', 'default' => 'USD', 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]], + ['key' => 'paypal_sandbox', 'label' => '沙箱模式', 'type' => 'switch', 'default' => true, 'dependsOn' => ['key' => 'payment_paypal_enabled', 'value' => true]], ]], ['key' => 'xunhupay', 'title' => '虎皮椒配置', 'fields' => [ ['key' => 'xunhupay_appid', 'label' => 'AppID', 'type' => 'input', 'default' => ''],