fix: statisc
This commit is contained in:
@@ -22,9 +22,13 @@ class SystemSettingsController extends Controller
|
||||
'telegram_owner_chat_id' => ['nullable', 'string', 'max:64'],
|
||||
'channels_max_per_agent' => ['nullable', 'integer', 'min:1', 'max:100'],
|
||||
'channels_domains' => ['nullable', 'string', 'max:4000'],
|
||||
'panel_admin_hosts' => ['nullable', 'string', 'max:4000'],
|
||||
'panel_agent_hosts' => ['nullable', 'string', 'max:4000'],
|
||||
]);
|
||||
|
||||
$domains = SettingsService::parseDomains($data['channels_domains'] ?? null);
|
||||
$adminHosts = SettingsService::parseDomains($data['panel_admin_hosts'] ?? null);
|
||||
$agentHosts = SettingsService::parseDomains($data['panel_agent_hosts'] ?? null);
|
||||
|
||||
$settings->putMany([
|
||||
'telegram.bot_token' => $data['telegram_bot_token'] ?? null,
|
||||
@@ -34,6 +38,9 @@ class SystemSettingsController extends Controller
|
||||
: null,
|
||||
// Persist normalized comma-separated list (empty clears override to []).
|
||||
'channels.domains' => $domains === [] ? '' : implode(',', $domains),
|
||||
// Empty = no Host restriction for that panel.
|
||||
'panel.admin_hosts' => $adminHosts === [] ? '' : implode(',', $adminHosts),
|
||||
'panel.agent_hosts' => $agentHosts === [] ? '' : implode(',', $agentHosts),
|
||||
]);
|
||||
|
||||
return response()->json(['code' => 0, 'msg' => '已保存']);
|
||||
|
||||
Reference in New Issue
Block a user