This commit is contained in:
Lizandro Guarnizo
2026-01-24 02:02:10 -05:00
parent d5ff1f2df9
commit ab7299db2c
2 changed files with 23 additions and 1 deletions
+21
View File
@@ -237,6 +237,27 @@ class BotService {
case 'cancelar':
$this->exitMenu($phoneNumber);
return true;
case 'atras':
case 'atrás':
case 'volver':
case 'back':
try { error_log("[BotService] processSpecialCommands - detected BACK command in global handler for phone={$phoneNumber}"); } catch (Throwable $t) {}
// Resolver current_menu_id desde users y decidir la acción más adecuada
try {
$cur = $this->db->fetch("SELECT current_menu_id FROM users WHERE phone_number = :phone", ['phone' => $phoneNumber]);
$currentMenuId = $cur ? $cur['current_menu_id'] : null;
} catch (Exception $e) {
$currentMenuId = null;
}
if (!empty($currentMenuId)) {
$this->goToParentMenu($phoneNumber, $currentMenuId);
} else {
// Intentar usar historial
$this->goToPreviousMenu($phoneNumber);
}
return true;
case 'asesor':
case 'ayuda':