This commit is contained in:
Wisp X 2022-03-23 17:27:51 +08:00
parent 979b628f59
commit df2ed46ab2
3 changed files with 74 additions and 71 deletions

View File

@ -4,6 +4,7 @@ namespace App\Models;
use App\Enums\ConfigKey;
use App\Enums\ImagePermission;
use App\Enums\PastedAction;
use App\Enums\UserConfigKey;
use App\Utils;
use Carbon\Carbon;
@ -100,13 +101,7 @@ class User extends Authenticatable implements MustVerifyEmail
$user->group_id = Group::query()->where('is_default', true)->value('id');
// 初始容量
$user->capacity = Utils::config(ConfigKey::UserInitialCapacity);
$user->configs = collect([
UserConfigKey::DefaultAlbum => 0,
UserConfigKey::DefaultStrategy => 0,
UserConfigKey::DefaultPermission => ImagePermission::Private,
UserConfigKey::IsAutoClearPreview => false,
])->merge($user->configs ?: []);
$user->configs = collect(config('convention.app.user'))->merge($user->configs ?: []);
});
}

View File

@ -4,9 +4,12 @@
use App\Enums\ConfigKey;
use App\Enums\GroupConfigKey;
use App\Enums\ImagePermission;
use App\Enums\Mail\SmtpOption;
use App\Enums\PastedAction;
use App\Enums\Scan\AliyunOption;
use App\Enums\Scan\TencentOption;
use App\Enums\UserConfigKey;
use App\Enums\Watermark\FontOption;
use App\Enums\Watermark\ImageOption;
@ -38,7 +41,8 @@ return [
]
],
],
ConfigKey::Group => [
],
'group' => [
GroupConfigKey::MaximumFileSize => 5120,
GroupConfigKey::ConcurrentUploadNum => 3,
GroupConfigKey::IsEnableScan => 0,
@ -99,5 +103,11 @@ return [
GroupConfigKey::FileNamingRule => '{uniqid}',
GroupConfigKey::ImageCacheTtl => 2626560,
],
],
'user' => [
UserConfigKey::DefaultAlbum => 0,
UserConfigKey::DefaultStrategy => 0,
UserConfigKey::DefaultPermission => ImagePermission::Private,
UserConfigKey::PastedAction => PastedAction::Waiting,
UserConfigKey::IsAutoClearPreview => false,
]
];

View File

@ -19,9 +19,7 @@ class InstallSeeder extends Seeder
public function run()
{
$date = Carbon::now()->format('Y-m-d H:i:s');
$array = collect(config('convention.app'))->except([
ConfigKey::Group,
])->transform(function ($value, $key) use ($date) {
$array = collect(config('convention.app'))->transform(function ($value, $key) use ($date) {
return [
'name' => $key,
'value' => is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value,