Auto commit: 2026-02-18T23:12:26.737Z

This commit is contained in:
Flatlogic Bot 2026-02-18 23:12:27 +00:00
parent 0d7553ebfc
commit 1840105cf9

View File

@ -60,7 +60,28 @@ if ($method === 'POST') {
}
}
echo json_encode(['success' => true]);
// Check if this user is now the #1 listener of the week
$topStmt = $db->query("
SELECT requester, COUNT(*) as total_requests
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 total_requests DESC
LIMIT 1
");
$topListener = $topStmt->fetch();
$isNewTop = false;
if ($topListener && $topListener['requester'] === $requester) {
$isNewTop = true;
}
echo json_encode([
'success' => true,
'is_top' => $isNewTop,
'top_name' => $topListener['requester'] ?? ''
]);
} catch (Exception $e) {
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}