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 += `
`; html += `

ราคาบอลไหลแฮนดิแคปเอเชีย

`; html += `
`; for (const i in teamTypes) { const team = teamTypes[i]; const os = teams[team]; html += `
`; html += ``; html += ``; html += ``; if (team == 'home') { html += ``; } else { html += ``; } html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; html += ``; for (const k in os[0]) { const o = os[0][k]; html += ``; html += ``; html += ``; if (o.last6_hc) { html += ``; } else { html += ``; html += ``; html += ``; } html += ``; if (o.last6_ou) { html += ``; } else { html += ``; html += ``; html += ``; html += ``; } html += ``; } html += ``; html += ``; html += ``; for (const k in os[1]) { const o = os[1][k]; html += ``; html += ``; html += ``; if (o.last6_hc) { html += ``; } else { html += ``; html += ``; html += ``; } html += ``; if (o.last6_ou) { html += ``; } else { html += ``; html += ``; html += ``; html += ``; } html += ``; } html += ``; html += `
${thn}${tan}
แฮนดิแคปเอเชียสูง/ต่ำ
แข่งWDLชนะ%Oสูง%Uต่ำ%
${o.name}${o.play}`; html += `
`; for (const kk in o.last6_hc) { const hc = o.last6_hc[kk]; if (hc && hc.trim()) { html += `${hc}`; } } html += `
`; html += `
${o.win}${o.draw}${o.lose}${o.win_rate}`; html += `
`; for (const kk in o.last6_ou) { const ou = o.last6_ou[kk]; if (ou && ou.trim()) { html += `${ou}`; } } html += `
`; html += `
${o.over}${o.over_rate}${o.under}${o.under_rate}
ครึ่ง
${o.name}${o.play}`; html += `
`; for (const kk in o.last6_hc) { const hc = o.last6_hc[kk]; if (hc && hc.trim()) { html += `${hc}`; } } html += `
`; html += `
${o.win}${o.draw}${o.lose}${o.win_rate}`; html += `
`; for (const kk in o.last6_ou) { const ou = o.last6_ou[kk]; if (ou && ou.trim()) { html += `${ou}`; } } html += `
`; html += `
${o.over}${o.over_rate}${o.under}${o.under_rate}
`; html += `
`; } html += `
`; html += `
`; $('#lastOddsFlowSection').html(html); }, (error) => { console.log(error); }); }