feat(admin): collapse provider/gateway groups by default, mask alipay private key, drop inline notice styles

- OAuth provider and payment gateway groups are collapsible and collapsed by default; remove dead expandWhen logic
- Textarea fields support secret masking; mark alipay_privatekey as secret in JS and PHP schemas
- Extract AksSecretClear shared by input and textarea secret fields
- Replace inline styles in payment/post-list notice HTML with aksrt-hint / aksrt-warn classes

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-10-28 15:50:37 +08:00
1 parent 3179754670
commit fa89f43ac9
18 files changed
+129 -94

No files matched your search

+13 -13
View File
@@ -33,7 +33,7 @@ class SchemaPayment {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'notice', 'title' => '说明', 'fields' => [
['key' => 'knowledge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>知识付费</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>知识付费功能主要分为文章付费、付费会员、余额系统、推广返佣、创作分成等功能组成,您可以根据您的需要开启对应功能</li><li>使用支付功能请先在「收款接口」页配置好收款通道</li></ul>'],
['key' => 'knowledge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>知识付费</b></p><ul><li>知识付费功能主要分为文章付费、付费会员、余额系统、推广返佣、创作分成等功能组成,您可以根据您的需要开启对应功能</li><li>使用支付功能请先在「收款接口」页配置好收款通道</li></ul>'],
]],
['key' => 'guest-buy', 'title' => '免登陆购买', 'fields' => [
['key' => 'pay_no_logged_in', 'label' => '免登陆购买', 'type' => 'switch', 'default' => true, 'help' => '开启后如果用户未登录则使用浏览器缓存验证是否购买'],
@@ -125,7 +125,7 @@ class SchemaPayment {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'notice', 'title' => '说明', 'fields' => [
['key' => 'recharge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>用户余额功能:</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>开启后用户可充值到余额,余额可用于全站消费</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>可以在用户管理中,为某一个用户手动赠送余额</li></ul>'],
['key' => 'recharge_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>用户余额功能:</b></p><ul><li>开启后用户可充值到余额,余额可用于全站消费</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>可以在用户管理中,为某一个用户手动赠送余额</li></ul>'],
]],
['key' => 'basic', 'title' => '用户余额', 'fields' => [
['key' => 'pay_balance_s', 'label' => '启用余额充值/支付功能', 'type' => 'switch', 'default' => true, 'help' => '开启后用户中心显示现金钱包,并可作为收银台支付方式'],
@@ -182,13 +182,13 @@ class SchemaPayment {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'notice', 'title' => '说明', 'fields' => [
['key' => 'vip_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>开启付费会员功能之前,请先配置好收款接口,确保网站收款正常</li><li>会员功能的设置项目较多,请仔细核对,避免出现价格、时间的问题</li><li>配合设置名称、有效期等可搭配出不同类型的会员</li><li>管理员可在后台为用户单独开启会员</li></ul>'],
['key' => 'vip_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>开启付费会员功能之前,请先配置好收款接口,确保网站收款正常</li><li>会员功能的设置项目较多,请仔细核对,避免出现价格、时间的问题</li><li>配合设置名称、有效期等可搭配出不同类型的会员</li><li>管理员可在后台为用户单独开启会员</li></ul>'],
]],
['key' => 'basic', 'title' => '会员等级', 'fields' => [
['key' => 'nav_pay_vip', 'label' => '导航栏购买按钮', 'type' => 'switch', 'default' => true, 'help' => '在顶部导航栏显示开通会员按钮;请注意顶部导航的整体宽度。'],
['key' => 'nav_user_pay_vip', 'label' => '用户框购买按钮', 'type' => 'switch', 'default' => true, 'help' => '在导航栏用户框内显示开通会员按钮。'],
['key' => 'pay_user_vip_1_s', 'label' => '启用一级会员', 'type' => 'switch', 'default' => true],
['key' => 'vip_level_order_notice', 'label' => '', 'type' => 'notice', 'ui_only' => true, 'alertType' => 'danger', 'dependsOn' => ['all' => [['key' => 'pay_user_vip_2_s', 'value' => true], ['key' => 'pay_user_vip_1_s', 'operator' => 'falsy']]], 'content' => '<div style="text-align:center"><b>必须先开启一级会员后才能开启二级会员!</b></div>'],
['key' => 'vip_level_order_notice', 'label' => '', 'type' => 'notice', 'ui_only' => true, 'alertType' => 'danger', 'dependsOn' => ['all' => [['key' => 'pay_user_vip_2_s', 'value' => true], ['key' => 'pay_user_vip_1_s', 'operator' => 'falsy']]], 'content' => '必须先开启一级会员后才能开启二级会员!'],
['key' => 'pay_user_vip_2_s', 'label' => '启用二级会员', 'type' => 'switch', 'default' => true],
]],
['key' => 'benefit', 'title' => '会员权益', 'fields' => [
@@ -325,7 +325,7 @@ class SchemaPayment {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'notice', 'title' => '说明', 'fields' => [
['key' => 'revenue_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>开启创作分成后,用户发布的付费内容则按设置的比例收入与用户分成</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>用户分成比例是按照订单实收现金并扣除推广佣金后,再按设置的比例分成</li><li>禁用此功能后,所有收款将不会与作者分成</li></ul>'],
['key' => 'revenue_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>开启创作分成后,用户发布的付费内容则按设置的比例收入与用户分成</li><li>在下方设置默认的分成比例,同时支持单独为每一个用户设置独立的分成比例</li><li>用户分成比例是按照订单实收现金并扣除推广佣金后,再按设置的比例分成</li><li>禁用此功能后,所有收款将不会与作者分成</li></ul>'],
]],
['key' => 'basic', 'title' => '创作中心设置', 'fields' => [
['key' => 'pay_income_s', 'label' => '启用创作分成', 'type' => 'switch', 'default' => false],
@@ -360,7 +360,7 @@ class SchemaPayment {
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'notice', 'title' => '说明', 'fields' => [
['key' => 'affiliate_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>识别模式「绑定注册」:用户只要是通过任意推广链接注册的,今后此用户消费均会给推荐人返佣</li><li>识别模式「仅推广链接」:只有通过推广链接购买的才会给推荐人返佣,不会考虑是否是推荐注册的</li><li>开启的订单类型如果一个都不勾选,则代表该用户类型不参与此功能</li><li>您可以根据网站的VIP设置相互配合设置相应的规则</li><li>下面的设置为全局设置,还可以单独为每一个用户设置规则和比例</li></ul>'],
['key' => 'affiliate_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>识别模式「绑定注册」:用户只要是通过任意推广链接注册的,今后此用户消费均会给推荐人返佣</li><li>识别模式「仅推广链接」:只有通过推广链接购买的才会给推荐人返佣,不会考虑是否是推荐注册的</li><li>开启的订单类型如果一个都不勾选,则代表该用户类型不参与此功能</li><li>您可以根据网站的VIP设置相互配合设置相应的规则</li><li>下面的设置为全局设置,还可以单独为每一个用户设置规则和比例</li></ul>'],
]],
['key' => 'switch', 'title' => '推广返佣', 'fields' => [
['key' => 'pay_rebate_s', 'label' => '启用推广返佣', 'type' => 'switch', 'default' => false],
@@ -423,7 +423,7 @@ class SchemaPayment {
['key' => 'pay_rebate_poster_desc_bottom', 'label' => '海报底部文案', 'type' => 'input', 'default' => '扫描二维码阅读全文', 'dependsOn' => ['key' => 'pay_rebate_poster_s', 'value' => true], 'help' => '画在二维码下方居中位置,留空则使用默认文案。'],
]],
['key' => 'discount', 'title' => '推广让利标签', 'fields' => [
['key' => 'discount_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>推广让利标签配置详解:</b></p><ul style="margin:6px 0 0 18px;line-height:1.9"><li>可使用的变量:折扣 <code>%discount%</code>、推荐人姓名 <code>%referrer_name%</code></li><li>使用变量示例:<code>%referrer_name%推荐购买 下单再减%discount%元</code></li></ul>', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
['key' => 'discount_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<p><b>推广让利标签配置详解:</b></p><ul><li>可使用的变量:折扣 <code>%discount%</code>、推荐人姓名 <code>%referrer_name%</code></li><li>使用变量示例:<code>%referrer_name%推荐购买 下单再减%discount%元</code></li></ul>', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true]],
['key' => 'pay_rebate_text_discount', 'label' => '推广让利标签', 'type' => 'input', 'default' => '推荐购买 下单再减%discount%', 'dependsOn' => ['key' => 'pay_rebate_s', 'value' => true], 'help' => '显示在购买模块,推广让利的标签文案'],
]],
],
@@ -485,10 +485,10 @@ class SchemaPayment {
['key' => 'card_pass', 'label' => '卡密'],
], 'help' => '收银台支付方式显示顺序;仅显示已开启的接口'],
]],
['key' => 'alipay', 'title' => '支付宝官方', 'collapsible' => true, 'dependsOn' => ['key' => 'pay_alipay_sdk_options', 'value' => 'official_alipay'], 'fields' => [
['key' => 'alipay', 'title' => '支付宝官方', 'collapsible' => true, 'defaultCollapsed' => true, 'dependsOn' => ['key' => 'pay_alipay_sdk_options', 'value' => 'official_alipay'], 'fields' => [
['key' => 'alipay_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>支付宝公钥为必填项目(公钥错误可以成功付款,但会回调失败)</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return}</li><li>同时填写了企业支付以及当面付参数,则优先使用当面付</li></ul>'],
['key' => 'alipay_appid', 'label' => '当面付:APPID', 'type' => 'input', 'default' => ''],
['key' => 'alipay_privatekey', 'label' => '当面付:应用私钥', 'type' => 'textarea', 'sanitize_type' => 'code', 'default' => '', 'rows' => 4],
['key' => 'alipay_privatekey', 'label' => '当面付:应用私钥', 'type' => 'textarea', 'sanitize_type' => 'code', 'default' => '', 'rows' => 4, 'secret' => true],
['key' => 'alipay_payment_type', 'label' => '支付方式', 'type' => 'select', 'default' => 'page', 'options' => [
['label' => '电脑网站支付(web)', 'value' => 'page'],
['label' => '手机网站支付(wap)', 'value' => 'wap'],
@@ -497,7 +497,7 @@ class SchemaPayment {
['key' => 'alipay_public_cert_path', 'label' => '支付宝公钥证书路径', 'type' => 'input', 'default' => '', 'help' => 'alipayCertPublicKey_RSA2.crt 绝对路径。'],
['key' => 'alipay_root_cert_path', 'label' => '支付宝根证书路径', 'type' => 'input', 'default' => '', 'help' => 'alipayRootCert.crt 绝对路径。'],
]],
['key' => 'wechat', 'title' => '微信官方', 'collapsible' => true, 'dependsOn' => ['key' => 'pay_wechat_sdk_options', 'value' => 'official_wechat'], 'fields' => [
['key' => 'wechat', 'title' => '微信官方', 'collapsible' => true, 'defaultCollapsed' => true, 'dependsOn' => ['key' => 'pay_wechat_sdk_options', 'value' => 'official_wechat'], 'fields' => [
['key' => 'wechat_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>微信企业支付:官方接口,商家可申请,有年费,申请较为复杂</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/wechatpay/{notify|return},请配置 Native 支付回调链接</li></ul>'],
['key' => 'wechat_merchantid', 'label' => '商户号 PartnerID', 'type' => 'input', 'default' => ''],
['key' => 'wechat_appid', 'label' => '授权绑定的AppID', 'type' => 'input', 'default' => ''],
@@ -509,7 +509,7 @@ class SchemaPayment {
['key' => 'wechat_private_key_path', 'label' => '商户私钥路径', 'type' => 'input', 'default' => '', 'help' => 'apiclient_key.pem 绝对路径,用于签名。'],
['key' => 'wechat_cert_path', 'label' => '商户API证书路径', 'type' => 'input', 'default' => '', 'help' => 'apiclient_cert.pem 绝对路径。'],
]],
['key' => 'paypal', 'title' => 'PayPal(贝宝)', 'collapsible' => true, 'dependsOn' => ['key' => 'pay_paypal_sdk_s', 'value' => true], 'fields' => [
['key' => 'paypal', 'title' => 'PayPal(贝宝)', 'collapsible' => true, 'defaultCollapsed' => true, 'dependsOn' => ['key' => 'pay_paypal_sdk_s', 'value' => true], 'fields' => [
['key' => 'paypal_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>PayPal(贝宝)是常见的海外支付接口</li><li>如果您的收款账户为中国大陆地区,则账户类型必须是企业,且只能收取非中国大陆区的PayPal付款</li><li>REST 应用申请:https://developer.paypal.com/dashboard/applications</li></ul>'],
['key' => 'paypal_client_id', 'label' => 'Client ID', 'type' => 'input', 'default' => ''],
['key' => 'paypal_client_secret', 'label' => 'Client Secret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
@@ -517,7 +517,7 @@ class SchemaPayment {
['key' => 'paypal_rates', 'label' => '货币汇率', 'type' => 'input', 'default' => '0.14', 'help' => '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137'],
['key' => 'paypal_sandbox', 'label' => '沙盒调试模式', 'type' => 'switch', 'default' => false, 'help' => '沙箱模式(Sandbox)是PayPal支付的测试环境。开启后请使用沙箱环境生成的收款账户和付款账户进行测试。'],
]],
['key' => 'stripe', 'title' => 'Stripe', 'collapsible' => true, 'dependsOn' => ['key' => 'pay_stripe_sdk_s', 'value' => true], 'fields' => [
['key' => 'stripe', 'title' => 'Stripe', 'collapsible' => true, 'defaultCollapsed' => true, 'dependsOn' => ['key' => 'pay_stripe_sdk_s', 'value' => true], 'fields' => [
['key' => 'stripe_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>Stripe 是常见的海外信用卡收款接口</li><li>API 密钥申请:https://dashboard.stripe.com/apikeys</li><li>Webhook 事件:checkout.session.completed</li><li>测试环境请使用 sk_test_ 开头的 Secret Key</li></ul>'],
['key' => 'stripe_secret_key', 'label' => '私钥Secret Key', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => '', 'help' => 'Stripe Dashboard → Developers → API keys → Secret key'],
['key' => 'stripe_publishable_key', 'label' => 'Publishable Key', 'type' => 'input', 'default' => ''],
@@ -526,7 +526,7 @@ class SchemaPayment {
['key' => 'stripe_rates', 'label' => '货币汇率', 'type' => 'input', 'default' => '0.14', 'help' => '根据你选择的货币类型与您定价货币的汇率进行填写,例如1元人民币兑换0.137美元(USD),则此处填0.137'],
['key' => 'stripe_test_mode', 'label' => '测试模式', 'type' => 'switch', 'default' => false, 'help' => '如果使用的测试开放模式,则请使用 sk_test_ 测试密钥与 Stripe 测试卡进行配置'],
]],
['key' => 'epay', 'title' => '易支付', 'collapsible' => true, 'dependsOn' => ['any' => [
['key' => 'epay', 'title' => '易支付', 'collapsible' => true, 'defaultCollapsed' => true, 'dependsOn' => ['any' => [
['key' => 'pay_wechat_sdk_options', 'value' => 'epay'],
['key' => 'pay_alipay_sdk_options', 'value' => 'epay'],
]], 'fields' => [
+8 -8
View File
@@ -336,31 +336,31 @@ class SchemaUsers {
['key' => 'oauth_weixingzh_s', 'label' => '微信公众号登录', 'type' => 'switch', 'default' => false],
['key' => 'clogin_s', 'label' => '彩虹聚合登录', 'type' => 'switch', 'default' => false, 'help' => '通过第三方聚合登录平台统一接入 QQ、微信和微博'],
]],
['key' => 'github', 'title' => 'GitHub配置', 'collapsible' => true, 'expandWhen' => 'oauth_github_s', 'fields' => [
['key' => 'github', 'title' => 'GitHub配置', 'collapsible' => true, 'defaultCollapsed' => true, 'fields' => [
['key' => 'github_appid', 'label' => 'Client ID', 'type' => 'input', 'default' => ''],
['key' => 'github_appkey', 'label' => 'Client Secret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
]],
['key' => 'gitee', 'title' => 'Gitee配置', 'collapsible' => true, 'expandWhen' => 'oauth_gitee_s', 'fields' => [
['key' => 'gitee', 'title' => 'Gitee配置', 'collapsible' => true, 'defaultCollapsed' => true, 'fields' => [
['key' => 'gitee_appid', 'label' => 'Client ID', 'type' => 'input', 'default' => ''],
['key' => 'gitee_appkey', 'label' => 'Client Secret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
]],
['key' => 'qq', 'title' => 'QQ配置', 'collapsible' => true, 'expandWhen' => 'oauth_qq_s', 'fields' => [
['key' => 'qq', 'title' => 'QQ配置', 'collapsible' => true, 'defaultCollapsed' => true, 'fields' => [
['key' => 'qq_appid', 'label' => 'App ID', 'type' => 'input', 'default' => ''],
['key' => 'qq_appkey', 'label' => 'App Key', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
]],
['key' => 'google', 'title' => 'Google配置', 'collapsible' => true, 'expandWhen' => 'oauth_google_s', 'fields' => [
['key' => 'google', 'title' => 'Google配置', 'collapsible' => true, 'defaultCollapsed' => true, 'fields' => [
['key' => 'google_client_id', 'label' => 'Client ID', 'type' => 'input', 'default' => ''],
['key' => 'google_client_secret', 'label' => 'Client Secret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
]],
['key' => 'weibo', 'title' => '微博配置', 'collapsible' => true, 'expandWhen' => 'oauth_weibo_s', 'fields' => [
['key' => 'weibo', 'title' => '微博配置', 'collapsible' => true, 'defaultCollapsed' => true, 'fields' => [
['key' => 'weibo_appid', 'label' => 'App Key', 'type' => 'input', 'default' => ''],
['key' => 'weibo_appkey', 'label' => 'App Secret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
]],
['key' => 'weixin', 'title' => '微信开放平台配置', 'collapsible' => true, 'expandWhen' => 'oauth_weixin_s', 'fields' => [
['key' => 'weixin', 'title' => '微信开放平台配置', 'collapsible' => true, 'defaultCollapsed' => true, 'fields' => [
['key' => 'weixin_appid', 'label' => 'AppID', 'type' => 'input', 'default' => ''],
['key' => 'weixin_appsecret', 'label' => 'AppSecret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
]],
['key' => 'weixingzh', 'title' => '微信公众号配置', 'collapsible' => true, 'expandWhen' => 'oauth_weixingzh_s', 'fields' => [
['key' => 'weixingzh', 'title' => '微信公众号配置', 'collapsible' => true, 'defaultCollapsed' => true, 'fields' => [
['key' => 'weixingzh_gzh_type', 'label' => '公众号类型', 'type' => 'radio', 'default' => 'service', 'options' => [
['label' => '服务号', 'value' => 'service'],
['label' => '订阅号', 'value' => 'subscribe'],
@@ -374,7 +374,7 @@ class SchemaUsers {
['key' => 'weixingzh_subscribe_msg', 'label' => '关注后回复', 'type' => 'textarea', 'default' => '', 'help' => '用户关注公众号后的自动回复文案'],
['key' => 'weixingzh_scan_msg', 'label' => '扫码回复', 'type' => 'textarea', 'default' => '', 'help' => '用户扫码关注公众号后的回复文案'],
]],
['key' => 'clogin', 'title' => '彩虹聚合登录', 'collapsible' => true, 'dependsOn' => ['key' => 'clogin_s', 'value' => true], 'fields' => [
['key' => 'clogin', 'title' => '彩虹聚合登录', 'collapsible' => true, 'defaultCollapsed' => true, 'dependsOn' => ['key' => 'clogin_s', 'value' => true], 'fields' => [
['key' => 'clogin_url', 'label' => '接口地址', 'type' => 'input', 'sanitize_type' => 'url', 'default' => '', 'help' => '如 https://xxx.com,不要带 connect.php'],
['key' => 'clogin_id', 'label' => 'AppID', 'type' => 'input', 'default' => ''],
['key' => 'clogin_key', 'label' => 'AppKey', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],