Deploy: 2026-08-01 22:46:18
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../app/bootstrap.php';
|
||||||
|
|
||||||
|
use App\Core\Env;
|
||||||
|
use App\Core\Cache;
|
||||||
|
use App\Models\WhatsAppSession;
|
||||||
|
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
|
$companyId = isset($_GET['company_id']) ? (int)$_GET['company_id'] : 1;
|
||||||
|
|
||||||
|
// Test 1: Get connected sessions via Cache
|
||||||
|
$connectedSessions = WhatsAppSession::getConnectedSessionsForCompany($companyId);
|
||||||
|
|
||||||
|
// Test 2: Perform 5 consecutive Round-Robin selections
|
||||||
|
$selections = [];
|
||||||
|
for ($i = 1; $i <= 5; $i++) {
|
||||||
|
$session = WhatsAppSession::getRoundRobinSession($companyId);
|
||||||
|
$selections[] = [
|
||||||
|
'step' => $i,
|
||||||
|
'session_id' => $session['id'] ?? null,
|
||||||
|
'session_key' => $session['session_key'] ?? null,
|
||||||
|
'name' => $session['name'] ?? null,
|
||||||
|
'phone' => $session['phone'] ?? null,
|
||||||
|
'status' => $session['status'] ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode([
|
||||||
|
'status' => 'success',
|
||||||
|
'redis_enabled' => Env::get('REDIS_ENABLED', false),
|
||||||
|
'company_id' => $companyId,
|
||||||
|
'total_connected_sessions' => count($connectedSessions),
|
||||||
|
'connected_sessions' => array_map(function($s) {
|
||||||
|
return [
|
||||||
|
'id' => $s['id'],
|
||||||
|
'session_key' => $s['session_key'],
|
||||||
|
'name' => $s['name'],
|
||||||
|
'status' => $s['status']
|
||||||
|
];
|
||||||
|
}, $connectedSessions),
|
||||||
|
'round_robin_test_selections' => $selections
|
||||||
|
], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||||
Reference in New Issue
Block a user