w
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* API - Obtener usuarios
|
||||
* Fecha: 13 de noviembre de 2025
|
||||
*/
|
||||
|
||||
require_once '../config/config.php';
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: GET');
|
||||
header('Access-Control-Allow-Headers: Content-Type');
|
||||
|
||||
try {
|
||||
$db = Database::getInstance();
|
||||
|
||||
$users = $db->fetchAll(
|
||||
"SELECT
|
||||
u.id,
|
||||
u.phone_number,
|
||||
u.name,
|
||||
u.email,
|
||||
u.status,
|
||||
u.current_menu_id,
|
||||
u.current_step,
|
||||
u.created_at,
|
||||
u.updated_at,
|
||||
m.name as current_menu
|
||||
FROM users u
|
||||
LEFT JOIN menus m ON u.current_menu_id = m.id
|
||||
ORDER BY u.created_at DESC"
|
||||
);
|
||||
|
||||
echo json_encode($users);
|
||||
|
||||
} catch (Exception $e) {
|
||||
error_log("Error in get_users.php: " . $e->getMessage());
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Error interno del servidor']);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user