From c3d9e7fcf27f8e98a4d35ab1164961fbc3ed5e17 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Thu, 19 Feb 2026 19:49:57 +0000 Subject: [PATCH] Auto commit: 2026-02-19T19:49:57.800Z --- api/chat.php | 7 ++++++- api/get_online_users.php | 1 + api/thank_tip.php | 10 ++++++++++ index.php | 17 ++++++++++++----- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/api/chat.php b/api/chat.php index 624c1da..18e88d9 100644 --- a/api/chat.php +++ b/api/chat.php @@ -46,12 +46,13 @@ if ($method === 'GET') { "); $topRequester = $topStmt->fetchColumn(); - $stmt = db()->prepare("SELECT m.*, f.points, f.is_fan_of_month FROM messages m LEFT JOIN fans f ON m.username = f.name ORDER BY m.created_at DESC LIMIT 50"); + $stmt = db()->prepare("SELECT m.*, f.points, f.loyalty_points, f.is_fan_of_month FROM messages m LEFT JOIN fans f ON m.username = f.name ORDER BY m.created_at DESC LIMIT 50"); $stmt->execute(); $messages = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach ($messages as &$msg) { $points = $msg['points'] ?? 0; + $loyalty = $msg['loyalty_points'] ?? 0; $msg['level_color'] = '#94a3b8'; $msg['level_emoji'] = ''; @@ -62,6 +63,10 @@ if ($method === 'GET') { $msg['level_color'] = '#facc15'; $msg['level_emoji'] = '👑'; $msg['is_top_listener'] = true; + } elseif ($loyalty > 0) { + $msg['level_color'] = '#00e676'; // Neon Green for Loyalty + $msg['level_emoji'] = $loyalty >= 500 ? '🎖️' : '🏅'; + $msg['is_loyal'] = true; } elseif ($msg['is_fan_of_month']) { $msg['level_color'] = '#facc15'; } elseif ($points >= 2500) { diff --git a/api/get_online_users.php b/api/get_online_users.php index 613a75c..28b199b 100644 --- a/api/get_online_users.php +++ b/api/get_online_users.php @@ -12,6 +12,7 @@ $stmt = $db->prepare(" v.country_code, v.last_activity, f.points, + f.loyalty_points, f.is_fan_of_month FROM visitor_logs v LEFT JOIN fans f ON v.username = f.name diff --git a/api/thank_tip.php b/api/thank_tip.php index 69620f7..03d91c0 100644 --- a/api/thank_tip.php +++ b/api/thank_tip.php @@ -15,6 +15,16 @@ try { $stmt = $pdo->prepare("UPDATE dj_tips SET thanked_at = NOW() WHERE id = ?"); $stmt->execute([$tipId]); + // Award loyalty points to the sender + $stmt = $pdo->prepare("SELECT sender_name FROM dj_tips WHERE id = ?"); + $stmt->execute([$tipId]); + $sender = $stmt->fetchColumn(); + + if ($sender) { + $stmt = $pdo->prepare("UPDATE fans SET loyalty_points = loyalty_points + 50 WHERE name = ?"); + $stmt->execute([$sender]); + } + echo json_encode([ "success" => true, "message" => "¡Has agradecido la donación!" diff --git a/index.php b/index.php index 8f209a4..f768bcf 100644 --- a/index.php +++ b/index.php @@ -2603,12 +2603,13 @@ $twitter_link = "https://twitter.com/"; const isVeryActive = (new Date() - new Date(user.last_activity)) < 60000; const flagUrl = user.country_code ? `https://flagcdn.com/w20/${user.country_code.toLowerCase()}.png` : null; const isTopFan = user.points > 10 || user.is_fan_of_month == 1; - const userColor = getUserColor(user.username); + const isLoyal = user.loyalty_points > 0; + const userColor = isLoyal ? "#00e676" : getUserColor(user.username); return ` -
+
-
+
${user.username.charAt(0).toUpperCase()} ${isVeryActive ? '' : ''}
@@ -2616,7 +2617,8 @@ $twitter_link = "https://twitter.com/";
${user.username} ${flagUrl ? `` : ''} - ${isTopFan ? `TOP` : ''} + ${isLoyal ? ` LEAL` : ""} + ${isTopFan && !isLoyal ? `TOP` : ''}
${timeAgo(user.last_activity)} @@ -2836,8 +2838,13 @@ $twitter_link = "https://twitter.com/"; } // Si el color es el gris por defecto (#94a3b8) o no tiene, usamos el color dinámico por nombre - const nameColor = (msg.level_color && msg.level_color !== '#94a3b8') ? msg.level_color : getUserColor(msg.username); + let nameColor = (msg.level_color && msg.level_color !== '#94a3b8') ? msg.level_color : getUserColor(msg.username); const levelEmoji = msg.level_emoji || ''; + + if (msg.is_loyal) { + div.style.borderLeft = "4px solid #00e676"; + div.style.background = "rgba(0, 230, 118, 0.05)"; + } if (isLike) { div.style.background = isMe ? 'rgba(255, 68, 68, 0.25)' : 'rgba(255, 68, 68, 0.15)';