系统更新页面布局

This commit is contained in:
Wisp X
2022-02-26 17:46:25 +08:00
parent c108e9bc76
commit ebb352782f
14 changed files with 375 additions and 5 deletions
@@ -2,9 +2,11 @@
namespace App\Http\Controllers\Admin;
use App\Enums\ConfigKey;
use App\Http\Controllers\Controller;
use App\Mail\Test;
use App\Models\Config;
use App\Services\UpgradeService;
use App\Utils;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -38,4 +40,34 @@ class SettingController extends Controller
}
return $this->success('发送成功');
}
public function checkUpdate(): Response
{
$version = Utils::config(ConfigKey::AppVersion);
$service = new UpgradeService($version);
$data = [
'is_update' => $service->check(),
];
if ($data['is_update']) {
$data['version'] = $service->getVersions()->first();
}
return $this->success('success', $data);
}
public function upgrade()
{
ignore_user_abort(true);
set_time_limit(0);
$version = Utils::config(ConfigKey::AppVersion);
$service = new UpgradeService($version);
$this->success()->send();
$service->upgrade();
flush();
}
public function upgradeProgress(): Response
{
return $this->success('success', Cache::get('upgrade_progress'));
}
}