|
9 | 9 | class PostProxyController extends Controller |
10 | 10 | { |
11 | 11 |
|
12 | | - public function index(): JsonResponse |
| 12 | + public function index($area): JsonResponse |
13 | 13 | { |
14 | | - // Simulación de datos de prueba |
15 | | - return response()->json([ |
16 | | - 'queue' => rand(4, 10), |
17 | | - 'available' => rand(2, 6), |
18 | | - 'onCall' => rand(1, 4), |
19 | | - 'paused' => rand(0, 3), |
20 | | - ]); |
| 14 | + $response = Http::get("http://10.57.251.181:3003/area/{$area}/estado"); |
| 15 | + if (!$response->successful()) { |
| 16 | + return response()->json(['error' => 'No se pudo obtener los datos'], 500); |
| 17 | + } |
| 18 | + |
| 19 | + $data = $response->json(); |
| 20 | + |
| 21 | + return response()->json($data); |
21 | 22 | } |
22 | 23 |
|
23 | 24 | public function usersTable($area): JsonResponse |
@@ -59,16 +60,16 @@ public function usersTable($area): JsonResponse |
59 | 60 | return response()->json($data); |
60 | 61 | } |
61 | 62 |
|
62 | | - private function randomTimeBetween(int $minSeconds, int $maxSeconds): string |
63 | | - { |
64 | | - $seconds = rand($minSeconds, $maxSeconds); |
65 | | - return gmdate("H:i:s", $seconds); |
66 | | - } |
| 63 | + // private function randomTimeBetween(int $minSeconds, int $maxSeconds): string |
| 64 | + // { |
| 65 | + // $seconds = rand($minSeconds, $maxSeconds); |
| 66 | + // return gmdate("H:i:s", $seconds); |
| 67 | + // } |
67 | 68 |
|
68 | 69 |
|
69 | 70 | public function getOverview() |
70 | 71 | { |
71 | | - $response = Http::get('http://10.57.251.181:3001/extensions/overview'); |
| 72 | + $response = Http::get('http://10.57.251.181:3004/extensions/overview'); |
72 | 73 |
|
73 | 74 | if (!$response->successful()) { |
74 | 75 | return response()->json(['error' => 'No se pudo obtener los datos'], 500); |
|
0 commit comments