funcional
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
require_once 'config/config.php';
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
echo "=== ESTRUCTURA TABLA CONVERSATIONS ===\n";
|
||||
|
||||
$result = $db->query("DESCRIBE conversations");
|
||||
while($row = $result->fetch()) {
|
||||
echo $row['Field'] . " - " . $row['Type'] . "\n";
|
||||
}
|
||||
|
||||
echo "\n=== CONSULTA VENTANA 24H PARA USER_ID=2 ===\n";
|
||||
$stmt = $db->query(
|
||||
"SELECT id, content, direction, created_at FROM conversations
|
||||
WHERE user_id = 2 AND direction = 'incoming'
|
||||
ORDER BY created_at DESC LIMIT 5"
|
||||
);
|
||||
|
||||
$messages = $stmt->fetchAll();
|
||||
if ($messages) {
|
||||
foreach ($messages as $msg) {
|
||||
echo "ID: {$msg['id']}, Contenido: {$msg['content']}, Fecha: {$msg['created_at']}\n";
|
||||
}
|
||||
} else {
|
||||
echo "No hay mensajes entrantes para user_id=2\n";
|
||||
|
||||
// Insertar mensaje simple
|
||||
echo "\nInsertando mensaje entrante...\n";
|
||||
$db->query(
|
||||
"INSERT INTO conversations (user_id, content, direction, message_type, status)
|
||||
VALUES (2, 'Mensaje de prueba', 'incoming', 'text', 'received')"
|
||||
);
|
||||
echo "✅ Mensaje insertado correctamente\n";
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "Error: " . $e->getMessage() . "\n";
|
||||
echo "Trace: " . $e->getTraceAsString() . "\n";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user