Skip to content

Commit c560a39

Browse files
authored
Merge pull request #1 from chechojgb/tableAgent
Add: agregar apis - funcionamiento tableAgents
2 parents 777e4f9 + f2d00c8 commit c560a39

File tree

12 files changed

+8241
-7871
lines changed

12 files changed

+8241
-7871
lines changed

app/Http/Controllers/PostProxyController.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
class PostProxyController extends Controller
1010
{
1111

12-
public function index(): JsonResponse
12+
public function index($area): JsonResponse
1313
{
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);
2122
}
2223

2324
public function usersTable($area): JsonResponse
@@ -59,16 +60,16 @@ public function usersTable($area): JsonResponse
5960
return response()->json($data);
6061
}
6162

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+
// }
6768

6869

6970
public function getOverview()
7071
{
71-
$response = Http::get('http://10.57.251.181:3001/extensions/overview');
72+
$response = Http::get('http://10.57.251.181:3004/extensions/overview');
7273

7374
if (!$response->successful()) {
7475
return response()->json(['error' => 'No se pudo obtener los datos'], 500);

0 commit comments

Comments
 (0)