diff --git a/app/Actions/BettypUserGenerator.php b/app/Actions/BettypUserGenerator.php index ca2b3dc1..6516a445 100644 --- a/app/Actions/BettypUserGenerator.php +++ b/app/Actions/BettypUserGenerator.php @@ -16,13 +16,11 @@ class BettypUserGenerator foreach ($multilines as $multiline) { - BettypeUser::firstOrCreate( - [ - 'user_id' => $user_id, - 'sport_id' => $multiline->sport_id, - 'multiline_setting_id' => $multiline->id, - 'is_active' => in_array($multiline->id, [1, 8, 12, 15]) ? 1 : 0, - ] + $is_active = in_array($multiline->id, [1, 6, 7, 10, 8, 12, 15, 16, 17]) ? 1 : 0; + + BettypeUser::updateOrCreate( + ['user_id' => (int) $user_id, 'multiline_setting_id' => (int) $multiline->id, 'sport_id' => (int) $multiline->sport_id], + ['is_active' => (int) $is_active] ); } diff --git a/app/Console/Commands/Grapper/Magloo/Odds.php b/app/Console/Commands/Grapper/Magloo/Odds.php index c3ce9460..39cbd184 100644 --- a/app/Console/Commands/Grapper/Magloo/Odds.php +++ b/app/Console/Commands/Grapper/Magloo/Odds.php @@ -12,8 +12,8 @@ use App\Models\Event; use App\Models\EventBookmaker; use App\Models\Odds3way; use App\Models\OddsDc; -use App\Models\OddsHandicap; -use App\Models\OddsHandicapQ1; +use App\Models\OddsPoint; +use App\Models\OddsPointQ1; use App\Models\OddsTotal; use App\Models\OddsTotalQ1; use App\Models\OddsTq; @@ -153,7 +153,7 @@ class Odds $odds = FilterHandicap::get($value); $odds['starttime'] = $starttime; - OddsHandicap::updateOrCreate([ + OddsPoint::updateOrCreate([ 'event_id' => $event_id, 'bookmaker_id' => $bookmaker_id, ], $base + $odds); @@ -162,7 +162,7 @@ class Odds case 2000: // points qt $odds = FilterHandicap::get($value); - OddsHandicap::updateOrCreate([ + OddsPoint::updateOrCreate([ 'event_id' => $event_id, 'bookmaker_id' => $bookmaker_id, ], $base + $odds); @@ -171,7 +171,7 @@ class Odds case 2025: // points qt $odds = FilterHandicapQ1::get($value); - OddsHandicapQ1::updateOrCreate([ + OddsPointQ1::updateOrCreate([ 'event_id' => $event_id, 'bookmaker_id' => $bookmaker_id, ], $base + $odds); diff --git a/app/Console/Commands/Grapper/TxOdds.php b/app/Console/Commands/Grapper/TxOdds.php index 91e4e03c..ae755a40 100644 --- a/app/Console/Commands/Grapper/TxOdds.php +++ b/app/Console/Commands/Grapper/TxOdds.php @@ -11,12 +11,6 @@ class TxOdds { public static function switch() { - if (Nuh::$options['sport_id'] == 1) { - Nuh::$AUTHTOKEN = 'ident=betaid1&passwd=Dy59vpRC'; - } else { - Nuh::$AUTHTOKEN = 'ident=betaid2&passwd=Dy59vpRC'; - } - switch (Nuh::$options['name']) { case 'Fixtures': Fixtures::grap(); diff --git a/app/Console/Commands/Grapper/TxOdds/Fixtures.php b/app/Console/Commands/Grapper/TxOdds/Fixtures.php index 152a84a5..52e8aa69 100644 --- a/app/Console/Commands/Grapper/TxOdds/Fixtures.php +++ b/app/Console/Commands/Grapper/TxOdds/Fixtures.php @@ -8,6 +8,7 @@ use App\Models\CompetitionGroup; use App\Models\Element; use App\Models\Event; use App\Models\Group; +use App\Models\Sport; use App\Utilities\Notice; use Illuminate\Support\Carbon; @@ -16,12 +17,12 @@ class Fixtures public static function grap() { $debug = Nuh::$options['d'] ?? 0; - $echo = Nuh::$options['e'] ?? 0; - $break = Nuh::$options['t'] ?? 0; + $today = Nuh::$options['t'] ?? 0; $week = Nuh::$options['w'] ?? 0; $count = 0; - $total = 0; + $total_soccer = 0; + $total_others = 0; $now = Carbon::now(); @@ -35,81 +36,94 @@ class Fixtures Notice::note("Deleted: $info"); } + $sports = Sport::where('is_active', 1)->pluck('id')->toArray(); /** * Grap */ - for ($i = Nuh::$options['days_from']; $i < Nuh::$options['days_to']; $i++) { + $AUTHTOKEN = [ + 'SOCCER' => 'ident=betaid1&passwd=Dy59vpRC', + 'OTHER' => 'ident=betaid2&passwd=Dy59vpRC', + ]; - $url = 'https://xml2.txodds.com/feed/result/xml.php?'.Nuh::$AUTHTOKEN.'&date='.$now->toDateString().','.$now->addDays(1)->toDateString(); + foreach ($AUTHTOKEN as $konto => $authentication) { + // code... - $data = Xml::load($url); - - if ($echo) { - dd($data); + if ($today) { + Nuh::$options['days_from'] = 0; + Nuh::$options['days_to'] = 1; + } elseif ($week) { + Nuh::$options['days_from'] = 0; + Nuh::$options['days_to'] = 6; } - foreach ($data as $row) { + for ($i = Nuh::$options['days_from']; $i < Nuh::$options['days_to']; $i++) { - $event = [ - 'provider_id' => (int) Nuh::$options['provider_id'], - 'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(), - 'sport_id' => (int) $row->group['spid'], - 'home_id' => (int) $row->hteam['id'], - 'away_id' => (int) $row->ateam['id'], - 'country_id' => (int) $row->group['cnid'], - 'group_id' => (int) $row->group['id'], - 'competition_group_id' => (int) $row->group['cgid'], - ]; + $url = "https://xml2.txodds.com/feed/result/xml.php?$authentication&days=$i,1"; - Event::updateOrCreate(['id' => (int) $row['id']], $event); + $data = Xml::load($url); - $group = [ - 'competition_group_id' => (string) $row->group['cgid'], - 'sport_id' => (int) $row->group['spid'], - 'country_id' => (int) $row->group['cnid'], - 'name' => (string) $row->group, - ]; - Group::updateOrCreate(['id' => (int) $row->group['id']], $group); + foreach ($data as $row) { - $compgroup = [ - 'sport_id' => $event['sport_id'], - 'country_id' => $event['country_id'], - 'name' => (string) $row->group['cname'], - ]; + $sport_id = (int) $row->group['spid']; - CompetitionGroup::updateOrCreate(['id' => (int) $row->group['cgid']], $compgroup); + if (in_array($sport_id, $sports)) { - $element = [ - 'name' => (string) $row->hteam, - 'sport_id' => (int) $row->group['spid'], - ]; - Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element); + $event = [ + 'provider_id' => (int) Nuh::$options['provider_id'], + 'starttime' => Carbon::createFromDate((string) $row->time)->toDateTimeString(), + 'sport_id' => (int) $sport_id, + 'home_id' => (int) $row->hteam['id'], + 'away_id' => (int) $row->ateam['id'], + 'country_id' => (int) $row->group['cnid'], + 'group_id' => (int) $row->group['id'], + 'competition_group_id' => (int) $row->group['cgid'], + ]; - $element = [ - 'name' => (string) $row->ateam, - 'sport_id' => (int) $row->group['spid'], - ]; - Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element); + Event::updateOrCreate(['id' => (int) $row['id']], $event); - $count++; + $group = [ + 'competition_group_id' => (string) $row->group['cgid'], + 'sport_id' => (int) $sport_id, + 'country_id' => (int) $row->group['cnid'], + 'name' => (string) $row->group, + ]; + Group::updateOrCreate(['id' => (int) $row->group['id']], $group); + + $compgroup = [ + 'sport_id' => (int) $sport_id, + 'country_id' => $event['country_id'], + 'name' => (string) $row->group['cname'], + ]; + + CompetitionGroup::updateOrCreate(['id' => (int) $row->group['cgid']], $compgroup); + + $element = [ + 'name' => (string) $row->hteam, + 'sport_id' => (int) $sport_id, + ]; + Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element); + + $element = [ + 'name' => (string) $row->ateam, + 'sport_id' => (int) $sport_id, + ]; + Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element); + + if ($sport_id == 1) { + $total_soccer++; + } else { + $total_others++; + } + } + } } if ($debug) { Notice::note($now->toDateString()." - $count events processed", 'g'); } - - $total += $count; - - if ($break) { - break; - } - - if ($week && $i == 7) { - break; - } } if ($debug) { - Notice::note("Total - $total events processed", 'g'); + Notice::note("Total Soccer - $total_soccer\nTotal Others - $total_others", 'g'); } } } diff --git a/app/Console/Commands/Grapper/TxOdds/Odds.php b/app/Console/Commands/Grapper/TxOdds/Odds.php index 5a3da3da..569feb3a 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds.php @@ -2,11 +2,16 @@ namespace App\Console\Commands\Grapper\TxOdds; +use App\Console\Commands\Grapper\TxOdds\Odds\_2Way; +use App\Console\Commands\Grapper\TxOdds\Odds\_2WayS1; use App\Console\Commands\Grapper\TxOdds\Odds\_3Way; use App\Console\Commands\Grapper\TxOdds\Odds\_Dc; use App\Console\Commands\Grapper\TxOdds\Odds\_Dnb; use App\Console\Commands\Grapper\TxOdds\Odds\_Ggng; +use App\Console\Commands\Grapper\TxOdds\Odds\_Points; +use App\Console\Commands\Grapper\TxOdds\Odds\_PointsHt; use App\Console\Commands\Grapper\TxOdds\Odds\_Totals; +use App\Console\Commands\Grapper\TxOdds\Odds\_TotalsHt; use App\Console\Commands\Grapper\TxOdds\Odds\_Tq; use App\Console\Commands\Nuh; use App\Console\Commands\Xml; @@ -38,52 +43,49 @@ class Odds } /************************************************* - * SINGLE SOCCER - * https://xml2.txodds.com/feed/odds/xml.php?ident=betaid1&passwd=Dy59vpRC&peid=3118930 + * https://xml2.txodds.com/feed/odds_types.php - * SINGLE OTHER - ************************************************* - * https://xml2.txodds.com/feed/odds/xml.php?ident=betaid2&passwd=Dy59vpRC&peid=3118930 + * BETTYPE IDS + 0 3-WAY + 1 2-WAY + 3 POINTS + 4 TOTALS - ************************************************* - * https://xml2.txodds.com/feed/odds_types.php + 131073 MONEY LINE - Q1 - * BETTYPE IDS - 0 3-WAY - 1 2-WAY - 3 POINTS - 4 TOTALS - 5 Asian - 65536 3-WAY HALF TIME - 131072 3 WAY QUARTER TIME - 65539 POINTS HALF TIME - 131075 POINTS QUARTER TIME - 262147 POINTS OVER TIME - 65540 TOTALS HALF TIME - 131076 TOTALS QUARTER TIME - 262148 TOTALS OVER TIME - 11534337 GG/NG (both teams to score) - 5242880 DOUBLE CHANCE - 7340033 TO PROGRESS (to qualify) - 6291457 DRAW NO BET + 65536 3-WAY HALF TIME + 65540 TOTALS HALF TIME + 65539 POINTS HALF TIME - Not used: + 131075 POINTS QUARTER TIME + 131076 TOTALS QUARTER TIME - 65537 2-WAY HALF TIME - 327680 3-WAY 2ND HALF - 327681 2-WAY 2ND HALF - 327683 POINT 2ND HALF - 327684 TOTALS 2ND HALF - 1048577 GOAL / NO GOAL + 5242880 DOUBLE CHANCE + 6291457 DRAW NO BET + 11534337 GG/NG (both teams to score) + 7340033 TO PROGRESS (to qualify) - 2097153 ODD / EVEN - 4194304 TOTAL GOALS - 8388608 1X2 EURO HANDCIAP - 9437188 TOTAL CORNERS - 9502724 TOTAL CORNERS 1ST HALF - 20971520 3-WAY CORNERS - 28311555 HANDICAP SETS - 28311556 TOTAL SETS + Not used: + 5 Asian + 131072 3 WAY QUARTER TIME + 262148 TOTALS OVER TIME + 262147 POINTS OVER TIME + + 65537 2-WAY HALF TIME + 327680 3-WAY 2ND HALF + 327681 2-WAY 2ND HALF + 327683 POINT 2ND HALF + 327684 TOTALS 2ND HALF + 1048577 GOAL / NO GOAL + + 2097153 ODD / EVEN + 4194304 TOTAL GOALS + 8388608 1X2 EURO HANDCIAP + 9437188 TOTAL CORNERS + 9502724 TOTAL CORNERS 1ST HALF + 20971520 3-WAY CORNERS + 28311555 HANDICAP SETS + 28311556 TOTAL SETS *************************************************/ @@ -91,21 +93,49 @@ class Odds switch (Nuh::$options['sport_id']) { case 1: - $markets = '0,4,11534337,5242880,7340033,6291457'; + /** + * 0 3-WAY + * 4 TOTALS + * 65536 3-WAY HALF TIME + * 65540 TOTALS HALF TIME + * 11534337 GG/NG (both teams to score) + * 5242880 DOUBLE CHANCE + * 7340033 TO PROGRESS (to qualify) + * 6291457 DRAW NO BET + */ + $markets = '0,4,65536,65540,11534337,5242880,7340033,6291457'; break; case 2: - // needs check - $markets = '0,1,3,4,262148,131072,131076'; + /** + * 0 3-WAY + * 1 2-WAY + * 3 POINTS + * 4 TOTALS + * 131075 POINTS QUARTER TIME + * 131076 TOTALS QUARTER TIME + */ + $markets = '0,1,3,4,131076,131075'; break; case 3: - // needs check - $markets = '0,1,3,4,262147,262148,65539,65540,131075,131076'; + /** + * 1 2-WAY + * 3 POINTS + * 4 TOTALS + * 65539 POINTS HALF TIME + * 65540 TOTALS HALF TIME + * 131075 POINTS QUARTER TIME + * 131076 TOTALS QUARTER TIME + */ + $markets = '1,3,4,65539,65540,131075,131076'; break; case 5: - $markets = '1,3,4'; - break; - case 8: - $markets = '0,3,4'; + /** + * 1 2-WAY + * 3 POINTS + * 4 TOTALS + * 131073 MONEY LINE - Q1 + */ + $markets = '1,3,4,131073'; break; default: Notice::note('sport not defined', 'r', 1); @@ -115,22 +145,28 @@ class Odds /************************************************* * URL *************************************************/ - $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&spid='.Nuh::$options['sport_id']; + if (Nuh::$options['sport_id'] == 1) { + $AUTHTOKEN = 'ident=betaid1&passwd=Dy59vpRC'; + } else { + $AUTHTOKEN = 'ident=betaid2&passwd=Dy59vpRC'; + } + $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.$AUTHTOKEN.'&all_odds=2'; + $_calls = []; if (Nuh::$options['id']) { if ($debug) { Notice::note('BY ID', 'p'); } /** - * BY ID + * by SINGLE ID */ $_calls[] = $url."&ot=$markets&peid=".Nuh::$options['id']; } elseif (Nuh::$options['a']) { if ($debug) { - Notice::note('ALL EXISTING', 'p'); + Notice::note('ALL', 'p'); } /** - * ALL EXISTING + * ALL by ID */ $res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('id'); foreach ($res as $id) { @@ -142,8 +178,7 @@ class Odds } /** * PER GROUP_ID - * - * with from-to days + * with from-to */ $groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id'); foreach ($groupids as $groupid) { @@ -158,7 +193,7 @@ class Odds */ $res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(1)->toDateTimeString())->pluck('id'); foreach ($res as $id) { - $_calls[] = $url."&ot=$markets&peid=".$id; + $_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&peid=".$id; } } elseif (Nuh::$options['w']) { if ($debug) { @@ -180,11 +215,9 @@ class Odds * with from-to days */ - $_calls[] = $url."&ot=$markets&days=".Nuh::$options['days_from'].','.Nuh::$options['days_to'].'&last='.Nuh::$options['lastcall']; + $_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&days=".Nuh::$options['days_from'].','.Nuh::$options['days_to'].'&last='.Nuh::$options['lastcall']; } - dd($_calls); - /************************************************* * CALL *************************************************/ @@ -276,9 +309,37 @@ class Odds case 0: _3Way::grap($odds, $offer); break; + case 1: + _2Way::grap($odds, $offer); + break; + case 3: + _Points::grap($odds, $offer); + break; case 4: _Totals::grap($odds, $offer); break; + + case 131073: + _2WayS1::grap($odds, $offer); + break; + + case 65536: + _3WayHt::grap($odds, $offer); + break; + case 65540: + _TotalsHt::grap($odds, $offer); + break; + case 65539: + _PointsHt::grap($odds, $offer); + break; + + case 131075: + _PointsQt::grap($odds, $offer); + break; + case 131076: + _TotalsQt::grap($odds, $offer); + break; + case 5242880: _Dc::grap($odds, $offer); break; diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_2Way.php b/app/Console/Commands/Grapper/TxOdds/Odds/_2Way.php new file mode 100644 index 00000000..0012583b --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_2Way.php @@ -0,0 +1,25 @@ +o1; + $odds['a2w'] = (float) $value->o3; + $odds['starttime'] = (string) $value['starttime']; + } + $odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1); + + Odds2way::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_2WayS1.php b/app/Console/Commands/Grapper/TxOdds/Odds/_2WayS1.php new file mode 100644 index 00000000..01da43e0 --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_2WayS1.php @@ -0,0 +1,25 @@ +o1; + $odds['a2w'] = (float) $value->o3; + $odds['starttime'] = (string) $value['starttime']; + } + $odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1); + + Odds2wayS1::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_3Way.php b/app/Console/Commands/Grapper/TxOdds/Odds/_3Way.php index 2025ab78..1c9997f5 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds/_3Way.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_3Way.php @@ -5,18 +5,11 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds; use App\Console\Commands\Nuh; use App\Models\Odds3way; use App\Utilities\Margin; -use App\Utilities\Notice; class _3Way { public static function grap($odds, $offer) { - // $debug = Nuh::$options['d'] ?? 0; - - // if ($debug) { - // Notice::note('1X2 '.Nuh::$bookmaker_id, 'b'); - // } - foreach ($offer as $value) { $odds['h3w'] = (float) $value->o1; $odds['d3w'] = (float) $value->o2; diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_3WayHt.php b/app/Console/Commands/Grapper/TxOdds/Odds/_3WayHt.php new file mode 100644 index 00000000..227b984e --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_3WayHt.php @@ -0,0 +1,25 @@ +o1; + $odds['d3w'] = (float) $value->o2; + $odds['a3w'] = (float) $value->o3; + $odds['starttime'] = (string) $value['starttime']; + } + $odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1); + + Odds3wayHt::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_Dc.php b/app/Console/Commands/Grapper/TxOdds/Odds/_Dc.php index f0149c2c..6649d82e 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds/_Dc.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_Dc.php @@ -5,18 +5,11 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds; use App\Console\Commands\Nuh; use App\Models\OddsDc; use App\Utilities\Margin; -use App\Utilities\Notice; class _Dc { public static function grap($odds, $offer) { - // $debug = Nuh::$options['d'] ?? 0; - - // if ($debug) { - // Notice::note('Double Chance '.Nuh::$bookmaker_id, 'b'); - // } - foreach ($offer as $value) { $odds['dc1x'] = (float) $value->o1; $odds['dc12'] = (float) $value->o2; diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_Dnb.php b/app/Console/Commands/Grapper/TxOdds/Odds/_Dnb.php index 99341b1c..98105d1a 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds/_Dnb.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_Dnb.php @@ -5,18 +5,11 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds; use App\Console\Commands\Nuh; use App\Models\OddsDnb; use App\Utilities\Margin; -use App\Utilities\Notice; class _Dnb { public static function grap($odds, $offer) { - // $debug = Nuh::$options['d'] ?? 0; - - // if ($debug) { - // Notice::note('Draw No Bet '.Nuh::$bookmaker_id, 'b'); - // } - foreach ($offer as $value) { $odds['dnb1'] = (float) $value->o1; $odds['dnb2'] = (float) $value->o3; diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_Ggng.php b/app/Console/Commands/Grapper/TxOdds/Odds/_Ggng.php index 950867e9..a2dc8b77 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds/_Ggng.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_Ggng.php @@ -5,18 +5,11 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds; use App\Console\Commands\Nuh; use App\Models\OddsGgng; use App\Utilities\Margin; -use App\Utilities\Notice; class _Ggng { public static function grap($odds, $offer) { - // $debug = Nuh::$options['d'] ?? 0; - - // if ($debug) { - // Notice::note('Goal No Goal '.Nuh::$bookmaker_id, 'b'); - // } - foreach ($offer as $value) { $odds['gg'] = (float) $value->o1; $odds['ng'] = (float) $value->o3; diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_Points.php b/app/Console/Commands/Grapper/TxOdds/Odds/_Points.php new file mode 100644 index 00000000..9140bef3 --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_Points.php @@ -0,0 +1,28 @@ +o1; + $odds['away'] = (float) $value->o2; + $odds['handicap'] = (float) $value->o3; + } + + $odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1); + $odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']); + + OddsPoint::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + 'handicap' => $odds['handicap'], + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_PointsHt.php b/app/Console/Commands/Grapper/TxOdds/Odds/_PointsHt.php new file mode 100644 index 00000000..d8d04fd7 --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_PointsHt.php @@ -0,0 +1,28 @@ +o1; + $odds['away'] = (float) $value->o2; + $odds['handicap'] = (float) $value->o3; + } + + $odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1); + $odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']); + + OddsPointHt::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + 'handicap' => $odds['handicap'], + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_PointsQ1.php b/app/Console/Commands/Grapper/TxOdds/Odds/_PointsQ1.php new file mode 100644 index 00000000..9744d132 --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_PointsQ1.php @@ -0,0 +1,28 @@ +o1; + $odds['away'] = (float) $value->o2; + $odds['handicap'] = (float) $value->o3; + } + + $odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1); + $odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']); + + OddsPointQ1::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + 'handicap' => $odds['handicap'], + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_Totals.php b/app/Console/Commands/Grapper/TxOdds/Odds/_Totals.php index 962e9df4..71bdbcbd 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds/_Totals.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_Totals.php @@ -5,18 +5,11 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds; use App\Console\Commands\Nuh; use App\Models\OddsTotal; use App\Utilities\Margin; -use App\Utilities\Notice; class _Totals { public static function grap($odds, $offer) { - // $debug = Nuh::$options['d'] ?? 0; - - // if ($debug) { - // Notice::note('Totals '.Nuh::$bookmaker_id, 'b'); - // } - foreach ($offer as $value) { $odds['over'] = (float) $value->o1; $odds['under'] = (float) $value->o2; @@ -30,10 +23,12 @@ class _Totals } $odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1); + $odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']); OddsTotal::updateOrCreate([ 'event_id' => Nuh::$id, 'bookmaker_id' => Nuh::$bookmaker_id, + 'total' => $odds['total'], ], $odds); } } diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_TotalsHt.php b/app/Console/Commands/Grapper/TxOdds/Odds/_TotalsHt.php new file mode 100644 index 00000000..e9a62cec --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_TotalsHt.php @@ -0,0 +1,27 @@ +o1; + $odds['under'] = (float) $value->o2; + $odds['total'] = (float) $value->o3; + } + + $odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1); + $odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']); + + OddsTotalHt::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + 'total' => $odds['total'], + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_TotalsQ1.php b/app/Console/Commands/Grapper/TxOdds/Odds/_TotalsQ1.php new file mode 100644 index 00000000..ee4871de --- /dev/null +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_TotalsQ1.php @@ -0,0 +1,28 @@ +o1; + $odds['under'] = (float) $value->o2; + $odds['total'] = (float) $value->o3; + } + + $odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1); + $odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']); + + OddsTotalQ1::updateOrCreate([ + 'event_id' => Nuh::$id, + 'bookmaker_id' => Nuh::$bookmaker_id, + 'total' => $odds['total'], + ], $odds); + } +} diff --git a/app/Console/Commands/Grapper/TxOdds/Odds/_Tq.php b/app/Console/Commands/Grapper/TxOdds/Odds/_Tq.php index 06ca19b0..84402b24 100644 --- a/app/Console/Commands/Grapper/TxOdds/Odds/_Tq.php +++ b/app/Console/Commands/Grapper/TxOdds/Odds/_Tq.php @@ -5,18 +5,11 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds; use App\Console\Commands\Nuh; use App\Models\OddsTq; use App\Utilities\Margin; -use App\Utilities\Notice; class _Tq { public static function grap($odds, $offer) { - // $debug = Nuh::$options['d'] ?? 0; - - // if ($debug) { - // Notice::note('To Qualify '.Nuh::$bookmaker_id, 'b'); - // } - foreach ($offer as $value) { $odds['htq'] = (float) $value->o1; $odds['atq'] = (float) $value->o3; diff --git a/app/Console/Commands/Nuh.php b/app/Console/Commands/Nuh.php index 0a6dee95..d203fa3e 100644 --- a/app/Console/Commands/Nuh.php +++ b/app/Console/Commands/Nuh.php @@ -20,8 +20,6 @@ class Nuh extends Command public static $bookmaker_id; - public static $AUTHTOKEN; - public static $BETSAPI_TOKEN = '36152-aeTRNnZxSPUwGe'; protected $signature = 'nuh {process=help} {--id=0} {--f=} {--a} {--p} {--d} {--b} {--w} {--g} {--r} {--s} {--t}'; diff --git a/app/Filament/Resources/Events/Tables/EventsTable.php b/app/Filament/Resources/Events/Tables/EventsTable.php index a8f018d5..83474e88 100644 --- a/app/Filament/Resources/Events/Tables/EventsTable.php +++ b/app/Filament/Resources/Events/Tables/EventsTable.php @@ -50,9 +50,9 @@ class EventsTable public static $odds_ggng = []; - public static $odds_handicaps = []; + public static $odds_points = []; - public static $odds_handicaps_q1 = []; + public static $odds_points_q1 = []; public static $odds_2ways = []; @@ -84,10 +84,10 @@ class EventsTable break; case 8: case 14: - self::$odds_handicaps[] = $value->bookmaker_id; + self::$odds_points[] = $value->bookmaker_id; break; case 9: - self::$odds_handicaps_q1[] = $value->bookmaker_id; + self::$odds_points_q1[] = $value->bookmaker_id; break; case 7: case 12: diff --git a/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php b/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php index 2319a204..f9b6a8a0 100644 --- a/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php +++ b/app/Filament/Resources/Supervisors/Schemas/SupervisorForm.php @@ -2,7 +2,6 @@ namespace App\Filament\Resources\Supervisors\Schemas; -use App\Models\Sport; use Filament\Forms\Components\Select; use Filament\Forms\Components\TextInput; use Filament\Schemas\Components\Section; @@ -19,12 +18,7 @@ class SupervisorForm ->required() ->preload(), Select::make('sport_id') - ->options(function () { - $res = Sport::where('is_active', 1)->pluck('name', 'id')->toArray(); - array_unshift($res, 'All'); - - return $res; - }) + ->relationship('sport', 'name') ->nullable(), TextInput::make('sleep')->default(15), diff --git a/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php b/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php index 643f83e9..df199ced 100644 --- a/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php +++ b/app/Filament/Resources/Supervisors/Tables/SupervisorsTable.php @@ -20,7 +20,7 @@ class SupervisorsTable return $table ->striped() ->columns([ - TextColumn::make('id')->badge(), + TextColumn::make('id')->badge()->alignCenter(), TextColumn::make('provider.name')->badge() ->color(fn ($record): string => match ($record->provider_id) { 1 => 'danger', @@ -36,7 +36,7 @@ class SupervisorsTable 'Bet365' => 'Bet365', 'Betfair' => 'Betfair', ]), - TextColumn::make('sport.name')->label('Sport')->color(fn ($record): string => $record->sport->color), + TextColumn::make('sport.name')->label('Sport'), TextColumn::make('days_from')->label('From'), TextColumn::make('days_to')->label('To'), TextColumn::make('sleep')->numeric(), diff --git a/app/Models/Event.php b/app/Models/Event.php index 5ca6b781..b01b7734 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -98,14 +98,14 @@ class Event extends Model return $this->hasMany(OddsGgng::class); } - public function odds_handicap() + public function odds_point() { - return $this->hasMany(OddsHandicap::class); + return $this->hasMany(OddsPoint::class); } - public function odds_handicap_q1() + public function odds_point_q1() { - return $this->hasMany(OddsHandicapQ1::class); + return $this->hasMany(OddsPointQ1::class); } public function odds_total() diff --git a/app/Models/Odds2way.php b/app/Models/Odds2way.php index c6159a38..ce830114 100644 --- a/app/Models/Odds2way.php +++ b/app/Models/Odds2way.php @@ -23,6 +23,7 @@ class Odds2way extends Model 'nuh_check', 'add_time', 'updated_at', + 'starttime', ]; public function sport() diff --git a/app/Models/Odds3way.php b/app/Models/Odds3way.php index 72d7055d..123d1f59 100644 --- a/app/Models/Odds3way.php +++ b/app/Models/Odds3way.php @@ -22,6 +22,7 @@ class Odds3way extends Model 'margin', 'flag', 'nuh_check', + 'starttime', 'add_time', 'updated_at', ]; diff --git a/app/Models/Odds3wayHt.php b/app/Models/Odds3wayHt.php new file mode 100644 index 00000000..18335d48 --- /dev/null +++ b/app/Models/Odds3wayHt.php @@ -0,0 +1,48 @@ +belongsTo(Event::class); + } + + public function sport() + { + return $this->belongsTo(Sport::class); + } + + public function bookmaker() + { + return $this->belongsTo(Bookmaker::class); + } + + public function provider() + { + return $this->belongsTo(Provider::class); + } +} diff --git a/app/Models/OddsHandicapQ1.php b/app/Models/OddsHandicapQ1.php index 2ecc627f..161a2561 100644 --- a/app/Models/OddsHandicapQ1.php +++ b/app/Models/OddsHandicapQ1.php @@ -4,9 +4,9 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class OddsHandicapQ1 extends Model +class OddsPointQ1 extends Model { - protected $table = 'odds_handicaps_q1'; + protected $table = 'odds_points_q1'; protected $fillable = [ 'id', diff --git a/app/Models/OddsPoint.php b/app/Models/OddsPoint.php new file mode 100644 index 00000000..28f1882b --- /dev/null +++ b/app/Models/OddsPoint.php @@ -0,0 +1,49 @@ +belongsTo(Sport::class); + } + + public function bookmaker() + { + return $this->belongsTo(Bookmaker::class); + } + + public function event() + { + return $this->belongsTo(Event::class); + } + + public function provider() + { + return $this->belongsTo(Provider::class); + } +} diff --git a/app/Models/OddsHandicap.php b/app/Models/OddsPointHt.php similarity index 91% rename from app/Models/OddsHandicap.php rename to app/Models/OddsPointHt.php index 2a6353fe..da92a016 100644 --- a/app/Models/OddsHandicap.php +++ b/app/Models/OddsPointHt.php @@ -4,9 +4,9 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -class OddsHandicap extends Model +class OddsPointHt extends Model { - protected $table = 'odds_handicaps'; + protected $table = 'odds_points'; protected $fillable = [ 'id', diff --git a/app/Models/OddsTotalHt.php b/app/Models/OddsTotalHt.php new file mode 100644 index 00000000..e3b4e315 --- /dev/null +++ b/app/Models/OddsTotalHt.php @@ -0,0 +1,48 @@ +belongsTo(Sport::class); + } + + public function bookmaker() + { + return $this->belongsTo(Bookmaker::class); + } + + public function event() + { + return $this->belongsTo(Event::class); + } + + public function provider() + { + return $this->belongsTo(Provider::class); + } +} diff --git a/app/Models/Supervisor.php b/app/Models/Supervisor.php index 43c68d33..c9380000 100644 --- a/app/Models/Supervisor.php +++ b/app/Models/Supervisor.php @@ -21,13 +21,9 @@ class Supervisor extends Model 'days_to', ]; - protected $casts = [ - 'grap_days_pattern' => 'json', - ]; - public function sport() { - return $this->belongsTo(Sport::class); + return $this->belongsTo(Sport::class)->where('is_active', 1); } public function provider() diff --git a/composer.lock b/composer.lock index f79d352d..ed584c88 100644 --- a/composer.lock +++ b/composer.lock @@ -12890,12 +12890,12 @@ "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "b01be90dceff69c88c7b36c30ee45c9fd9107f7f" + "reference": "bdbabc199a7ba9965484e4725d66170e5711323b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/b01be90dceff69c88c7b36c30ee45c9fd9107f7f", - "reference": "b01be90dceff69c88c7b36c30ee45c9fd9107f7f", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bdbabc199a7ba9965484e4725d66170e5711323b", + "reference": "bdbabc199a7ba9965484e4725d66170e5711323b", "shasum": "" }, "require": { @@ -12944,7 +12944,7 @@ "issues": "https://github.com/webmozarts/assert/issues", "source": "https://github.com/webmozarts/assert/tree/2.1.1" }, - "time": "2026-01-07T17:26:38+00:00" + "time": "2026-01-08T11:28:40+00:00" } ], "aliases": [], diff --git a/database/migrations/2023_05_25_112701_create_event_bookmakers_table.php b/database/migrations/2023_05_25_112701_create_event_bookmakers_table.php index 615ba839..29b0c17e 100644 --- a/database/migrations/2023_05_25_112701_create_event_bookmakers_table.php +++ b/database/migrations/2023_05_25_112701_create_event_bookmakers_table.php @@ -15,10 +15,12 @@ return new class extends Migration $table->id(); $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); $table->integer('bookmaker_id')->index()->references('id')->on('bookmakers'); + $table->timestamp('bkm_starttime')->nullable(); $table->string('bmoid')->nullable(); $table->boolean('in_feed')->default(0); $table->boolean('send_status')->default(0); - $table->timestamp('bkm_starttime')->nullable(); + $table->boolean('has_to_qualify')->index()->default(0); + $table->timestamps(); }); } diff --git a/database/migrations/2023_08_06_085243_create_supervisor_table.php b/database/migrations/2023_08_06_085243_create_supervisor_table.php index 7dbf84da..7d0ede1c 100644 --- a/database/migrations/2023_08_06_085243_create_supervisor_table.php +++ b/database/migrations/2023_08_06_085243_create_supervisor_table.php @@ -14,8 +14,8 @@ return new class extends Migration Schema::create('supervisors', function (Blueprint $table) { $table->id(); $table->string('name'); - $table->integer('provider_id')->default(0)->nullable()->index()->references('id')->on('providers'); - $table->integer('sport_id')->index()->references('id')->on('sports'); + $table->integer('provider_id')->default(0)->nullable()->references('id')->on('providers'); + $table->integer('sport_id')->references('id')->on('sports'); $table->integer('sleep')->default(10); $table->integer('limit')->default(0); diff --git a/database/migrations/2024_11_08_053426_create_odds3way_ht_table.php b/database/migrations/2024_11_08_053426_create_odds3way_ht_table.php new file mode 100644 index 00000000..99ec9cd4 --- /dev/null +++ b/database/migrations/2024_11_08_053426_create_odds3way_ht_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); + $table->integer('sport_id')->index()->references('id')->on('sports'); + $table->integer('bookmaker_id')->index()->references('id')->on('bookmakers'); + $table->integer('provider_id')->default(0)->nullable()->index()->references('id')->on('providers'); + $table->bigInteger('offer_id')->default(0); + $table->string('bmoid')->nullable(); + $table->decimal('h3w', 7, 3)->default(0); + $table->decimal('d3w', 7, 3)->default(0); + $table->decimal('a3w', 7, 3)->default(0); + $table->decimal('margin', 5, 1)->default(0); + $table->boolean('flag')->default(0); + $table->boolean('nuh_check')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('odds3way_hts'); + } +}; diff --git a/database/migrations/2024_11_08_053430_create_odds_2ways_table_s1.php b/database/migrations/2024_11_08_053430_create_odds_2ways_s1_table.php similarity index 95% rename from database/migrations/2024_11_08_053430_create_odds_2ways_table_s1.php rename to database/migrations/2024_11_08_053430_create_odds_2ways_s1_table.php index 456d5a16..d5cd34ac 100644 --- a/database/migrations/2024_11_08_053430_create_odds_2ways_table_s1.php +++ b/database/migrations/2024_11_08_053430_create_odds_2ways_s1_table.php @@ -24,7 +24,6 @@ return new class extends Migration $table->decimal('margin', 5, 1)->default(0); $table->boolean('flag')->default(0); $table->boolean('nuh_check')->default(0); - $table->timestamp('starttime')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2024_11_08_053430_create_odds_2ways_table.php b/database/migrations/2024_11_08_053430_create_odds_2ways_table.php index d4d09b1b..d206113f 100644 --- a/database/migrations/2024_11_08_053430_create_odds_2ways_table.php +++ b/database/migrations/2024_11_08_053430_create_odds_2ways_table.php @@ -24,6 +24,7 @@ return new class extends Migration $table->decimal('margin', 5, 1)->default(0); $table->boolean('flag')->default(0); $table->boolean('nuh_check')->default(0); + $table->timestamp('starttime')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2024_11_08_053439_create_odds_handicaps_table.php b/database/migrations/2024_11_08_053439_create_odds_points_q1_table.php similarity index 88% rename from database/migrations/2024_11_08_053439_create_odds_handicaps_table.php rename to database/migrations/2024_11_08_053439_create_odds_points_q1_table.php index fd04b63c..3005ddd1 100644 --- a/database/migrations/2024_11_08_053439_create_odds_handicaps_table.php +++ b/database/migrations/2024_11_08_053439_create_odds_points_q1_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('odds_handicaps', function (Blueprint $table) { + Schema::create('odds_points_q1', function (Blueprint $table) { $table->id(); $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); $table->integer('sport_id')->index()->references('id')->on('sports'); @@ -23,6 +23,7 @@ return new class extends Migration $table->decimal('away', 7, 3)->default(0); $table->decimal('handicap', 7, 3)->default(0); $table->decimal('margin', 5, 1)->default(0); + $table->decimal('difference', 5, 4)->default(0); $table->boolean('flag')->default(0); $table->boolean('nuh_check')->default(0); $table->timestamp('starttime')->nullable(); @@ -35,6 +36,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('odds_handicaps'); + Schema::dropIfExists('odds_q1_points'); } }; diff --git a/database/migrations/2024_11_08_053439_create_odds_points_table.php b/database/migrations/2024_11_08_053439_create_odds_points_table.php new file mode 100644 index 00000000..2ff3ff84 --- /dev/null +++ b/database/migrations/2024_11_08_053439_create_odds_points_table.php @@ -0,0 +1,41 @@ +id(); + $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); + $table->integer('sport_id')->index()->references('id')->on('sports'); + $table->integer('bookmaker_id')->index()->references('id')->on('bookmakers'); + $table->integer('provider_id')->default(0)->nullable()->index()->references('id')->on('providers'); + $table->bigInteger('offer_id')->default(0); + $table->string('bmoid')->nullable(); + $table->decimal('home', 7, 3)->default(0); + $table->decimal('away', 7, 3)->default(0); + $table->decimal('handicap', 7, 3)->default(0); + $table->decimal('margin', 5, 1)->default(0); + $table->decimal('difference', 5, 4)->default(0); + $table->boolean('flag')->default(0); + $table->boolean('nuh_check')->default(0); + $table->timestamp('starttime')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('odds_points'); + } +}; diff --git a/database/migrations/2024_11_08_053439_create_odds_handicaps_table_q1.php b/database/migrations/2024_11_08_053445_create_odds_points_ht_table.php similarity index 87% rename from database/migrations/2024_11_08_053439_create_odds_handicaps_table_q1.php rename to database/migrations/2024_11_08_053445_create_odds_points_ht_table.php index 24c55b55..cde6c5b3 100644 --- a/database/migrations/2024_11_08_053439_create_odds_handicaps_table_q1.php +++ b/database/migrations/2024_11_08_053445_create_odds_points_ht_table.php @@ -11,7 +11,7 @@ return new class extends Migration */ public function up(): void { - Schema::create('odds_handicaps_q1', function (Blueprint $table) { + Schema::create('odds_point_ht', function (Blueprint $table) { $table->id(); $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); $table->integer('sport_id')->index()->references('id')->on('sports'); @@ -23,6 +23,7 @@ return new class extends Migration $table->decimal('away', 7, 3)->default(0); $table->decimal('handicap', 7, 3)->default(0); $table->decimal('margin', 5, 1)->default(0); + $table->decimal('difference', 5, 4)->default(0); $table->boolean('flag')->default(0); $table->boolean('nuh_check')->default(0); $table->timestamps(); @@ -34,6 +35,6 @@ return new class extends Migration */ public function down(): void { - Schema::dropIfExists('odds_handicaps_q1'); + Schema::dropIfExists('odds_point_ht'); } }; diff --git a/database/migrations/2024_11_08_053445_create_odds_total_ht_table.php b/database/migrations/2024_11_08_053445_create_odds_total_ht_table.php new file mode 100644 index 00000000..6c25487d --- /dev/null +++ b/database/migrations/2024_11_08_053445_create_odds_total_ht_table.php @@ -0,0 +1,40 @@ +id(); + $table->foreignId('event_id')->index()->constrained()->cascadeOnDelete()->references('id')->on('events'); + $table->integer('sport_id')->index()->references('id')->on('sports'); + $table->integer('bookmaker_id')->index()->references('id')->on('bookmakers'); + $table->integer('provider_id')->default(0)->nullable()->index()->references('id')->on('providers'); + $table->bigInteger('offer_id')->default(0); + $table->string('bmoid')->nullable(); + $table->decimal('over', 7, 3)->default(0); + $table->decimal('under', 7, 3)->default(0); + $table->decimal('total', 7, 3)->default(0); + $table->decimal('margin', 5, 1)->default(0); + $table->decimal('difference', 5, 4)->default(0); + $table->boolean('flag')->default(0); + $table->boolean('nuh_check')->default(0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('odds_total_hts'); + } +}; diff --git a/database/migrations/2024_11_08_053445_create_odds_totals_table_q1.php b/database/migrations/2024_11_08_053445_create_odds_total_q1_table.php similarity index 95% rename from database/migrations/2024_11_08_053445_create_odds_totals_table_q1.php rename to database/migrations/2024_11_08_053445_create_odds_total_q1_table.php index 0ba6b90c..884f40a0 100644 --- a/database/migrations/2024_11_08_053445_create_odds_totals_table_q1.php +++ b/database/migrations/2024_11_08_053445_create_odds_total_q1_table.php @@ -23,6 +23,7 @@ return new class extends Migration $table->decimal('under', 7, 3)->default(0); $table->decimal('total', 7, 3)->default(0); $table->decimal('margin', 5, 1)->default(0); + $table->decimal('difference', 5, 4)->default(0); $table->boolean('flag')->default(0); $table->boolean('nuh_check')->default(0); $table->timestamps(); diff --git a/database/migrations/2024_11_08_053445_create_odds_totals_table.php b/database/migrations/2024_11_08_053445_create_odds_total_table.php similarity index 95% rename from database/migrations/2024_11_08_053445_create_odds_totals_table.php rename to database/migrations/2024_11_08_053445_create_odds_total_table.php index 72be463d..ceb3d2e3 100644 --- a/database/migrations/2024_11_08_053445_create_odds_totals_table.php +++ b/database/migrations/2024_11_08_053445_create_odds_total_table.php @@ -24,6 +24,7 @@ return new class extends Migration $table->decimal('total', 7, 3)->default(0); $table->decimal('margin', 5, 1)->default(0); $table->boolean('flag')->default(0); + $table->decimal('difference', 5, 4)->default(0); $table->boolean('nuh_check')->default(0); $table->timestamps(); }); diff --git a/database/migrations/2025_12_14_090816_create_multiline_settings_table.php b/database/migrations/2025_12_14_090816_create_multiline_settings_table.php index 60a5c810..8f99d816 100644 --- a/database/migrations/2025_12_14_090816_create_multiline_settings_table.php +++ b/database/migrations/2025_12_14_090816_create_multiline_settings_table.php @@ -13,7 +13,7 @@ return new class extends Migration { Schema::create('multiline_settings', function (Blueprint $table) { $table->id(); - $table->integer('sport_id')->index()->references('id')->on('sports'); + $table->integer('sport_id')->references('id')->on('sports'); $table->string('name'); $table->string('short'); $table->string('table'); diff --git a/database/seeders/MultilineSettingSeeder.php b/database/seeders/MultilineSettingSeeder.php index 0067b671..0f7f985f 100644 --- a/database/seeders/MultilineSettingSeeder.php +++ b/database/seeders/MultilineSettingSeeder.php @@ -21,13 +21,13 @@ class MultilineSettingSeeder extends Seeder (5, 1, 'TO QUALIFY', 'TQ', 'odds_tq', 4, 0, '2025-12-14 09:32:19', '2025-12-14 09:32:19'), (6, 1, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:32:38', '2025-12-14 09:32:38'), (7, 3, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:37:32', '2025-12-14 09:37:32'), - (8, 3, 'HANDICAP', 'HC', 'odds_handicaps', 4, 1, '2025-12-14 09:38:05', '2025-12-14 09:38:05'), - (9, 3, 'HANDICAP FIRST QUARTER', 'HCQ1', 'odds_handicaps_q1', 4, 1, '2025-12-14 09:38:26', '2025-12-14 09:39:54'), + (8, 3, 'HANDICAP', 'HC', 'odds_points', 4, 1, '2025-12-14 09:38:05', '2025-12-14 09:38:05'), + (9, 3, 'HANDICAP FIRST QUARTER', 'HCQ1', 'odds_points_q1', 4, 1, '2025-12-14 09:38:26', '2025-12-14 09:39:54'), (10, 3, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:38:44', '2025-12-14 09:38:44'), (11, 3, 'TOTALS FIRST QUARTER', 'OUQ1', 'odds_totals_q1', 4, 1, '2025-12-14 09:39:12', '2025-12-14 09:39:59'), (12, 2, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:41:21', '2025-12-14 09:41:21'), (13, 2, '1X2', '1X2', 'odds_3ways', 4, 1, '2025-12-14 09:41:34', '2025-12-14 09:41:34'), - (14, 2, 'HANDICAP', 'HC', 'odds_handicaps', 4, 1, '2025-12-14 09:41:56', '2025-12-14 09:41:56'), + (14, 2, 'HANDICAP', 'HC', 'odds_points', 4, 1, '2025-12-14 09:41:56', '2025-12-14 09:41:56'), (15, 2, 'TOTALS', 'OU', 'odds_totals', 4, 1, '2025-12-14 09:42:13', '2025-12-14 09:42:13'), (16, 5, 'MONEY LINE', 'ML', 'odds_2ways', 4, 0, '2025-12-14 09:43:52', '2025-12-14 09:43:52'), (17, 5, 'MONEY LINE SET 1', 'MLS1', 'odds_2ways_s1', 4, 0, '2025-12-14 09:44:13', '2025-12-14 09:44:13'), diff --git a/database/seeders/SupervisorSeeder.php b/database/seeders/SupervisorSeeder.php index daacd62f..3632de44 100644 --- a/database/seeders/SupervisorSeeder.php +++ b/database/seeders/SupervisorSeeder.php @@ -15,7 +15,7 @@ class SupervisorSeeder extends Seeder $sql = "INSERT INTO `supervisors` (`id`, `name`, `provider_id`, `sport_id`, `sleep`, `limit`, `runtime`, `maxsconds`, `lastcall`, `is_cron`, `is_active`, `days_from`, `days_to`, `created_at`, `updated_at`) VALUES (1, 'Fixtures', 1, 1, 10, 0, '0.073', 1800, 0, 1, 1, 0, 0, '2025-08-27 07:39:55', '2026-01-08 10:23:28'), - (2, 'Odds', 1, 1, 10, 0, '0.251', 30, 0, 0, 1, 0, 0, '2025-12-01 05:41:02', '2025-12-22 05:20:40'), + (2, 'Odds', 1, 1, 10, 0, '0.251', 30, 0, 0, 1, 0, 10, '2025-12-01 05:41:02', '2026-01-08 17:56:27'), (3, 'Fixtures', 2, 0, 15, 0, '0.133', 1800, 0, 1, 1, 0, 0, '2025-12-19 11:42:35', '2026-01-08 10:25:32'), (4, 'Willhill', 2, 0, 15, 0, '2.119', 1800, 0, 1, 1, 0, 0, '2025-12-19 11:48:05', '2026-01-04 10:27:11'), (5, 'Bwin', 2, 0, 15, 0, '0.084', 1800, 0, 1, 1, 0, 0, '2025-12-22 06:41:18', '2026-01-04 10:29:32'), @@ -32,7 +32,10 @@ class SupervisorSeeder extends Seeder (16, 'Odds', 6, 1, 10, 0, '1.368', 30, 0, 0, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-05 06:22:27'), (17, 'Odds', 6, 3, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-05 06:22:37'), (18, 'Odds', 6, 2, 10, 0, '1.368', 30, 0, 0, 1, 0, 0, '2025-12-18 17:44:33', '2026-01-05 06:22:51'), - (19, 'Odds', 6, 5, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-03 12:27:53'); + (19, 'Odds', 6, 5, 15, 0, NULL, 1800, 0, 0, 1, 0, 0, '2026-01-03 12:27:44', '2026-01-03 12:27:53'), + (20, 'Odds', 1, 3, 15, 0, NULL, 1800, 0, 0, 0, 0, 10, '2026-01-08 17:56:50', '2026-01-08 17:56:55'), + (21, 'Odds', 1, 2, 15, 0, NULL, 1800, 0, 0, 0, 0, 10, '2026-01-08 17:57:14', '2026-01-08 17:57:50'), + (22, 'Odds', 1, 5, 15, 0, NULL, 1800, 0, 0, 0, 0, 10, '2026-01-08 17:57:24', '2026-01-08 17:57:52'); "; DB::unprepared($sql); }