修正 心跳封包 問題 20250704
This commit is contained in:
parent
0d5f78236b
commit
9f0b6741c2
@ -169,12 +169,11 @@ class RoomControlController extends Controller
|
|||||||
|
|
||||||
if ($room->exists && $room->internal_ip !== $validated['ip']) {
|
if ($room->exists && $room->internal_ip !== $validated['ip']) {
|
||||||
$validated['status'] = 'error';
|
$validated['status'] = 'error';
|
||||||
$room->internal_ip = $validated['ip'];
|
|
||||||
} else {
|
} else {
|
||||||
$validated['status'] = 'online';
|
$validated['status'] = 'online';
|
||||||
$room->internal_ip ??= $validated['ip']; // 新的話補上
|
|
||||||
}
|
}
|
||||||
|
$room->internal_ip = $validated['ip'];
|
||||||
|
$room->port = 1000;
|
||||||
$room->is_online=1;
|
$room->is_online=1;
|
||||||
$room->touch(); // 更新 updated_at
|
$room->touch(); // 更新 updated_at
|
||||||
$room->save();
|
$room->save();
|
||||||
|
@ -22,8 +22,6 @@ class ReceiveRoomRegisterRequest extends ApiRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'room_name' => 'nullable|string',
|
|
||||||
'room_ip' => 'nullable|string',
|
|
||||||
'email' => 'required|email',
|
'email' => 'required|email',
|
||||||
'password' => 'required',
|
'password' => 'required',
|
||||||
];
|
];
|
||||||
|
@ -24,6 +24,8 @@ return new class extends Migration
|
|||||||
$table->dateTime('started_at')->nullable()->comment('開始時間'); //
|
$table->dateTime('started_at')->nullable()->comment('開始時間'); //
|
||||||
$table->dateTime('ended_at')->nullable()->comment('結束時間'); //
|
$table->dateTime('ended_at')->nullable()->comment('結束時間'); //
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
// 👇 複合唯一鍵(分店 + 樓層 + 類型 + 包廂名稱)
|
||||||
|
$table->unique(['branch_id', 'floor', 'type', 'name'], 'unique_room_name_per_branch_floor_type');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user