feat: 真实支付配置 + 修复 yansongda 配置结构 bug + 后台 AI 实时进度
- 支付设置:支付宝/微信各自支持正式/沙箱网关环境,凭据字段补全(支付宝公钥、微信商户证书私钥/平台证书 PEM),密钥可直接粘贴 PEM 文本(yansongda 支持字符串) - 修复关键 bug:yansongda 配置结构错误(app_id 等在 default 租户外,真实网关拿不到配置),现按 alipay.default / wechat.default 正确传入,并用 _force 保证每次调用生效 - 后台 AI 设置页新增 WebSocket 实时审核进度(ai.moderation.* 事件),未连接时降级提示 - 部署文档:明确 queue:work 与 workerman:serve 等价、dev:watch 用法 - 测试:支付宝/微信配置结构回归 + AI 设置页加载
This commit is contained in:
@@ -8,6 +8,8 @@ namespace Plugins\Neatstudio\Payment\Filament\Pages;
|
||||
use App\Models\Setting;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
@@ -35,9 +37,14 @@ class PaymentSettings extends Page
|
||||
'pay_sandbox' => (int) Setting::get('pay_sandbox', 1) === 1,
|
||||
'pay_alipay_app_id' => Setting::get('pay_alipay_app_id', ''),
|
||||
'pay_alipay_app_secret' => Setting::get('pay_alipay_app_secret', ''),
|
||||
'pay_alipay_public_key' => Setting::get('pay_alipay_public_key', ''),
|
||||
'pay_alipay_mode' => Setting::get('pay_alipay_mode', 'normal'),
|
||||
'pay_wechat_app_id' => Setting::get('pay_wechat_app_id', ''),
|
||||
'pay_wechat_mch_id' => Setting::get('pay_wechat_mch_id', ''),
|
||||
'pay_wechat_mch_secret' => Setting::get('pay_wechat_mch_secret', ''),
|
||||
'pay_wechat_mch_cert' => Setting::get('pay_wechat_mch_cert', ''),
|
||||
'pay_wechat_platform_cert' => Setting::get('pay_wechat_platform_cert', ''),
|
||||
'pay_wechat_mode' => Setting::get('pay_wechat_mode', 'normal'),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -46,21 +53,52 @@ class PaymentSettings extends Page
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('通用')
|
||||
->description('关闭沙箱后才会调用真实支付网关;支付宝/微信各自可选正式环境或官方沙箱环境(需对应环境的凭据)')
|
||||
->schema([
|
||||
Toggle::make('pay_sandbox')->label('沙箱模式(无需真实密钥即可测试支付流程)')->default(true),
|
||||
Toggle::make('pay_sandbox')->label('沙箱模式(模拟支付,无需真实密钥即可测试完整流程)')->default(true),
|
||||
]),
|
||||
Section::make('支付宝')
|
||||
->description('正式/沙箱环境凭据:open.alipay.com → 沙箱环境或控制台,RSA2 密钥生成器获取应用私钥与支付宝公钥')
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('pay_alipay_app_id')->label('App ID')->columnSpanFull(),
|
||||
TextInput::make('pay_alipay_app_secret')->label('应用私钥(app_secret_cert)')->password()->columnSpanFull(),
|
||||
Select::make('pay_alipay_mode')
|
||||
->label('网关环境')
|
||||
->options(['normal' => '正式环境', 'sandbox' => '沙箱环境'])
|
||||
->default('normal'),
|
||||
TextInput::make('pay_alipay_app_id')
|
||||
->label('App ID')
|
||||
->placeholder('正式 / 沙箱应用 ID')
|
||||
->columnSpan(2),
|
||||
Textarea::make('pay_alipay_app_secret')
|
||||
->label('应用私钥(RSA2 PEM)')
|
||||
->rows(5)
|
||||
->helperText('以 -----BEGIN PRIVATE KEY----- 开头')
|
||||
->columnSpan(2),
|
||||
Textarea::make('pay_alipay_public_key')
|
||||
->label('支付宝公钥(RSA2 PEM)')
|
||||
->rows(5)
|
||||
->helperText('以 -----BEGIN PUBLIC KEY----- 开头;用于回调验签')
|
||||
->columnSpan(2),
|
||||
]),
|
||||
Section::make('微信支付')
|
||||
->description('微信商户平台(pay.weixin.qq.com)→ 账户中心 → API 安全:APIv3 密钥、商户 API 证书(apiclient_key.pem)、平台证书')
|
||||
->columns(2)
|
||||
->schema([
|
||||
TextInput::make('pay_wechat_app_id')->label('App ID'),
|
||||
Select::make('pay_wechat_mode')
|
||||
->label('网关环境')
|
||||
->options(['normal' => '正式环境', 'sandbox' => '沙箱环境'])
|
||||
->default('normal'),
|
||||
TextInput::make('pay_wechat_app_id')->label('App ID(小程序/公众号)'),
|
||||
TextInput::make('pay_wechat_mch_id')->label('商户号 MCH ID'),
|
||||
TextInput::make('pay_wechat_mch_secret')->label('API 密钥')->password()->columnSpanFull(),
|
||||
TextInput::make('pay_wechat_mch_secret')->label('APIv3 密钥')->password()->columnSpan(2),
|
||||
Textarea::make('pay_wechat_mch_cert')
|
||||
->label('商户 API 证书私钥(apiclient_key.pem)')
|
||||
->rows(5)
|
||||
->columnSpan(2),
|
||||
Textarea::make('pay_wechat_platform_cert')
|
||||
->label('微信支付平台证书(公钥 PEM)')
|
||||
->rows(5)
|
||||
->columnSpan(2),
|
||||
]),
|
||||
])
|
||||
->statePath('data');
|
||||
|
||||
Reference in New Issue
Block a user