mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 19:40:53 +08:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user