加入 收中控 回傳控制狀態 20250603
This commit is contained in:
parent
e87b06c669
commit
78772d86a5
@ -300,4 +300,28 @@ class RoomControlController extends Controller
|
|||||||
|
|
||||||
return ApiResponse::success("命令已發送:$command");
|
return ApiResponse::success("命令已發送:$command");
|
||||||
}
|
}
|
||||||
|
public function receiveSwitch(SendRoomSwitchCommandRequest $request): JsonResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
$branch = Branch::where('name',$validated['branch_name'])->first();
|
||||||
|
$room = Room::where([
|
||||||
|
['branch_id', $branch->id],
|
||||||
|
['name', $validated['room_name']],
|
||||||
|
])->first();
|
||||||
|
|
||||||
|
if (!$branch) {
|
||||||
|
return ApiResponse::error('分店不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$room) {
|
||||||
|
return ApiResponse::error('房間不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
$room->status=$validated['command'];
|
||||||
|
$room->started_at=$validated['started_at'];
|
||||||
|
$room->ended_at=$validated['ended_at'];
|
||||||
|
$room->save();
|
||||||
|
|
||||||
|
return ApiResponse::success($room);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ Artisan::command('inspire', function () {
|
|||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
|
|
||||||
Schedule::command('machine_statuses:clear')->dailyAt('12:00'); // 每天凌晨 12:10 執行
|
Schedule::command('app:clear-machine-statuses')->dailyAt('12:00'); // 每天凌晨 12:10 執行
|
||||||
//首次部署或有新增命令時)建立或更新任務排程 Crontab
|
//首次部署或有新增命令時)建立或更新任務排程 Crontab
|
||||||
// 檢查是否已有下列 crontab 設定(crontab -e):
|
// 檢查是否已有下列 crontab 設定(crontab -e):
|
||||||
//分鐘 小時 日 月 星期 指令
|
//分鐘 小時 日 月 星期 指令
|
||||||
|
Loading…
x
Reference in New Issue
Block a user