feat(admin): polish badge, OAuth and payment gateway settings UX
- Badge page: rewrite as collapsible sortable category/item cards with
preset medal icon picker, dirty-tracked save bar and duplicate slug check;
drop user_badge_* dual-read and legacy name/icon_url fallbacks
- OAuth: provider config groups collapsible, expanded when provider is on;
clogin visibility moved to group-level dependsOn
- Gateway: expandWhen accepts dependsOn-style rules; select-gated groups no
longer always expand ('null' was truthy); mark five gateway secrets as
secret/password in JS and PHP; class-based notice list styling
- Remove unused UserRuntime::parse_badge_dictionary
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
116b6b2223
commit
3179754670
13 files changed
+502
-239
No files matched your search
@@ -439,7 +439,7 @@ class SchemaPayment {
|
||||
'option_key' => 'aksrt_settings',
|
||||
'groups' => [
|
||||
['key' => 'notice', 'title' => '说明', 'fields' => [
|
||||
['key' => 'gateway_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>以下收款接口,主题仅提供API接入服务,收款平台的可靠性请自行斟酌!</li><li>涉及到资金及信息安全,有相关执照的商家推荐使用官方接口</li><li>微信 / 支付宝接口可在「官方」与「易支付」之间选择;PayPal 与 Stripe 独立开关</li><li>异步回调由各网关验签,无需额外口令;回调地址固定为 /wp-json/aksrt/v1/payment/{gateway}/{notify|return}</li></ul>'],
|
||||
['key' => 'gateway_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>以下收款接口,主题仅提供API接入服务,收款平台的可靠性请自行斟酌!</li><li>涉及到资金及信息安全,有相关执照的商家推荐使用官方接口</li><li>微信 / 支付宝接口可在「官方」与「易支付」之间选择;PayPal 与 Stripe 独立开关</li><li>异步回调由各网关验签,无需额外口令;回调地址固定为 /wp-json/aksrt/v1/payment/{gateway}/{notify|return}</li></ul>'],
|
||||
]],
|
||||
['key' => 'channels', 'title' => '收款接口选择', 'fields' => [
|
||||
['key' => 'pay_wechat_sdk_options', 'label' => '微信收款接口', 'type' => 'select', 'default' => 'null', 'options' => [
|
||||
@@ -485,8 +485,8 @@ class SchemaPayment {
|
||||
['key' => 'card_pass', 'label' => '卡密'],
|
||||
], 'help' => '收银台支付方式显示顺序;仅显示已开启的接口'],
|
||||
]],
|
||||
['key' => 'alipay', 'title' => '支付宝官方', 'collapsible' => true, 'expandWhen' => 'pay_alipay_sdk_options', 'dependsOn' => ['key' => 'pay_alipay_sdk_options', 'value' => 'official_alipay'], 'fields' => [
|
||||
['key' => 'alipay_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>支付宝公钥为必填项目(公钥错误可以成功付款,但会回调失败)</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/alipay/{notify|return}</li><li>同时填写了企业支付以及当面付参数,则优先使用当面付</li></ul>'],
|
||||
['key' => 'alipay', 'title' => '支付宝官方', 'collapsible' => 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_payment_type', 'label' => '支付方式', 'type' => 'select', 'default' => 'page', 'options' => [
|
||||
@@ -497,43 +497,43 @@ 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, 'expandWhen' => 'pay_wechat_sdk_options', 'dependsOn' => ['key' => 'pay_wechat_sdk_options', 'value' => 'official_wechat'], 'fields' => [
|
||||
['key' => 'wechat_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>微信企业支付:官方接口,商家可申请,有年费,申请较为复杂</li><li>回调地址固定为 /wp-json/aksrt/v1/payment/wechatpay/{notify|return},请配置 Native 支付回调链接</li></ul>'],
|
||||
['key' => 'wechat', 'title' => '微信官方', 'collapsible' => 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' => ''],
|
||||
['key' => 'wechat_payment_type', 'label' => '支付方式', 'type' => 'select', 'default' => 'native', 'options' => [
|
||||
['label' => '扫码支付(Native)', 'value' => 'native'],
|
||||
['label' => 'H5支付', 'value' => 'h5'],
|
||||
]],
|
||||
['key' => 'wechat_api_v3_key', 'label' => '支付APIv3密钥', 'type' => 'input', 'default' => '', 'help' => '微信商户平台设置的 APIv3 密钥(32位)。'],
|
||||
['key' => 'wechat_api_v3_key', 'label' => '支付APIv3密钥', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => '', 'help' => '微信商户平台设置的 APIv3 密钥(32位)。'],
|
||||
['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, 'expandWhen' => 'pay_paypal_sdk_s', 'dependsOn' => ['key' => 'pay_paypal_sdk_s', 'value' => true], 'fields' => [
|
||||
['key' => 'paypal_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><li>PayPal(贝宝)是常见的海外支付接口</li><li>如果您的收款账户为中国大陆地区,则账户类型必须是企业,且只能收取非中国大陆区的PayPal付款</li><li>REST 应用申请:https://developer.paypal.com/dashboard/applications</li></ul>'],
|
||||
['key' => 'paypal', 'title' => 'PayPal(贝宝)', 'collapsible' => 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', 'default' => ''],
|
||||
['key' => 'paypal_client_secret', 'label' => 'Client Secret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
|
||||
['key' => 'paypal_currency', 'label' => '结算货币', 'type' => 'select', 'case_insensitive' => true, 'default' => 'USD', 'options' => self::currency_options()],
|
||||
['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, 'expandWhen' => 'pay_stripe_sdk_s', 'dependsOn' => ['key' => 'pay_stripe_sdk_s', 'value' => true], 'fields' => [
|
||||
['key' => 'stripe_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul style="margin:0 0 0 18px;line-height:1.9"><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', 'default' => '', 'help' => 'Stripe Dashboard → Developers → API keys → Secret key'],
|
||||
['key' => 'stripe', 'title' => 'Stripe', 'collapsible' => 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' => ''],
|
||||
['key' => 'stripe_webhook_secret', 'label' => '签名密钥Webhook Secret', 'type' => 'input', 'default' => '', 'help' => 'Developers → Webhooks → 端点 → Signing secret(whsec_ 开头)'],
|
||||
['key' => 'stripe_webhook_secret', 'label' => '签名密钥Webhook Secret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => '', 'help' => 'Developers → Webhooks → 端点 → Signing secret(whsec_ 开头)'],
|
||||
['key' => 'stripe_currency', 'label' => '结算货币', 'type' => 'select', 'case_insensitive' => true, 'default' => 'USD', 'options' => self::currency_options()],
|
||||
['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, 'expandWhen' => 'pay_wechat_sdk_options', 'dependsOn' => ['any' => [
|
||||
['key' => 'epay', 'title' => '易支付', 'collapsible' => true, 'dependsOn' => ['any' => [
|
||||
['key' => 'pay_wechat_sdk_options', 'value' => 'epay'],
|
||||
['key' => 'pay_alipay_sdk_options', 'value' => 'epay'],
|
||||
]], 'fields' => [
|
||||
['key' => 'epay_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></ul>'],
|
||||
['key' => 'epay_notice', 'label' => '', 'type' => 'content', 'ui_only' => true, 'content' => '<ul><li>易支付是一个常见的支付系统源码,任何人都可以下载并搭建</li><li>同时市面上多数的小规模支付平台都是由易支付修改而来,例如部分码支付、源支付等等</li><li>由于此接口服务商众多,主题只负责技术接入,平台可靠性请自行斟酌</li></ul>'],
|
||||
['key' => 'epay_apiurl', 'label' => 'API接口网址', 'type' => 'input', 'default' => '', 'help' => '请填写接口地址,例如:https://pay.xxxxxxx.cn/'],
|
||||
['key' => 'epay_pid', 'label' => '商户号', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'epay_key', 'label' => '商户秘钥', 'type' => 'input', 'default' => '', 'help' => 'MD5 通信密钥。'],
|
||||
['key' => 'epay_key', 'label' => '商户秘钥', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => '', 'help' => 'MD5 通信密钥。'],
|
||||
['key' => 'epay_device', 'label' => '下单终端', 'type' => 'select', 'default' => 'auto', 'options' => [
|
||||
['label' => '自动(按 UA)', 'value' => 'auto'],
|
||||
['label' => '电脑端 submit', 'value' => 'pc'],
|
||||
|
||||
@@ -334,33 +334,33 @@ class SchemaUsers {
|
||||
['key' => 'oauth_weibo_s', 'label' => '微博登录', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'oauth_weixin_s', 'label' => '微信开放平台登录', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'oauth_weixingzh_s', 'label' => '微信公众号登录', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'clogin_s', 'label' => '彩虹聚合登录', 'type' => 'switch', 'default' => false],
|
||||
['key' => 'clogin_s', 'label' => '彩虹聚合登录', 'type' => 'switch', 'default' => false, 'help' => '通过第三方聚合登录平台统一接入 QQ、微信和微博'],
|
||||
]],
|
||||
['key' => 'github', 'title' => 'GitHub配置', 'fields' => [
|
||||
['key' => 'github', 'title' => 'GitHub配置', 'collapsible' => true, 'expandWhen' => 'oauth_github_s', '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配置', 'fields' => [
|
||||
['key' => 'gitee', 'title' => 'Gitee配置', 'collapsible' => true, 'expandWhen' => 'oauth_gitee_s', '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配置', 'fields' => [
|
||||
['key' => 'qq', 'title' => 'QQ配置', 'collapsible' => true, 'expandWhen' => 'oauth_qq_s', '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配置', 'fields' => [
|
||||
['key' => 'google', 'title' => 'Google配置', 'collapsible' => true, 'expandWhen' => 'oauth_google_s', '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' => '微博配置', 'fields' => [
|
||||
['key' => 'weibo', 'title' => '微博配置', 'collapsible' => true, 'expandWhen' => 'oauth_weibo_s', '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' => '微信开放平台配置', 'fields' => [
|
||||
['key' => 'weixin', 'title' => '微信开放平台配置', 'collapsible' => true, 'expandWhen' => 'oauth_weixin_s', 'fields' => [
|
||||
['key' => 'weixin_appid', 'label' => 'AppID', 'type' => 'input', 'default' => ''],
|
||||
['key' => 'weixin_appsecret', 'label' => 'AppSecret', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => ''],
|
||||
]],
|
||||
['key' => 'weixingzh', 'title' => '微信公众号配置', 'fields' => [
|
||||
['key' => 'weixingzh', 'title' => '微信公众号配置', 'collapsible' => true, 'expandWhen' => 'oauth_weixingzh_s', 'fields' => [
|
||||
['key' => 'weixingzh_gzh_type', 'label' => '公众号类型', 'type' => 'radio', 'default' => 'service', 'options' => [
|
||||
['label' => '服务号', 'value' => 'service'],
|
||||
['label' => '订阅号', 'value' => 'subscribe'],
|
||||
@@ -374,15 +374,15 @@ class SchemaUsers {
|
||||
['key' => 'weixingzh_subscribe_msg', 'label' => '关注后回复', 'type' => 'textarea', 'default' => '', 'help' => '用户关注公众号后的自动回复文案'],
|
||||
['key' => 'weixingzh_scan_msg', 'label' => '扫码回复', 'type' => 'textarea', 'default' => '', 'help' => '用户扫码关注公众号后的回复文案'],
|
||||
]],
|
||||
['key' => 'clogin', 'title' => '彩虹聚合登录', 'fields' => [
|
||||
['key' => 'clogin_url', 'label' => '接口地址', 'type' => 'input', 'sanitize_type' => 'url', 'default' => '', 'dependsOn' => ['key' => 'clogin_s', 'value' => true], 'help' => '如 https://xxx.com,不要带 connect.php'],
|
||||
['key' => 'clogin_id', 'label' => 'AppID', 'type' => 'input', 'default' => '', 'dependsOn' => ['key' => 'clogin_s', 'value' => true]],
|
||||
['key' => 'clogin_key', 'label' => 'AppKey', 'type' => 'input', 'inputType' => 'password', 'secret' => true, 'default' => '', 'dependsOn' => ['key' => 'clogin_s', 'value' => true]],
|
||||
['key' => 'clogin', 'title' => '彩虹聚合登录', 'collapsible' => 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' => ''],
|
||||
['key' => 'clogin_oauth_s', 'label' => '启用平台', 'type' => 'checkbox', 'default' => ['qq', 'weixin', 'weibo'], 'options' => [
|
||||
['label' => 'QQ', 'value' => 'qq'],
|
||||
['label' => '微信', 'value' => 'weixin'],
|
||||
['label' => '微博', 'value' => 'weibo'],
|
||||
], 'dependsOn' => ['key' => 'clogin_s', 'value' => true]],
|
||||
]],
|
||||
]],
|
||||
],
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user