@@ -254,6 +275,7 @@ $requests_today = $stmt->fetchColumn();
@@ -261,7 +283,7 @@ $requests_today = $stmt->fetchColumn();
@@ -353,13 +375,18 @@ $requests_today = $stmt->fetchColumn();
if (data.success) {
const tbody = document.getElementById('requests-body');
if (data.requests.length === 0) {
- tbody.innerHTML = '
';
} else {
tbody.innerHTML = data.requests.map(req => `
-
| ${req.artist} |
${req.song} |
${req.requester} |
+
+ ${req.source === 'whatsapp'
+ ? ' WhatsApp'
+ : ' Web'}
+ |
${new Date(req.created_at).toLocaleString()} |
${req.status} |
diff --git a/api/chat.php b/api/chat.php
index 38a117d..7f9ebbc 100644
--- a/api/chat.php
+++ b/api/chat.php
@@ -34,6 +34,18 @@ if ($method === 'GET') {
db()->query("DELETE FROM messages WHERE created_at < DATE_SUB(NOW(), INTERVAL 6 HOUR)");
+ // Obtener el Oyente de la Semana (Top 1)
+ $topStmt = db()->query("
+ SELECT requester
+ FROM song_requests
+ WHERE requester IS NOT NULL AND requester != '' AND requester != 'An贸nimo'
+ AND created_at > DATE_SUB(NOW(), INTERVAL 7 DAY)
+ GROUP BY requester
+ ORDER BY COUNT(*) DESC
+ LIMIT 1
+ ");
+ $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->execute();
$messages = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -43,7 +55,11 @@ if ($method === 'GET') {
$msg['level_color'] = '#94a3b8';
$msg['level_emoji'] = '';
- if ($msg['is_fan_of_month']) {
+ if ($msg['username'] === $topRequester) {
+ $msg['level_color'] = '#facc15';
+ $msg['level_emoji'] = '馃憫';
+ $msg['is_top_listener'] = true;
+ } elseif ($msg['is_fan_of_month']) {
$msg['level_color'] = '#facc15';
} elseif ($points >= 2500) {
$msg['level_color'] = '#a855f7';
diff --git a/api/song_requests.php b/api/song_requests.php
index 300a958..2ff6f25 100644
--- a/api/song_requests.php
+++ b/api/song_requests.php
@@ -36,6 +36,7 @@ if ($method === 'POST') {
$artist = trim($_POST['artist'] ?? '');
$song = trim($_POST['song'] ?? '');
$requester = trim($_POST['requester'] ?? 'An贸nimo');
+ $source = trim($_POST['source'] ?? 'web');
if (empty($artist) || empty($song)) {
echo json_encode(['success' => false, 'error' => 'Falta artista o canci贸n']);
@@ -43,8 +44,8 @@ if ($method === 'POST') {
}
try {
- $stmt = $db->prepare("INSERT INTO song_requests (artist, song, requester) VALUES (?, ?, ?)");
- $stmt->execute([$artist, $song, $requester]);
+ $stmt = $db->prepare("INSERT INTO song_requests (artist, song, requester, source) VALUES (?, ?, ?, ?)");
+ $stmt->execute([$artist, $song, $requester, $source]);
// Award points for song request
if ($requester !== 'An贸nimo') {
diff --git a/index.php b/index.php
index a39da0d..7032dd0 100644
--- a/index.php
+++ b/index.php
@@ -1577,6 +1577,51 @@ $twitter_link = "https://twitter.com/";
.chat-msg-item.is-me .chat-msg-time {
text-align: left;
}
+
+ /* Top Listener Banner */
+ .top-listener-banner {
+ background: linear-gradient(135deg, rgba(250, 204, 21, 0.2), rgba(245, 158, 11, 0.3));
+ border: 1px solid rgba(250, 204, 21, 0.4);
+ border-radius: 16px;
+ padding: 10px 15px;
+ margin-bottom: 1.5rem;
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ animation: fadeIn 0.8s ease;
+ position: relative;
+ overflow: hidden;
+ }
+ .top-listener-banner::after {
+ content: "";
+ position: absolute;
+ top: -50%;
+ left: -50%;
+ width: 200%;
+ height: 200%;
+ background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.1), transparent);
+ transform: rotate(25deg);
+ animation: modal-shine 6s infinite;
+ pointer-events: none;
+ }
+ .top-listener-crown {
+ font-size: 1.5rem;
+ color: #facc15;
+ filter: drop-shadow(0 0 5px rgba(250, 204, 21, 0.5));
+ }
+ .top-listener-name {
+ font-weight: 800;
+ color: #fff;
+ font-size: 0.9rem;
+ }
+ .top-listener-label {
+ font-size: 0.65rem;
+ font-weight: 800;
+ color: #facc15;
+ letter-spacing: 1px;
+ text-transform: uppercase;
+ display: block;
+ }
@@ -1623,6 +1668,22 @@ $twitter_link = "https://twitter.com/";
+
+
+
+
+
+
+
+ Oyente de la Semana
+ Cargando...
+
+
+ #1 Ranking
+
+
+
+
@@ -2861,12 +2922,35 @@ $twitter_link = "https://twitter.com/";
btn.innerHTML = ' 隆PEDIDA!';
btn.style.backgroundColor = 'var(--accent-color)';
- confetti({
- particleCount: 50,
- spread: 60,
- origin: { y: 0.8 },
- colors: ['#38bdf8', '#00e676']
- });
+ // Celebration if the user is #1
+ if (result.is_top) {
+ confetti({
+ particleCount: 200,
+ spread: 90,
+ origin: { y: 0.7 },
+ colors: ['#facc15', '#ffffff', '#38bdf8']
+ });
+
+ // Show special shoutout
+ const shoutoutModal = document.getElementById('shoutout-modal');
+ const shoutoutTarget = document.getElementById('shoutout-target');
+ const shoutoutMsg = document.getElementById('shoutout-message');
+
+ shoutoutTarget.innerText = `隆FELICIDADES ${result.top_name.toUpperCase()}!`;
+ shoutoutMsg.innerText = `隆Te has convertido en el Oyente #1 de la Semana! Gracias por tu incre铆ble apoyo a Lili Records Radio. 馃憫馃摶`;
+
+ shoutoutModal.style.display = 'flex';
+ setTimeout(() => shoutoutModal.classList.add('show'), 10);
+
+ fetchTopListener(); // Update banner
+ } else {
+ confetti({
+ particleCount: 50,
+ spread: 60,
+ origin: { y: 0.8 },
+ colors: ['#38bdf8', '#00e676']
+ });
+ }
setTimeout(() => {
btn.disabled = false;
@@ -3026,6 +3110,23 @@ $twitter_link = "https://twitter.com/";
}
}
+ async function fetchTopListener() {
+ try {
+ const response = await fetch('api/get_top_requesters.php');
+ const result = await response.json();
+ if (result.success && result.data && result.data.length > 0) {
+ const top = result.data[0];
+ const section = document.getElementById('top-listener-section');
+ const display = document.getElementById('top-listener-display');
+
+ display.innerHTML = `${top.requester} (${top.total_requests} peticiones)`;
+ section.style.display = 'block';
+ }
+ } catch (error) {
+ console.error('Error fetching top listener:', error);
+ }
+ }
+
// --- Sleep Timer & Upcoming Tracks ---
let sleepTimeout = null;
let sleepInterval = null;
@@ -3527,16 +3628,20 @@ $twitter_link = "https://twitter.com/";
// Update cycles
setInterval(updateMetadata, 30000);
setInterval(fetchTopSongs, 60000);
+ setInterval(fetchTopListener, 60000);
setInterval(fetchGallery, 3000); // Frecuencia aumentada para fotos ef铆meras (5s)
setInterval(fetchLeaderboard, 60000);
setInterval(fetchUpcomingTracks, 30000);
+ setInterval(fetchActivePerks, 30000);
// Initial fetch
updateMetadata();
fetchTopSongs();
+ fetchTopListener();
fetchGallery();
fetchLeaderboard();
fetchUpcomingTracks();
+ fetchActivePerks();
// Theme Toggle Functionality
function toggleTheme() {
|