This commit is contained in:
2026-08-05 15:56:08 +08:00
parent 01729b1e0b
commit 2d9e2376b6
106 changed files with 10007 additions and 253 deletions
+16 -12
View File
@@ -6,6 +6,20 @@ use app\model\SystemSetting;
class SettingsService
{
private const DEFAULT_FEATURES = [
'markdown' => true,
'image' => true,
'video' => true,
'voice' => true,
'document' => true,
'emoji' => true,
'upload_image' => true,
'upload_video' => true,
'upload_file' => true,
'paste_image' => true,
'short_drama' => true,
];
public static function get(string $key, mixed $default = null): mixed
{
$row = SystemSetting::where('setting_key', $key)->find();
@@ -36,18 +50,8 @@ class SettingsService
public static function getFeatures(): array
{
return self::get('features', [
'markdown' => true,
'image' => true,
'video' => true,
'voice' => true,
'document' => true,
'emoji' => true,
'upload_image' => true,
'upload_video' => true,
'upload_file' => true,
'paste_image' => true,
]);
$stored = self::get('features', []);
return array_replace(self::DEFAULT_FEATURES, is_array($stored) ? $stored : []);
}
public static function isFeatureEnabled(string $feature): bool