diff --git a/app/Services/UpgradeService.php b/app/Services/UpgradeService.php index 3a6e3c87..e167e244 100644 --- a/app/Services/UpgradeService.php +++ b/app/Services/UpgradeService.php @@ -115,13 +115,9 @@ class UpgradeService $version = $this->getVersions()->first()['name']; Config::query()->where('name', ConfigKey::AppVersion)->update(['value' => $version]); // 执行数据库迁移 - Artisan::call('migrate'); - // 清除配置缓存 - Cache::forget('configs'); + Artisan::call('migrate', ['--seed' => true]); // 清除缓存 - Artisan::call('route:clear'); - Artisan::call('cache:clear'); - Artisan::call('view:clear'); + Artisan::call('optimize:clear'); Artisan::call('package:discover'); } catch (\Throwable $e) { Utils::e($e, '升级失败'); diff --git a/config/convention.php b/config/convention.php index ef6934e6..c57f0201 100644 --- a/config/convention.php +++ b/config/convention.php @@ -18,7 +18,7 @@ use App\Enums\Watermark\Mode; return [ 'app' => [ ConfigKey::AppName => 'Lsky Pro', - ConfigKey::AppVersion => 'V 2.0.5', + ConfigKey::AppVersion => 'V 2.1', ConfigKey::SiteKeywords => 'Lsky Pro,lsky,兰空图床', ConfigKey::SiteDescription => 'Lsky Pro, Your photo album on the cloud.', ConfigKey::SiteNotice => '', diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 3a805b4a..57433d06 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,6 +2,7 @@ namespace Database\Seeders; +use App\Models\Config; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder @@ -13,6 +14,10 @@ class DatabaseSeeder extends Seeder */ public function run() { - // $this->call([]); + // 初始化系统默认配置 + foreach (config('convention.app') as $key => $value) { + $content = is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value; + Config::query()->firstOrCreate(['name' => $key], ['value' => $content]); + } } }