function getOddsFlow(fixtureId, thn, tan) { getData('fixtures/' + fixtureId + '/analysis/odds/flow', null, (data) => { // console.log(data); if (!data?.odds?.length) { return; } const strSplit = (string, length = 1) => { return [...string].map((_, i) => string.slice(i, i + length)).filter(Boolean); } const teams = { 'home': [], 'away': [] }; const teamTypes = ['home', 'away']; for (const k in data.odds) { const o = data.odds[k]; if (!teams[o.team][o.half]) { teams[o.team][o.half] = []; } teams[o.team][o.half].push(o); if (o.name.trim() === "6นัดหลังสุด") { o.last6_hc = strSplit(o.win); o.last6_ou = strSplit(o.over); } } html = ``; html += `
${thn} | `; } else { html += `${tan} | `; } html += `||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
`; html += ` | แฮนดิแคปเอเชีย | `; html += `สูง/ต่ำ | `; html += `|||||||||||||||||||
`; html += ` | แข่ง | `; html += `W | `; html += `D | `; html += `L | `; html += `ชนะ% | `; html += `O | `; html += `สูง% | `; html += `U | `; html += `ต่ำ% | `; html += `||||||||||||
${o.name} | `; html += `${o.play} | `; if (o.last6_hc) { html += ``;
html += ` `;
for (const kk in o.last6_hc) {
const hc = o.last6_hc[kk];
if (hc && hc.trim()) {
html += `${hc}`;
}
}
html += ` `;
html += ` | `;
} else {
html += `${o.win} | `; html += `${o.draw} | `; html += `${o.lose} | `; } html += `${o.win_rate} | `; if (o.last6_ou) { html += ``;
html += ` `;
for (const kk in o.last6_ou) {
const ou = o.last6_ou[kk];
if (ou && ou.trim()) {
html += `${ou}`;
}
}
html += ` `;
html += ` | `;
} else {
html += `${o.over} | `; html += `${o.over_rate} | `; html += `${o.under} | `; html += `${o.under_rate} | `; } html += `||||||||||
ครึ่ง | `; html += `|||||||||||||||||||||
${o.name} | `; html += `${o.play} | `; if (o.last6_hc) { html += ``;
html += ` `;
for (const kk in o.last6_hc) {
const hc = o.last6_hc[kk];
if (hc && hc.trim()) {
html += `${hc}`;
}
}
html += ` `;
html += ` | `;
} else {
html += `${o.win} | `; html += `${o.draw} | `; html += `${o.lose} | `; } html += `${o.win_rate} | `; if (o.last6_ou) { html += ``;
html += ` `;
for (const kk in o.last6_ou) {
const ou = o.last6_ou[kk];
if (ou && ou.trim()) {
html += `${ou}`;
}
}
html += ` `;
html += ` | `;
} else {
html += `${o.over} | `; html += `${o.over_rate} | `; html += `${o.under} | `; html += `${o.under_rate} | `; } html += `