up
This commit is contained in:
@@ -238,6 +238,27 @@ class BotService {
|
|||||||
$this->exitMenu($phoneNumber);
|
$this->exitMenu($phoneNumber);
|
||||||
return true;
|
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 'asesor':
|
||||||
case 'ayuda':
|
case 'ayuda':
|
||||||
// Solicitar asesor: marcar solicitud y pausar brevemente (3 minutos)
|
// Solicitar asesor: marcar solicitud y pausar brevemente (3 minutos)
|
||||||
|
|||||||
@@ -243,8 +243,9 @@ class ConversationStateService
|
|||||||
* @param int $menuId
|
* @param int $menuId
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setCurrentMenu(string $phoneNumber, int $menuId): bool
|
public function setCurrentMenu(string $phoneNumber, ?int $menuId): bool
|
||||||
{
|
{
|
||||||
|
// Allow null to clear current_menu_id
|
||||||
return $this->updateStateData($phoneNumber, ['current_menu_id' => $menuId]);
|
return $this->updateStateData($phoneNumber, ['current_menu_id' => $menuId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user