feat: update appraisal ordering and payment flows

This commit is contained in:
wushumin
2026-06-03 18:14:40 +08:00
parent 0838db5aba
commit 6383ec5a2a
50 changed files with 6143 additions and 988 deletions

View File

@@ -83,6 +83,19 @@ function buildH5OAuthRedirectUrl(string $pageBaseUrl): string
return $baseUrl === '' ? '' : $baseUrl . '/#/pages/auth/login';
}
function buildShouqianbaNotifyUrl(array $env): string
{
$baseUrl = trim((string)($env['PUBLIC_FILE_BASE_URL'] ?? ''));
if ($baseUrl === '') {
return '';
}
if (!preg_match('/^https?:\/\//i', $baseUrl)) {
$baseUrl = 'https://' . ltrim($baseUrl, '/');
}
return rtrim($baseUrl, '/') . '/api/open/shouqianba/payment/notify';
}
function checkClientProductionApiBase(array &$issues, string $label, string $envPath): void
{
$env = @parse_ini_file($envPath);
@@ -130,6 +143,7 @@ foreach ($configRows as $row) {
$configMap[$row['config_group'] . '.' . $row['config_key']] = (string)($row['config_value'] ?? '');
}
$configMap['h5.oauth_redirect_url'] = buildH5OAuthRedirectUrl((string)($configMap['h5.page_base_url'] ?? ''));
$configMap['payment.notify_url'] = buildShouqianbaNotifyUrl($env);
$requiredConfigKeys = [
'mini_program.app_id',
@@ -143,18 +157,34 @@ $requiredConfigKeys = [
'sms.access_key_secret',
'sms.sign_name',
'sms.login_template_code',
'payment.mch_id',
'payment.api_v3_key',
'payment.merchant_serial_no',
'payment.enabled',
'payment.api_domain',
'payment.appid',
'payment.brand_code',
'payment.store_sn',
'payment.merchant_private_key',
'payment.platform_certificate_serial',
'payment.shouqianba_public_key',
'payment.notify_url',
'payment.mini_program_plugin_version',
];
foreach ($requiredConfigKeys as $key) {
check(($configMap[$key] ?? '') !== '', $issues, 'FAIL', "系统配置缺失: {$key}", "后台系统配置中 {$key} 仍为空。");
}
check(($configMap['payment.enabled'] ?? '') === 'enabled', $issues, 'FAIL', '收钱吧支付未启用', '后台系统配置 payment.enabled 必须为 enabled。');
foreach (['payment.api_domain' => '收钱吧 API 域名', 'payment.notify_url' => '收钱吧通知地址'] as $key => $label) {
if (($configMap[$key] ?? '') !== '') {
check(
preg_match('/^https?:\/\//i', (string)$configMap[$key]) === 1,
$issues,
'FAIL',
"{$label} 格式不正确",
"后台系统配置 {$key} 需以 http:// 或 https:// 开头。"
);
}
}
if (($configMap['h5.page_base_url'] ?? '') !== '' && isPlaceholderApiBase((string)$configMap['h5.page_base_url'])) {
add_issue($issues, 'FAIL', 'H5 页面根地址未配置正式域名', '后台系统配置 h5.page_base_url 仍为本地或占位地址,扫码公开链接将无法用于正式环境。');
}
@@ -162,8 +192,7 @@ if (($configMap['h5.page_base_url'] ?? '') !== '' && isPlaceholderApiBase((strin
$demoValues = [
'mini_program.app_id' => 'wx1234567890test',
'h5.app_id' => 'h5_app_demo',
'payment.mch_id' => '1900000109',
'payment.api_v3_key' => 'demo_api_v3_key_1234567890',
'payment.api_domain' => 'https://example.com',
];
foreach ($demoValues as $key => $value) {
@@ -211,6 +240,27 @@ if (!is_array($manifest)) {
'manifest.json 中 mp-weixin.appid 与后台系统配置 mini_program.app_id 不一致,请先执行配置同步。'
);
}
$plugin = $manifest['mp-weixin']['plugins']['lite-pos-plugin'] ?? null;
if (!is_array($plugin)) {
add_issue($issues, 'FAIL', '小程序未声明收钱吧插件', 'manifest.json 中缺少 mp-weixin.plugins.lite-pos-plugin请先执行配置同步。');
} else {
check(
($plugin['provider'] ?? '') === 'wx7903bb295ac26ac7',
$issues,
'FAIL',
'小程序收钱吧插件 provider 不正确',
'manifest.json 中 lite-pos-plugin.provider 必须为 wx7903bb295ac26ac7。'
);
if (($configMap['payment.mini_program_plugin_version'] ?? '') !== '') {
check(
($plugin['version'] ?? '') === $configMap['payment.mini_program_plugin_version'],
$issues,
'FAIL',
'小程序收钱吧插件版本未同步后台配置',
'manifest.json 中 lite-pos-plugin.version 与后台 payment.mini_program_plugin_version 不一致,请先执行配置同步。'
);
}
}
}
checkClientProductionApiBase($issues, 'admin-web', $projectRoot . '/admin-web/.env.production');