feat: add one-click update feature to admin panel

This commit is contained in:
xboard
2025-02-09 13:43:09 +08:00
parent 1b728fffc7
commit 39456923d3
15 changed files with 660 additions and 100 deletions
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers\V2\Admin;
use App\Http\Controllers\Controller;
use App\Services\UpdateService;
use Illuminate\Http\Request;
class UpdateController extends Controller
{
protected $updateService;
public function __construct(UpdateService $updateService)
{
$this->updateService = $updateService;
}
public function checkUpdate()
{
return $this->success($this->updateService->checkForUpdates());
}
public function executeUpdate()
{
$result = $this->updateService->executeUpdate();
return $result['success'] ? $this->success($result) : $this->fail([500, $result['message']]);
}
}
+9
View File
@@ -16,6 +16,7 @@ use App\Http\Controllers\V2\Admin\KnowledgeController;
use App\Http\Controllers\V2\Admin\PaymentController;
use App\Http\Controllers\V2\Admin\SystemController;
use App\Http\Controllers\V2\Admin\ThemeController;
use App\Http\Controllers\V2\Admin\UpdateController;
use Illuminate\Contracts\Routing\Registrar;
use Illuminate\Support\Facades\Route;
@@ -194,6 +195,14 @@ class AdminRoute
$router->get('/getSystemLog', [SystemController::class, 'getSystemLog']);
});
// Update
$router->group([
'prefix' => 'update'
], function ($router) {
$router->get('/check', [UpdateController::class, 'checkUpdate']);
$router->post('/execute', [UpdateController::class, 'executeUpdate']);
});
// Theme
$router->group([
'prefix' => 'theme'