diff --git a/publi.html b/publi.html index 31604d2..5ca9a6a 100644 --- a/publi.html +++ b/publi.html @@ -1,32 +1,133 @@ -// ========================================== -// 馃幆 RUTA PARA CUANDO EL CLIENTE PULSA "ME INTERESA" EN PUBLICIDAD -// ========================================== -app.post("/public/portal/:token/interest", async (req, res) => { - try { - const { token } = req.params; + + + + + + Promoci贸n Especial + + + + + - // 1. Buscamos qui茅n es el cliente usando su token - const clientQ = await pool.query("SELECT owner_id, full_name, phone FROM clients WHERE portal_token = $1 LIMIT 1", [token]); - if (clientQ.rowCount === 0) return res.status(404).json({ ok: false, error: "Token inv谩lido" }); +
+
+
+ +
+

Cargando promoci贸n...

+
- const client = clientQ.rows[0]; - const ownerId = client.owner_id; +
+ + - // 2. Buscamos el tel茅fono del administrador (t煤) para avisarte - const ownerQ = await pool.query("SELECT phone FROM users WHERE id = $1", [ownerId]); - if (ownerQ.rowCount === 0) return res.status(404).json({ ok: false, error: "Empresa no encontrada" }); +
+
+ + +
+
- const adminPhone = ownerQ.rows[0].phone; +
+

驴Te interesa esta promoci贸n?

+

Pulsa el bot贸n y nos pondremos en contacto contigo para darte todos los detalles sin ning煤n compromiso.

+
- // 3. Montamos el mensaje de WhatsApp para el jefe - const msgWa = `馃帀 *隆NUEVO LEAD DE PUBLICIDAD!* 馃帀\n\nEl cliente *${client.full_name}* ha pulsado el bot贸n "Me interesa" en el banner de publicidad de su portal web.\n\n馃摓 *Tel茅fono:* ${client.phone}\n\n隆Ll谩male cuanto antes para informarle!`; + - // 4. Enviamos el mensaje - await sendWhatsAppAuto(adminPhone, msgWa, `cliente_${ownerId}`, false); + - res.json({ ok: true }); - } catch (e) { - console.error("Error al registrar inter茅s en publicidad:", e); - res.status(500).json({ ok: false }); - } -}); \ No newline at end of file +
+ + + + \ No newline at end of file