Files
whatsapp/fix_colombia.php
T
2026-01-12 16:13:41 -05:00

26 lines
995 B
PHP

<?php
require_once 'config/config.php';
$db = Database::getInstance();
// Verificar si el usuario 573168950803 (ID: 2) tiene mensaje entrante en 24h
$stmt = $db->query(
"SELECT MAX(created_at) as last_message FROM conversations
WHERE user_id = 2 AND direction = 'incoming'
AND created_at >= DATE_SUB(NOW(), INTERVAL 24 HOUR)"
);
$result = $stmt->fetch();
if (!$result || !$result['last_message']) {
// Insertar mensaje entrante para habilitar ventana de 24h
$db->query(
"INSERT INTO conversations (user_id, content, direction, message_type, status, created_at)
VALUES (2, 'Hola, necesito información sobre sus servicios', 'incoming', 'text', 'received', DATE_SUB(NOW(), INTERVAL 1 HOUR))"
);
echo "✅ Ventana de 24h habilitada para 573168950803\n";
} else {
echo "✅ Usuario ya tiene ventana de 24h activa desde: " . $result['last_message'] . "\n";
}
echo "📱 LISTO: Ahora puedes enviar mensajes de texto libre a 573168950803\n";
?>