Skip to content

Commit bdd7820

Browse files
author
xboard
committed
feat(admin): batch node-machine binding & frontend update
1 parent 1603359 commit bdd7820

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

app/Http/Controllers/V2/Admin/Server/ManageController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ public function batchUpdate(Request $request)
226226
'ids.*' => 'integer',
227227
'show' => 'nullable|integer|in:0,1',
228228
'enabled' => 'nullable|boolean',
229+
'machine_id' => 'nullable|integer',
229230
]);
230231

231232
$ids = $params['ids'];
@@ -240,6 +241,9 @@ public function batchUpdate(Request $request)
240241
if (array_key_exists('enabled', $params) && $params['enabled'] !== null) {
241242
$update['enabled'] = (bool) $params['enabled'];
242243
}
244+
if (array_key_exists('machine_id', $params)) {
245+
$update['machine_id'] = $params['machine_id'] ?: null;
246+
}
243247

244248
if (empty($update)) {
245249
return $this->fail([400, '没有可更新的字段']);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
public function up(): void
9+
{
10+
Schema::table('v2_server', function (Blueprint $table) {
11+
$table->boolean('enabled')->nullable()->default(true)->change();
12+
});
13+
}
14+
15+
public function down(): void
16+
{
17+
Schema::table('v2_server', function (Blueprint $table) {
18+
$table->boolean('enabled')->default(true)->change();
19+
});
20+
}
21+
};

0 commit comments

Comments
 (0)