refactor: refactor subscription delivery logic, change payment return_url to origin_url concatenation

- Unify protocol filter configuration to client.type.field (dot-path, three-segment) format, support strict whitelist mode
- Refactor AbstractProtocol and all protocol classes for more flexible and maintainable subscription delivery
- Change payment callback logic: use origin_url concatenation instead of return_url for more accurate redirects
This commit is contained in:
xboard
2025-07-18 15:42:58 +08:00
parent e2d7b6a5e0
commit 508caebdcd
14 changed files with 334 additions and 183 deletions

View File

@@ -2,7 +2,7 @@
use App\Support\Setting;
use Illuminate\Support\Facades\App;
if (! function_exists('admin_setting')) {
if (!function_exists('admin_setting')) {
/**
* 获取或保存配置参数.
*
@@ -13,7 +13,7 @@ if (! function_exists('admin_setting')) {
function admin_setting($key = null, $default = null)
{
$setting = app(Setting::class);
if ($key === null) {
return $setting->toArray();
}
@@ -22,13 +22,13 @@ if (! function_exists('admin_setting')) {
$setting->save($key);
return '';
}
$default = config('v2board.'. $key) ?? $default;
$default = config('v2board.' . $key) ?? $default;
return $setting->get($key) ?? $default;
}
}
if (! function_exists('admin_settings_batch')) {
if (!function_exists('admin_settings_batch')) {
/**
* 批量获取配置参数,性能优化版本
*
@@ -40,3 +40,18 @@ if (! function_exists('admin_settings_batch')) {
return app(Setting::class)->getBatch($keys);
}
}
if (!function_exists('origin_url')) {
/**
* 根据 HTTP_ORIGIN 拼接完整 URL
* @param string $path
* @return string
*/
function origin_url(string $path = ''): string
{
$origin = request()->getSchemeAndHttpHost(); // 自动带端口
$origin = rtrim($origin, '/');
$path = ltrim($path, '/');
return $origin . '/' . $path;
}
}