football analysis

This commit is contained in:
Flatlogic Bot 2025-12-05 15:02:14 +00:00
parent 1d590eb942
commit 9f998b1307
3 changed files with 147 additions and 59 deletions

View File

@ -1,29 +1,101 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&family=Open+Sans&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
:root {
--primary-color: #0d6efd;
--secondary-color: #6c757d;
--light-color: #f8f9fa;
--dark-color: #212529;
--body-gradient-start: #e0e5ff;
--body-gradient-end: #d9e2f3;
--card-bg-color: rgba(255, 255, 255, 0.75);
--card-bg-color-odd: rgba(233, 236, 239, 0.75);
--card-bg-color-even: rgba(204, 219, 255, 0.75);
--card-border-color: rgba(255, 255, 255, 0.2);
--shadow-color: rgba(0, 0, 0, 0.1);
--font-family: 'Poppins', sans-serif;
}
body {
background-color: #f8f9fa;
font-family: 'Open Sans', sans-serif;
font-family: var(--font-family);
background: linear-gradient(135deg, var(--body-gradient-start), var(--body-gradient-end));
color: var(--dark-color);
}
h1, h5 {
font-family: 'Roboto', sans-serif;
header.bg-primary {
background: linear-gradient(135deg, #29375a 0%, #1a233f 100%) !important;
border-bottom: 3px solid var(--primary-color);
}
header h1 {
font-weight: 700;
}
.btn-primary {
background-color: #1a73e8;
border-color: #1a73e8;
}
.btn-primary:hover {
background-color: #1765c4;
border-color: #1765c4;
text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}
.card {
border-radius: 0.5rem;
border: 1px solid var(--card-border-color);
border-radius: 1rem;
box-shadow: 0 8px 32px 0 var(--shadow-color);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
.form-control, .btn {
border-radius: 0.25rem;
#odds-section .card:nth-child(odd) {
background-color: var(--card-bg-color-odd);
}
#odds-section .card:nth-child(even) {
background-color: var(--card-bg-color-even);
}
.card-header {
background-color: rgba(255, 255, 255, 0.5);
border-bottom: 1px solid var(--card-border-color);
font-weight: 600 !important;
}
.btn-primary {
background-color: var(--primary-color);
border: none;
border-radius: 0.5rem;
font-weight: 600;
transition: all 0.3s ease;
box-shadow: 0 4px 15px 0 rgba(13, 110, 253, 0.4);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px 0 rgba(13, 110, 253, 0.5);
}
.table {
background-color: transparent;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
background-color: rgba(0, 0, 0, 0.03);
}
.table-light > thead > tr > th {
background-color: rgba(255,255,255,0.4);
font-weight: 600;
color: var(--dark-color);
}
.badge.bg-secondary {
background-color: #4a5568 !important;
font-size: 0.9em;
padding: 0.5em 0.8em;
}
footer.bg-light {
background-color: #29375a !important;
color: var(--light-color);
padding-top: 1.5rem !important;
padding-bottom: 1.5rem !important;
margin-top: 3rem;
}
footer p {
color: #a0aec0;
}

View File

@ -1,5 +1,5 @@
<?php
function get_odds($sport = 'soccer_epl', $regions = 'uk', $markets = 'h2h') {
function get_odds($sport = 'soccer_epl', $regions = 'uk,eu', $markets = 'h2h') {
$apiKey = '308deae256c9099c52e22bb4933a12b6';
$url = "https://api.the-odds-api.com/v4/sports/{$sport}/odds/?regions={$regions}&markets={$markets}&apiKey={$apiKey}";

View File

@ -40,35 +40,42 @@
</div>
<div class="card shadow-sm mt-4">
<div class="card-body">
<div class="card-body" id="odds-section">
<h5 class="card-title">Próximas Partidas e Odds (Premier League)</h5>
<?php
require_once 'includes/odds_api.php';
$odds_data = get_odds('soccer_epl', 'uk', 'h2h');
if ($odds_data && !empty($odds_data)) {
// Set timezone to Brazil
date_default_timezone_set('America/Sao_Paulo');
foreach ($odds_data as $match) {
$match_time = strtotime($match['commence_time']);
?>
<table class="table table-striped">
<thead>
<div class="card mb-3">
<div class="card-header fw-bold">
<?php echo htmlspecialchars($match['home_team']) . ' vs ' . htmlspecialchars($match['away_team']); ?>
<span class="float-end badge bg-secondary"><?php echo date('d/m/Y H:i', $match_time); ?></span>
</div>
<div class="card-body p-0">
<table class="table table-striped table-sm mb-0">
<thead class="table-light">
<tr>
<th>Partida</th>
<th>Casa</th>
<th>Empate</th>
<th>Fora</th>
<th>Casa de Apostas</th>
<th class="text-center">1 (Casa)</th>
<th class="text-center">X (Empate)</th>
<th class="text-center">2 (Fora)</th>
</tr>
</thead>
<tbody>
<?php foreach ($odds_data as $match): ?>
<tr>
<td><?php echo htmlspecialchars($match['home_team']) . ' vs ' . htmlspecialchars($match['away_team']); ?></td>
<?php
if (!empty($match['bookmakers'])) {
foreach ($match['bookmakers'] as $bookmaker) {
$home_odd = 'N/A';
$draw_odd = 'N/A';
$away_odd = 'N/A';
// Find the bookmaker (assuming there is at least one)
if (!empty($match['bookmakers'])) {
$bookmaker = $match['bookmakers'][0]; // Take the first bookmaker
foreach ($bookmaker['markets'] as $market) {
if ($market['key'] === 'h2h') {
foreach ($market['outcomes'] as $outcome) {
@ -82,16 +89,25 @@
}
}
}
?>
<tr>
<td><?php echo htmlspecialchars($bookmaker['title']); ?></td>
<td class="text-center"><?php echo $home_odd; ?></td>
<td class="text-center"><?php echo $draw_odd; ?></td>
<td class="text-center"><?php echo $away_odd; ?></td>
</tr>
<?php
}
} else {
echo '<tr><td colspan="4" class="text-center">Nenhuma casa de aposta disponível para esta partida.</td></tr>';
}
?>
<td><?php echo $home_odd; ?></td>
<td><?php echo $draw_odd; ?></td>
<td><?php echo $away_odd; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<?php
}
} else {
echo '<div class="alert alert-warning" role="alert">Não foi possível buscar as odds no momento. Verifique sua chave de API ou tente novamente mais tarde.</div>';
}