wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,232 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Fixtures\FindFixture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3way;
|
||||
use App\Models\OddsDc;
|
||||
use App\Models\OddsGgng;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Betica
|
||||
{
|
||||
public static function switch()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider'], 'g');
|
||||
}
|
||||
|
||||
/**
|
||||
* periods
|
||||
* -1 Today
|
||||
* -2 Next 48hrs
|
||||
* 1 Tomorrow
|
||||
* 2 Saturday
|
||||
* 3 Sunday
|
||||
* 4 Monday
|
||||
* 5 Tuesday
|
||||
* 6 Wednesday
|
||||
* 7 Thursday
|
||||
* 8 Next Week
|
||||
* 9 All
|
||||
*/
|
||||
|
||||
/**
|
||||
* sort_options
|
||||
* 1 Highlights
|
||||
* 2 Start time
|
||||
* 3 Top leagues
|
||||
*/
|
||||
|
||||
/**
|
||||
* with limit
|
||||
* https://api.betika.com/v1/uo/matches?page=1&limit=10&tab=&sub_type_id=1,10,18,29&sport_id=14&tag_id=&sort_id=1&period_id=-1&esports=false
|
||||
*
|
||||
* ohne limit comes 100,
|
||||
* https://api.betika.com/v1/uo/matches?page=1&tab=&sub_type_id=1,10,18,29&sport_id=14&tag_id=&sort_id=1&period_id=9&esports=false
|
||||
*
|
||||
* in meta tag are the totals
|
||||
* "meta": {"total": "1053",
|
||||
*
|
||||
* loop max 100
|
||||
*/
|
||||
|
||||
/**
|
||||
* bettypes
|
||||
* 1 => 1X2
|
||||
* 10 => DOUBLE CHANCE
|
||||
* 18 => TOTAL
|
||||
* 19 => BOTH TEAMS TO SCORE (GG/NG)
|
||||
* sub_type_id=1,10,18,29
|
||||
*/
|
||||
|
||||
/**
|
||||
* TOR exit nodes
|
||||
* TANZANIA, UNITED REPUBLIC OF {tz}
|
||||
* KENYA {ke}
|
||||
* UGANDA {ug}
|
||||
* SOMALIA ? {so}
|
||||
* ETHIOPIA {et}
|
||||
*
|
||||
* ExitNodes {ke},{tz},{ug},{et}
|
||||
* vi /etc/tor/torrc
|
||||
*/
|
||||
for ($page = 1; $page < 20; $page++) {
|
||||
|
||||
$url = "https://api.betika.com/v1/uo/matches?page=$page&limit=100&sub_type_id=1,10,18,29&sport_id=14&sort_id=2&period_id=9&esports=false";
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! is_array($data['data']) or \count($data['data']) == 0) {
|
||||
if ($debug) {
|
||||
Notice::note('NO DATA', 'r');
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
$total = $data['meta']['total'];
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Total: '.$total, 'b');
|
||||
}
|
||||
|
||||
foreach ($data['data'] as $row) {
|
||||
|
||||
if (isset($row['parent_match_id']) && ! $row['is_esport']) {
|
||||
|
||||
$event = [
|
||||
'event_id' => (int) $row['match_id'],
|
||||
'betradar_id' => (int) $row['parent_match_id'] ?? 0,
|
||||
'sport_id' => (int) Nuh::$options['sport_id'],
|
||||
'provider_id' => (int) Nuh::$options['provider_id'],
|
||||
'starttime' => (string) $row['start_time'],
|
||||
'country' => $row['category'] ?? 0,
|
||||
'home' => $row['home_team'] ?? '',
|
||||
'away' => $row['away_team'] ?? '',
|
||||
'group' => $row['competition_name'] ?? '',
|
||||
'group_id' => (int) $row['competition_id'] ?? 0,
|
||||
];
|
||||
|
||||
FindFixture::find($event);
|
||||
|
||||
if (isset($event['id'])) {
|
||||
|
||||
$base = [];
|
||||
$base['sport_id'] = (int) Nuh::$options['sport_id'];
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = (int) $row['match_id'];
|
||||
$base['flag'] = 1;
|
||||
|
||||
foreach ($row['odds'] as $bettypes) {
|
||||
|
||||
switch ($bettypes['sub_type_id']) {
|
||||
case 1:
|
||||
// 1x2
|
||||
$odds = [];
|
||||
foreach ($bettypes['odds'] as $bettype) {
|
||||
if ($bettype['outcome_id'] == 1) {
|
||||
$odds['h3w'] = $bettype['odd_value'];
|
||||
} elseif ($bettype['outcome_id'] == 2) {
|
||||
$odds['d3w'] = $bettype['odd_value'];
|
||||
} elseif ($bettype['outcome_id'] == 3) {
|
||||
$odds['a3w'] = $bettype['odd_value'];
|
||||
}
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['starttime'] = (string) $row['start_time'];
|
||||
|
||||
DB::transaction(function () use ($base, $event, $odds) {
|
||||
Odds3way::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}, 5);
|
||||
|
||||
break;
|
||||
|
||||
case 10:
|
||||
// DOUBLE CHANCE
|
||||
$odds = [];
|
||||
foreach ($bettypes['odds'] as $bettype) {
|
||||
if ($bettype['outcome_id'] == 9) {
|
||||
$odds['dc1x'] = $bettype['odd_value'];
|
||||
} elseif ($bettype['outcome_id'] == 10) {
|
||||
$odds['dc12'] = $bettype['odd_value'];
|
||||
} elseif ($bettype['outcome_id'] == 11) {
|
||||
$odds['dcx2'] = $bettype['odd_value'];
|
||||
}
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
DB::transaction(function () use ($base, $event, $odds) {
|
||||
OddsDc::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}, 5);
|
||||
|
||||
break;
|
||||
|
||||
case 18:
|
||||
// TOTALS
|
||||
$odds = [];
|
||||
foreach ($bettypes['odds'] as $bettype) {
|
||||
if ($bettype['outcome_id'] == 12 && $bettype['odd_key'] == 'over 2.5') {
|
||||
$odds['over'] = $bettype['odd_value'];
|
||||
} elseif ($bettype['outcome_id'] == 13 && $bettype['odd_key'] == 'over 2.5') {
|
||||
$odds['under'] = $bettype['odd_value'];
|
||||
}
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['total'] = 2.5;
|
||||
|
||||
DB::transaction(function () use ($base, $event, $odds) {
|
||||
OddsTotal::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}, 5);
|
||||
|
||||
break;
|
||||
|
||||
case 29:
|
||||
// BOTH TEAMS TO SCORE (GG/NG)
|
||||
$odds = [];
|
||||
foreach ($bettypes['odds'] as $bettype) {
|
||||
if ($bettype['outcome_id'] == 74) {
|
||||
$odds['gg'] = $bettype['odd_value'];
|
||||
} elseif ($bettype['outcome_id'] == 76) {
|
||||
$odds['ng'] = $bettype['odd_value'];
|
||||
}
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
DB::transaction(function () use ($base, $event, $odds) {
|
||||
OddsGgng::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}, 5);
|
||||
|
||||
default:
|
||||
dd($bettypes);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
usleep(rand(10000, 20000));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Grapper\Betsapi\Bet365;
|
||||
use App\Console\Commands\Grapper\Betsapi\Bwin;
|
||||
use App\Console\Commands\Grapper\Betsapi\ElementIcons;
|
||||
use App\Console\Commands\Grapper\Betsapi\Fixtures;
|
||||
use App\Console\Commands\Grapper\Betsapi\Odds;
|
||||
use App\Console\Commands\Grapper\Betsapi\Willhill;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Betsapi
|
||||
{
|
||||
public static function switch()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider'].' '.Nuh::$options['name'], 'b');
|
||||
}
|
||||
|
||||
switch (Nuh::$options['name']) {
|
||||
case 'Fixtures':
|
||||
Fixtures::grap();
|
||||
break;
|
||||
case 'Odds':
|
||||
Odds::grap();
|
||||
break;
|
||||
case 'Willhill':
|
||||
Willhill::grap();
|
||||
break;
|
||||
case 'Bwin':
|
||||
Bwin::grap();
|
||||
break;
|
||||
case 'Bet365':
|
||||
Bet365::grap();
|
||||
break;
|
||||
case 'Element Icons':
|
||||
ElementIcons::grap();
|
||||
break;
|
||||
default:
|
||||
Notice::note('prosses name does not exist', 'r', 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Odds2way;
|
||||
use App\Models\Odds3way;
|
||||
use App\Models\Odds3wayHt;
|
||||
use App\Models\OddsDc;
|
||||
use App\Models\OddsDnb;
|
||||
use App\Models\OddsGgng;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Bet365
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$today = Nuh::$options['t'] ?? 0;
|
||||
|
||||
$week = Nuh::$options['w'] ?? 0;
|
||||
|
||||
$single = Nuh::$options['id'] ?? 0;
|
||||
|
||||
switch (Nuh::$options['sport']) {
|
||||
case 'Soccer':
|
||||
$sport_id = 1;
|
||||
break;
|
||||
case 'Ice Hockey':
|
||||
$sport_id = 2;
|
||||
break;
|
||||
case 'Basketball':
|
||||
$sport_id = 3;
|
||||
break;
|
||||
case 'Tennis':
|
||||
$sport_id = 5;
|
||||
break;
|
||||
default:
|
||||
Notice::note('SPORT NOT IMPLEMENTED', 'r', 1);
|
||||
break;
|
||||
}
|
||||
|
||||
$events_collector = [];
|
||||
|
||||
$has_markets_collector = [];
|
||||
|
||||
/**
|
||||
* Bet365
|
||||
*/
|
||||
$bookmaker_id = 126;
|
||||
|
||||
if ($single) {
|
||||
$events = Event::where('id', Nuh::$options['id'])->where('bet365_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
|
||||
} elseif ($today) {
|
||||
$events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->where('starttime', '>=', Carbon::now())->where('starttime', '<', Carbon::now()->addDay())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
|
||||
} elseif ($week) {
|
||||
$events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->where('starttime', '>=', Carbon::now())->where('starttime', '<', Carbon::now()->addDays(7))->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
|
||||
} else {
|
||||
// all
|
||||
$events = Event::where('sport_id', $sport_id)->where('bet365_id', '>', 0)->where('starttime', '>=', Carbon::now())->select('id', 'sport_id', 'bet365_id', 'starttime')->get();
|
||||
}
|
||||
if ($events ?? null && $debug) {
|
||||
Notice::note('No events', 'r');
|
||||
}
|
||||
foreach ($events as $key => $event) {
|
||||
|
||||
if (! $event->has_markets) {
|
||||
$has_markets_collector[] = $event->id;
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note([
|
||||
'id' => $event->id,
|
||||
'bet365_id' => $event->bet365_id,
|
||||
'starttime' => $event->starttime,
|
||||
'count' => count($events).'/'.$key + 1,
|
||||
], 'b');
|
||||
}
|
||||
/**
|
||||
* BET365 ODDS (per event)
|
||||
*/
|
||||
$url = 'https://api.b365api.com/v4/bet365/prematch?token='.config('env.betsapi_token').'&FI='.$event->bet365_id;
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (isset($data['results'][0]['main'])) {
|
||||
|
||||
DB::transaction(function () use ($event, $bookmaker_id) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event->id,
|
||||
'sport_id' => $event->sport_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['starttime' => $event->starttime, 'in_feed' => 1, 'bmoid' => $event->bet365_id]);
|
||||
}, 5);
|
||||
|
||||
$offer = $data['results'][0]['main']['sp'];
|
||||
|
||||
$base = [];
|
||||
$base['event_id'] = $event->id;
|
||||
$base['bookmaker_id'] = $bookmaker_id;
|
||||
$base['sport_id'] = $event->sport_id;
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = $event->bet365_id;
|
||||
$base['flags'] = 1;
|
||||
|
||||
/**
|
||||
* ML
|
||||
*/
|
||||
if (isset($offer['to_win_match'])) {
|
||||
|
||||
$data = $offer['to_win_match']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['h2w'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['a2w'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_2ways'][] = $event->id;
|
||||
|
||||
$res = Odds2way::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2way::create($odds);
|
||||
} else {
|
||||
$res->h2w = $odds['h2w'];
|
||||
$res->a2w = $odds['a2w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1X2
|
||||
*/
|
||||
if (isset($offer['full_time_result'])) {
|
||||
|
||||
$data = $offer['full_time_result']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($data[2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_3ways'][] = $event->id;
|
||||
|
||||
$res = Odds3way::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->a3w = $odds['d3w'];
|
||||
$res->d3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DC
|
||||
*/
|
||||
if (isset($offer['double_chance'])) {
|
||||
|
||||
$data = $offer['double_chance']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['dc1x'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['dc12'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['dcx2'] = number_format($data[2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_dc'][] = $event->id;
|
||||
|
||||
$res = OddsDc::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($odds);
|
||||
} else {
|
||||
$res->dc1x = $odds['dc1x'];
|
||||
$res->dc12 = $odds['dc12'];
|
||||
$res->dcx2 = $odds['dcx2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OU
|
||||
*/
|
||||
if (isset($offer['goals_over_under'])) {
|
||||
|
||||
$data = $offer['goals_over_under']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['over'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['under'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
if ($base['sport_id'] == 1) {
|
||||
$odds['active_spread'] = 1;
|
||||
}
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_totals'][] = $event->id;
|
||||
|
||||
if ($offer['goals_over_under']['odds'][1]['name'] == '2.5') {
|
||||
$odds['total'] = 2.5;
|
||||
$res = OddsTotal::where('event_id', $event->id)
|
||||
->where('bookmaker_id', $bookmaker_id)
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} else {
|
||||
$res->over = $odds['over'];
|
||||
$res->under = $odds['under'];
|
||||
$res->difference = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GG NG
|
||||
*/
|
||||
if (isset($offer['both_teams_to_score'])) {
|
||||
|
||||
$data = $offer['both_teams_to_score']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['gg'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['ng'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_ggng'][] = $event->id;
|
||||
|
||||
$res = OddsGgng::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($odds);
|
||||
} else {
|
||||
$res->gg = $odds['gg'];
|
||||
$res->ng = $odds['ng'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DNB
|
||||
*/
|
||||
if (isset($offer['draw_no_bet'])) {
|
||||
|
||||
$data = $offer['draw_no_bet']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['dnb1'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['dnb2'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$res = OddsDnb::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_dnb'][] = $event->id;
|
||||
|
||||
if (! $res) {
|
||||
OddsDnb::create($odds);
|
||||
} else {
|
||||
$res->dnb1 = $odds['dnb1'];
|
||||
$res->dnb2 = $odds['dnb2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 1X2 HT
|
||||
*/
|
||||
if (isset($offer['half_time_result'])) {
|
||||
|
||||
$data = $offer['half_time_result']['odds'] ?? [];
|
||||
|
||||
if ($data) {
|
||||
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($data[0]['odds'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($data[1]['odds'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($data[2]['odds'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$events_collector['odds_3ways_ht'][] = $event->id;
|
||||
|
||||
$res = Odds3wayHt::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3wayHt::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->a3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$id_collector = [];
|
||||
foreach ($events_collector as $table => $event_ids) {
|
||||
$id_collector[] = $event_ids;
|
||||
DB::table($table)->where('bookmaker_id', $bookmaker_id)->whereNotIn('event_id', $event_ids)->update(['flags' => 0]);
|
||||
}
|
||||
if ($id_collector) {
|
||||
foreach ($id_collector as $event_id) {
|
||||
if (in_array($event_id, $has_markets_collector)) {
|
||||
Event::where('id', $event_id)->update(['has_markets' => 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Bwin
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$sportmap = Sport::map('bwin');
|
||||
|
||||
foreach ($sportmap as $bwin_sport_id) {
|
||||
|
||||
$page = 1;
|
||||
$total = 10;
|
||||
|
||||
/**
|
||||
* BWIN ODDS & BETRADAR ID (per page)
|
||||
* only get BETRADAR ID no storing of data
|
||||
*/
|
||||
$base_url = 'https://api.b365api.com/v1/bwin/prematch?token='.config('env.betsapi_token').'&skip_markets=1&page=###page###&sport_id='.$bwin_sport_id;
|
||||
|
||||
while ($page <= $total) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Page: $page \Sport: $bwin_sport_id", 'b');
|
||||
}
|
||||
|
||||
$url = str_replace('###page###', $page, $base_url);
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (isset($data['pager'])) {
|
||||
$total = round($data['pager']['total'] / $data['pager']['per_page']);
|
||||
}
|
||||
|
||||
$page++;
|
||||
|
||||
if (isset($data['results'])) {
|
||||
foreach ($data['results'] as $event) {
|
||||
if ($debug && isset($event['HomeTeam']) && isset($event['SportName'])) {
|
||||
Notice::note($event['RegionName'].'-'.$event['SportName']."\n".$event['HomeTeam'].' - '.$event['AwayTeam']);
|
||||
}
|
||||
|
||||
$betsapi_id = $event['our_event_id'] ?? 0;
|
||||
|
||||
$betradar_id = $event['BetRadarId'] ?? 0;
|
||||
|
||||
$bwin_id = $event['Id'] ?? 0;
|
||||
|
||||
if ($betradar_id && $betsapi_id) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(["Betsapi ID : $betsapi_id", "Betradar ID : $betradar_id", "Bwin ID : $bwin_id"]);
|
||||
}
|
||||
|
||||
Event::where('betsapi_id', (int) $betsapi_id)->update(['betradar_id' => $betradar_id, 'bwin_id' => $bwin_id]);
|
||||
|
||||
Mapper::where('betradar_id', $betradar_id)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Element;
|
||||
use App\Models\ElementProvider;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class ElementIcons
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$min_id = 1;
|
||||
while ($min_id > 0) {
|
||||
|
||||
if ($min_id == 1) {
|
||||
$url = 'https://api.b365api.com/v3/team?token='.config('env.betsapi_token').'&sport_id=1&is_esports=1';
|
||||
} else {
|
||||
$url = 'https://api.b365api.com/v3/team?token='.config('env.betsapi_token').'&sport_id=1&is_esports=1&max_id='.$min_id;
|
||||
}
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! $data['success']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$min_id = $data['pager']['min_id'];
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("MinId: $min_id");
|
||||
}
|
||||
|
||||
foreach ($data['results'] as $value) {
|
||||
|
||||
if (! isset($value['is_esports']) && $value['image_id'] > 0 && $value['cc'] != '') {
|
||||
|
||||
$res = ElementProvider::where('provider_id', 2)->where('provider_element_id', (int) $value['id'])->first();
|
||||
|
||||
if ($res) {
|
||||
if ($debug) {
|
||||
Notice::note($value, 'b');
|
||||
}
|
||||
Element::where('id', $res->element_id)->update(['betsapi_image_id' => $value['image_id']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Fixtures\FindFixture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Country;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Fixtures
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$today = Nuh::$options['t'] ?? 0;
|
||||
|
||||
FindFixture::start();
|
||||
|
||||
/**
|
||||
* Delete Started
|
||||
*/
|
||||
$info = Mapper::where('starttime', '<', Carbon::now()->subHours(2))->delete();
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Deleted: $info");
|
||||
}
|
||||
|
||||
$country_map = Country::pluck('id', 'iso2');
|
||||
|
||||
$sportmap = Sport::map('bapi', 0, [1, 2, 3, 5]);
|
||||
|
||||
$now = Carbon::now();
|
||||
|
||||
for ($i = 0; $i < 30; $i++) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Day: '.$now->format('d. M Y'), 'g');
|
||||
}
|
||||
|
||||
$base_url = 'https://api.b365api.com/v3/events/upcoming?sport_id=###sport_id###&page=###page###&day='.$now->format('Ymd').'&skip_esports=1&token='.config('env.betsapi_token');
|
||||
|
||||
$now->addDays(1);
|
||||
|
||||
$total = 1;
|
||||
foreach ($sportmap as $sport_id => $betsapi_sport_id) {
|
||||
|
||||
$sport_url = str_replace('###sport_id###', $betsapi_sport_id, $base_url);
|
||||
|
||||
$page = 1;
|
||||
while ($page <= $total) {
|
||||
|
||||
$url = str_replace('###page###', $page, $sport_url);
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! isset($data['pager'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$page++;
|
||||
|
||||
if (isset($data['pager']['total'])) {
|
||||
$total = round($data['pager']['total'] / $data['pager']['per_page']);
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Page: $page \nTotal: $total");
|
||||
}
|
||||
|
||||
if (isset($data['results']) && \count($data['results'])) {
|
||||
|
||||
foreach ($data['results'] as $row) {
|
||||
|
||||
if (isset($row['home']['id']) && isset($row['away']['id']) && strpos($row['league']['name'], 'Esoccer') === false) {
|
||||
|
||||
$cc = strtoupper($row['league']['cc']);
|
||||
$event = [
|
||||
'event_id' => (int) $row['id'],
|
||||
'bet365_id' => isset($row['bet365_id']) ? $row['bet365_id'] : 0,
|
||||
'sport_id' => (int) $sport_id,
|
||||
'provider_id' => (int) Nuh::$options['provider_id'],
|
||||
'starttime' => Carbon::createFromTimestamp((string) $row['time'])->toDateTimeString(),
|
||||
'country_id' => $country_map[$cc] ?? 0,
|
||||
'home' => $row['home']['name'] ?? '',
|
||||
'home_id' => (int) $row['home']['id'],
|
||||
'home_cc' => strtoupper($row['home']['cc']) ?? '',
|
||||
'away' => $row['away']['name'] ?? '',
|
||||
'away_id' => (int) $row['away']['id'],
|
||||
'away_cc' => strtoupper($row['away']['cc']) ?? '',
|
||||
'group' => $row['league']['name'] ?? '',
|
||||
'group_id' => (int) $row['league']['id'] ?? 0,
|
||||
'group_cc' => strtoupper($row['league']['cc']) ?? '',
|
||||
];
|
||||
|
||||
FindFixture::find($event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($today) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\Odds3way;
|
||||
use App\Models\Supervisor;
|
||||
use App\Utilities\Margin;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds
|
||||
{
|
||||
/**
|
||||
* Create a new class instance.
|
||||
*/
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$today = Nuh::$options['t'] ?? 0;
|
||||
|
||||
$week = Nuh::$options['w'] ?? 0;
|
||||
|
||||
$single = Nuh::$options['id'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('BETSAPI ODDS '.Nuh::$options['sport'], 'b');
|
||||
}
|
||||
|
||||
$sources = [83 => 'pinnaclesports'];
|
||||
|
||||
$flags = [];
|
||||
|
||||
if ($single) {
|
||||
$events = Event::where('id', Nuh::$options['id'])->where('betsapi_id', '>', 0)->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
|
||||
} elseif ($today) {
|
||||
$events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->where('starttime', '>=', Carbon::now())->where('starttime', '<', Carbon::now()->addDay())->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
|
||||
} elseif ($week) {
|
||||
$events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->where('starttime', '>=', Carbon::now())->where('starttime', '<', Carbon::now()->addDays(7))->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
|
||||
} else {
|
||||
// all
|
||||
$events = Event::where('sport_id', Nuh::$options['sport_id'])->where('betsapi_id', '>', 0)->where('starttime', '>=', Carbon::now())->select('id', 'sport_id', 'bet365_id', 'betsapi_id', 'starttime')->get();
|
||||
}
|
||||
|
||||
foreach ($events as $key => $event) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note([
|
||||
'id' => $event->id,
|
||||
'betsapi_id' => $event->betsapi_id,
|
||||
'starttime' => $event->starttime,
|
||||
'count' => count($events).'/'.$key + 1,
|
||||
], 'b');
|
||||
}
|
||||
|
||||
$since_time = Nuh::$options['lastcall'] - 600;
|
||||
|
||||
$since_time = 0;
|
||||
|
||||
foreach ($sources as $bookmaker_id => $source) {
|
||||
|
||||
$url = 'https://api.b365api.com/v2/event/odds?token='.config('env.betsapi_token').'&source'.$source.'&since_time='.$since_time.'&event_id='.$event->betsapi_id;
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
$base = [];
|
||||
$base['event_id'] = $event->id;
|
||||
$base['bookmaker_id'] = $bookmaker_id;
|
||||
$base['sport_id'] = $event->sport_id;
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = $event->betsapi_id;
|
||||
$base['flag'] = 1;
|
||||
|
||||
foreach ($data['results']['odds'] as $key => $value) {
|
||||
switch ($key) {
|
||||
case '1_1':
|
||||
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($value[0]['home_od'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($value[0]['draw_od'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($value[0]['away_od'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$flags['odds_3ways'][] = $event->id;
|
||||
|
||||
$res = Odds3way::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->a3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
break;
|
||||
case '1_3':
|
||||
|
||||
// dd($value);
|
||||
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($value[0]['home_od'], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($value[0]['draw_od'], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($value[0]['away_od'], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = Odds3way::where('event_id', $event->id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->a3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Supervisor::where('id', Nuh::$options['supervisor_id'])->update(['lastcall' => time()]);
|
||||
|
||||
}
|
||||
// needs check
|
||||
foreach ($flags as $table => $event_ids) {
|
||||
DB::table($table)->where('bookmaker_id', $bookmaker_id)->whereNotIn('event_id', $event_ids)->update(['flags' => 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Fixtures\StoreElement;
|
||||
use App\Console\Commands\Grapper\Fixtures\StoreGroup;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use App\Models\Odds2way;
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Willhill
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
/**
|
||||
* williamhill
|
||||
*/
|
||||
$bookmaker_id = 42;
|
||||
$collection = [];
|
||||
|
||||
$res = Odds3way::with('event')->where('bookmaker_id', $bookmaker_id)->get();
|
||||
foreach ($res as $value) {
|
||||
if ($value->event->starttime > Carbon::now() && $value->event->starttime < Carbon::now()->addDays(7) && $value->event->betsapi_id == 0) {
|
||||
$collection[] = [
|
||||
'txodds_id' => $value->event_id,
|
||||
'willhill_id' => $value->bmoid,
|
||||
'sport_id' => $value->sport_id,
|
||||
];
|
||||
}
|
||||
}
|
||||
$res = Odds2way::with('event')->where('bookmaker_id', $bookmaker_id)->get();
|
||||
foreach ($res as $value) {
|
||||
if ($value->event->starttime > Carbon::now() && $value->event->starttime < Carbon::now()->addDays(7) && $value->event->betsapi_id == 0) {
|
||||
$collection[] = [
|
||||
'txodds_id' => $value->event_id,
|
||||
'willhill_id' => $value->bmoid,
|
||||
'sport_id' => $value->sport_id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($collection as $event) {
|
||||
|
||||
$url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$event['willhill_id'];
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
$betsapi_id = $data['results'][0]['id'] ?? 0;
|
||||
|
||||
$bet365_id = $data['results'][0]['bet365_id'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
$arr = [
|
||||
'Mapper TXOdds to Bet365',
|
||||
'TXdds ID : '.$event['txodds_id'],
|
||||
"Bet365 ID : $bet365_id",
|
||||
'Willhill ID : '.$event['willhill_id'],
|
||||
'Sport ID : '.$event['sport_id'],
|
||||
];
|
||||
Notice::note($arr, 'b');
|
||||
}
|
||||
|
||||
if ($betsapi_id) {
|
||||
|
||||
if (isset($data['results'][0]['home'])) {
|
||||
|
||||
$match = Event::where('id', (int) $event['txodds_id'])->first();
|
||||
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$ele['provider_id'] = Nuh::$options['provider_id'];
|
||||
$ele['element_id'] = $match->home_id ?? 0;
|
||||
$ele['provider_element_id'] = $data['results'][0]['home']['id'] ?? 0;
|
||||
$ele['name'] = $data['results'][0]['home']['name'];
|
||||
StoreElement::store($elements, $ele);
|
||||
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$ele['provider_id'] = Nuh::$options['provider_id'];
|
||||
$ele['element_id'] = $match->away_id ?? 0;
|
||||
$ele['provider_element_id'] = $data['results'][0]['away']['id'] ?? 0;
|
||||
$ele['name'] = $data['results'][0]['away']['name'];
|
||||
StoreElement::store($elements, $ele);
|
||||
|
||||
$group = [];
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$group['provider_id'] = Nuh::$options['provider_id'];
|
||||
$group['competition_group_id'] = $match->competition_group_id;
|
||||
$group['provider_group_id'] = $data['results'][0]['league']['id'] ?? 0;
|
||||
$group['name'] = $data['results'][0]['league']['name'];
|
||||
StoreGroup::store($groups, $group);
|
||||
|
||||
$match->betsapi_id = $betsapi_id;
|
||||
$match->bet365_id = $bet365_id;
|
||||
$match->save();
|
||||
|
||||
if ($betsapi_id) {
|
||||
Mapper::where('event_id', $betsapi_id)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Fixtures;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Mapper;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class FindFixture
|
||||
{
|
||||
public static $elements = [];
|
||||
|
||||
public static $groups = [];
|
||||
|
||||
/***
|
||||
"event_id" => 3864842
|
||||
"betradar_id" => 62924779
|
||||
"sport_id" => 3
|
||||
"provider_id" => 3
|
||||
"country_id" => 128
|
||||
"country" => "USA"
|
||||
"group_id" => 1301
|
||||
"group" => "NBA"
|
||||
"starttime" => "2026-02-22 20:30:00"
|
||||
"home_id" => 6855
|
||||
"home" => "Golden State Warriors"
|
||||
"away_id" => 6843
|
||||
"away" => "Denver Nuggets"
|
||||
*/
|
||||
|
||||
public static function start()
|
||||
{
|
||||
self::$elements = LoadElements::load(Nuh::$options['provider_id'], true);
|
||||
|
||||
self::$groups = LoadGroups::load(Nuh::$options['provider_id'], true);
|
||||
}
|
||||
|
||||
public static function find(&$event)
|
||||
{
|
||||
$event_id = $event['event_id'];
|
||||
|
||||
$betradar_id = $event['betradar_id'] ?? 0;
|
||||
|
||||
$betsapi_id = $event['betsapi_id'] ?? 0;
|
||||
|
||||
$bet365_id = $event['bet365_id'] ?? 0;
|
||||
|
||||
$_1xbet_id = $event['_1xbet_id'] ?? 0;
|
||||
|
||||
$bwin_id = $event['bwin_id'] ?? 0;
|
||||
|
||||
/*************************************************
|
||||
* USE ID
|
||||
*************************************************/
|
||||
|
||||
// DEFAULT BETRADAR
|
||||
if ($betradar_id) {
|
||||
$match = Event::where('betradar_id', $betradar_id)->first();
|
||||
}
|
||||
if (! isset($match) or ! $match) {
|
||||
switch ($event['provider_id']) {
|
||||
case 2:
|
||||
// BETSAPI
|
||||
$match = Event::where('betsapi_id', '=', $event_id)->first();
|
||||
break;
|
||||
case 3:
|
||||
// MAGLOO KENIA
|
||||
$res = EventBookmaker::where('bookmaker_id', 10)->where('event_id', $event_id)->first();
|
||||
if ($res) {
|
||||
$match = Event::where('id', $res->event_id)->first();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// MAGLOO NIGERIA
|
||||
$res = EventBookmaker::where('bookmaker_id', 16)->where('event_id', $event_id)->first();
|
||||
if ($res) {
|
||||
$match = Event::where('id', $res->event_id)->first();
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// LOGIFUTUR NIGERA
|
||||
$res = EventBookmaker::where('bookmaker_id', 35)->where('event_id', $event_id)->first();
|
||||
if ($res) {
|
||||
$match = Event::where('id', $res->event_id)->first();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
// LOGIFUTUR COLOMBIA
|
||||
$res = EventBookmaker::where('bookmaker_id', 36)->where('event_id', $event_id)->first();
|
||||
if ($res) {
|
||||
$match = Event::where('id', $res->event_id)->first();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($match)) {
|
||||
|
||||
$update_array = [];
|
||||
|
||||
if ($betradar_id && ! $match->betradar_id) {
|
||||
$update_array['betradar_id'] = $betradar_id;
|
||||
}
|
||||
if ($betsapi_id && ! $match->betsapi_id) {
|
||||
$update_array['betsapi_id'] = $betsapi_id;
|
||||
}
|
||||
if ($bet365_id && ! $match->bet365_id) {
|
||||
$update_array['bet365_id'] = $bet365_id;
|
||||
}
|
||||
if ($_1xbet_id && ! $match->_1xbet_id) {
|
||||
$update_array['bet365_id'] = $_1xbet_id;
|
||||
}
|
||||
if ($bwin_id && ! $match->bwin_id) {
|
||||
$update_array['bwin_id'] = $bwin_id;
|
||||
}
|
||||
|
||||
if ($update_array) {
|
||||
DB::transaction(function () use ($match, $update_array) {
|
||||
Event::where('id', $match->id)->update($update_array);
|
||||
}, 5);
|
||||
}
|
||||
|
||||
if (! in_array(Nuh::$options['provider_id'], [5, 6, 9])) {
|
||||
StoreData::store($event, $match);
|
||||
}
|
||||
|
||||
Mapper::where('event_id', $event_id)->delete();
|
||||
|
||||
$event['id'] = $match->id;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (in_array(Nuh::$options['provider_id'], [3, 4, 5, 6, 9, 10])) {
|
||||
Mapper::updateOrCreate(['event_id' => $event_id], $event);
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* FIND
|
||||
*************************************************/
|
||||
if (isset($event['home_id']) && isset($event['away_id']) && isset($event['group_id'])) {
|
||||
|
||||
$starttime = $event['starttime'];
|
||||
|
||||
$from = Carbon::createFromDate($starttime)->subDay();
|
||||
|
||||
$to = Carbon::createFromDate($starttime)->addDay();
|
||||
|
||||
$home_id = FindFixture::$elements[$event['home_id']] ?? 0;
|
||||
|
||||
$away_id = FindFixture::$elements[$event['away_id']] ?? 0;
|
||||
|
||||
$competition_group_id = FindFixture::$groups[$event['group_id']] ?? 0;
|
||||
|
||||
if ($home_id && $away_id && $competition_group_id) {
|
||||
|
||||
$match_id = Event::query()
|
||||
->where('home_id', $home_id)
|
||||
->where('away_id', $away_id)
|
||||
->where('competition_group_id', $competition_group_id)
|
||||
->where('starttime', '>', $from)
|
||||
->where('starttime', '<', $to)
|
||||
->value('id');
|
||||
|
||||
if ($match_id) {
|
||||
|
||||
$event['id'] = $match_id;
|
||||
|
||||
$update_array = [];
|
||||
|
||||
if ($betradar_id) {
|
||||
$update_array['betradar_id'] = $betradar_id;
|
||||
}
|
||||
if ($betsapi_id) {
|
||||
$update_array['betsapi_id'] = $betsapi_id;
|
||||
}
|
||||
if ($bet365_id) {
|
||||
$update_array['bet365_id'] = $bet365_id;
|
||||
}
|
||||
|
||||
if ($update_array) {
|
||||
Event::where('id', $match_id)->update($update_array);
|
||||
}
|
||||
|
||||
} else {
|
||||
Mapper::updateOrCreate(['event_id' => $event_id], $event);
|
||||
}
|
||||
} else {
|
||||
Mapper::updateOrCreate(['event_id' => $event_id], $event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Fixtures;
|
||||
|
||||
use App\Models\ElementProvider;
|
||||
|
||||
class LoadElements
|
||||
{
|
||||
public static function load($provider_id, $load_by_name = false)
|
||||
{
|
||||
$res = ElementProvider::where('provider_id', $provider_id)->get();
|
||||
|
||||
$r = [];
|
||||
foreach ($res as $val) {
|
||||
if ($load_by_name) {
|
||||
$r[$val->sport_id][$val->name] = $val->element_id;
|
||||
} else {
|
||||
$r[$val->sport_id][$val->provider_element_id] = $val->element_id;
|
||||
}
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Fixtures;
|
||||
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
|
||||
class LoadGroups
|
||||
{
|
||||
public static function load($provider_id, $load_by_name = false)
|
||||
{
|
||||
$res = CompetitionGroupProvider::where('provider_id', $provider_id)->get();
|
||||
|
||||
$r = [];
|
||||
foreach ($res as $val) {
|
||||
if ($load_by_name) {
|
||||
$r[$val->sport_id][$val->name] = $val->competition_group_id;
|
||||
} else {
|
||||
$r[$val->sport_id][$val->provider_group_id] = $val->competition_group_id;
|
||||
}
|
||||
}
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Fixtures;
|
||||
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
use App\Models\ElementProvider;
|
||||
|
||||
class StoreData
|
||||
{
|
||||
public static function store(&$event, &$match)
|
||||
{
|
||||
$home_id = FindFixture::$elements[$event['home_id']] ?? 0;
|
||||
|
||||
$away_id = FindFixture::$elements[$event['away_id']] ?? 0;
|
||||
|
||||
$competition_group_id = FindFixture::$groups[$event['group_id']] ?? 0;
|
||||
|
||||
if (! $home_id) {
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$ele['provider_id'] = $event['provider_id'];
|
||||
$ele['element_id'] = $match->home_id ?? 0;
|
||||
$home['add_by_method_id'] = 1;
|
||||
$ele['name'] = $event['home'];
|
||||
ElementProvider::updateOrCreate(['provider_element_id' => (int) $event['home_id']], $ele);
|
||||
}
|
||||
|
||||
if (! $away_id) {
|
||||
$ele = [];
|
||||
$ele['sport_id'] = $event['sport_id'];
|
||||
$ele['provider_id'] = $event['provider_id'];
|
||||
$ele['element_id'] = $match->away_id ?? 0;
|
||||
$home['add_by_method_id'] = 1;
|
||||
$ele['name'] = $event['away'];
|
||||
ElementProvider::updateOrCreate(['provider_element_id' => (int) $event['away_id']], $ele);
|
||||
}
|
||||
|
||||
if (! $competition_group_id) {
|
||||
$group = [];
|
||||
$group['sport_id'] = $event['sport_id'];
|
||||
$group['provider_id'] = $event['provider_id'];
|
||||
$group['competition_group_id'] = $match->competition_group_id;
|
||||
$home['add_by_method_id'] = 1;
|
||||
$group['name'] = $event['group'];
|
||||
CompetitionGroupProvider::updateOrCreate(['provider_group_id' => (int) $event['group_id']], $group);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Fixtures;
|
||||
|
||||
use App\Models\ElementProvider;
|
||||
|
||||
class StoreElement
|
||||
{
|
||||
public static function store(&$elements, $ele)
|
||||
{
|
||||
$provider_element_id = $ele['provider_element_id'] ?? 0;
|
||||
|
||||
unset($ele['provider_element_id']);
|
||||
|
||||
$ele['add_by_method_id'] = 1;
|
||||
|
||||
$sport_id = $ele['sport_id'] ?? 0;
|
||||
|
||||
if ($sport_id && ! isset($elements[$sport_id][$provider_element_id])) {
|
||||
|
||||
ElementProvider::updateOrCreate(['provider_element_id' => (int) $provider_element_id], $ele);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Fixtures;
|
||||
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
|
||||
class StoreGroup
|
||||
{
|
||||
public static function store(&$groups, $group)
|
||||
{
|
||||
$provider_group_id = $group['provider_group_id'] ?? 0;
|
||||
|
||||
unset($group['provider_group_id']);
|
||||
|
||||
$sport_id = $group['sport_id'] ?? 0;
|
||||
|
||||
$ele['add_by_method_id'] = 1;
|
||||
|
||||
if ($sport_id && ! isset($groups[$sport_id][$provider_group_id])) {
|
||||
|
||||
CompetitionGroupProvider::updateOrCreate(['provider_group_id' => (int) $provider_group_id], $group);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Grapper\Fixtures\FindFixture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3way;
|
||||
use App\Models\OddsDc;
|
||||
use App\Models\OddsGgng;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Goldbet
|
||||
{
|
||||
public static function switch()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$save = Nuh::$options['s'] ?? 0;
|
||||
$read = Nuh::$options['r'] ?? 0;
|
||||
|
||||
$filename = app_path().'/Console/Commands/TestFiles/goldbet.json';
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider'], 'g');
|
||||
}
|
||||
|
||||
if ($read) {
|
||||
if ($debug) {
|
||||
Notice::note('data read localy', 'g');
|
||||
}
|
||||
|
||||
$file = file_get_contents($filename);
|
||||
|
||||
$data = json_decode($file, true);
|
||||
} else {
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://gb.nuhodds.com');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: jjW2jVVezcMURUBuhzf6VDXXsMhN5JWKEeQ5pYusg7b29G',
|
||||
'Proxy-Target-URL: '.Nuh::$options['base_url'],
|
||||
// 'Proxy-Debug: 1'
|
||||
]);
|
||||
|
||||
$file = curl_exec($ch);
|
||||
}
|
||||
|
||||
if ($save) {
|
||||
file_put_contents($filename, $file);
|
||||
|
||||
Notice::note('file saved localy', 'g');
|
||||
}
|
||||
|
||||
$data = json_decode($file, true);
|
||||
|
||||
// https://api.b365api.com/v1/sbobet/event?token=36152-aeTRNnZxSPUwGe&event_id=10399052
|
||||
// https://api.b365api.com/v1/sbobet/inplay?sport_id=1&token=36152-aeTRNnZxSPUwGe
|
||||
|
||||
foreach ($data as $row) {
|
||||
if ($row['liga'] != 'Fantasy Matches') {
|
||||
|
||||
/**
|
||||
* sportid is same like txoods
|
||||
*/
|
||||
$event = [
|
||||
'event_id' => (int) $row['matchid'],
|
||||
'sport_id' => (int) $row['sport'],
|
||||
'provider_id' => (int) Nuh::$options['provider_id'],
|
||||
'starttime' => (string) Carbon::createFromTimestamp((string) $row['starttime'])->toDateTimeString(),
|
||||
'country' => $row['country'] ?? 0,
|
||||
'country_id' => (int) $row['countryid'] ?? 0,
|
||||
'home' => $row['e1'] ?? '',
|
||||
'home_id' => (int) $row['e2id'],
|
||||
'away' => $row['e2'] ?? '',
|
||||
'away_id' => (int) $row['e2id'],
|
||||
'group' => $row['liga'] ?? '',
|
||||
'group_id' => (int) $row['lid'] ?? 0,
|
||||
];
|
||||
|
||||
FindFixture::find($event);
|
||||
|
||||
if (isset($event['id'])) {
|
||||
|
||||
$base = [];
|
||||
$base['sport_id'] = (int) Nuh::$options['sport_id'];
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = (int) $row['match_id'];
|
||||
$base['flag'] = 1;
|
||||
|
||||
if (isset($row['1x2'])) {
|
||||
$odds = [];
|
||||
$odds['h3w'] = $row['1x2']['one'];
|
||||
$odds['d3w'] = $row['1x2']['x'];
|
||||
$odds['a3w'] = $row['1x2']['two'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['starttime'] = (string) $row['start_time'];
|
||||
|
||||
Odds3way::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}
|
||||
if (isset($row['ou'])) {
|
||||
$odds = [];
|
||||
$odds['over'] = $row['ou']['over'];
|
||||
$odds['under'] = $row['ou']['under'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['total'] = 2.5;
|
||||
|
||||
OddsTotal::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}
|
||||
if (isset($row['dc'])) {
|
||||
$odds = [];
|
||||
$odds['dc1x'] = $row['dc']['dc1x'];
|
||||
$odds['dc12'] = $row['dc']['dc12'];
|
||||
$odds['dcx2'] = $row['dc']['dcx2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['starttime'] = (string) $row['start_time'];
|
||||
|
||||
OddsDc::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}
|
||||
if (isset($row['gg_ng'])) {
|
||||
$odds = [];
|
||||
$odds['gg'] = $row['gg_ng']['gg'];
|
||||
$odds['ng'] = $row['gg_ng']['ng'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['starttime'] = (string) $row['start_time'];
|
||||
|
||||
OddsGgng::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], $base + $odds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Grapper\Fixtures\FindFixture;
|
||||
use App\Console\Commands\Grapper\Logifuture\Basketball;
|
||||
use App\Console\Commands\Grapper\Logifuture\Icehockey;
|
||||
use App\Console\Commands\Grapper\Logifuture\Soccer;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tennis;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\Authentication;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureData;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\MapEvent;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Logifuture
|
||||
{
|
||||
public static $auth_header = [];
|
||||
|
||||
public static $base_url = '';
|
||||
|
||||
public static function switch()
|
||||
{
|
||||
// dd(Nuh::$options);
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$echo_data = Nuh::$options['e'] ?? 0;
|
||||
|
||||
$sportmap = Sport::map('logi', 1, [Nuh::$options['sport_id']]);
|
||||
|
||||
$event_id_collector = [];
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider'].' '.Nuh::$options['sport'], 'g');
|
||||
}
|
||||
|
||||
Authentication::authenticate();
|
||||
|
||||
foreach ($sportmap as $logifuture_sport_id => $sport_id) {
|
||||
|
||||
$matches = LogifutureData::load($logifuture_sport_id);
|
||||
|
||||
// Notice::note($matches, 'b');
|
||||
|
||||
if ($echo_data) {
|
||||
Notice::note($matches, 'g');
|
||||
}
|
||||
|
||||
if (! is_array($matches)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! isset($matches['error'])) {
|
||||
|
||||
foreach ($matches as $match) {
|
||||
|
||||
// Notice::note($match, 'r');
|
||||
|
||||
if (strpos($match['sportCategory'], 'Simulated Reality') === false) {
|
||||
|
||||
$event = MapEvent::filter($sport_id, $match);
|
||||
|
||||
FindFixture::find($event);
|
||||
|
||||
// Notice::note($event, 'r');
|
||||
|
||||
if (isset($event['id']) && Event::where('id', $event['id'])->exists()) {
|
||||
|
||||
// Notice::note($event, 'b');
|
||||
|
||||
$event_id_collector[] = $event['id'];
|
||||
|
||||
DB::transaction(function () use ($event, $sport_id) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], ['in_feed' => 1, 'bmoid' => $event['id'], 'starttime' => $event['starttime']]);
|
||||
}, 5);
|
||||
|
||||
switch ($sport_id) {
|
||||
case 1:
|
||||
Soccer::get($event, $match);
|
||||
break;
|
||||
case 2:
|
||||
Icehockey::get($event, $match);
|
||||
break;
|
||||
case 3:
|
||||
Basketball::get($event, $match);
|
||||
break;
|
||||
case 5:
|
||||
Tennis::get($event, $match);
|
||||
break;
|
||||
|
||||
default:
|
||||
Notice::note('SPORT NOT IMPLEMENTED', 'r', 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($event_id_collector) {
|
||||
|
||||
if ($debug) {
|
||||
// Notice::note($event_id_collector, 'r');
|
||||
}
|
||||
|
||||
EventBookmaker::whereNotIn('event_id', $event_id_collector)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->update(['in_feed' => 0]);
|
||||
|
||||
$tables = ['odds_2ways', 'odds_2ways_s1', 'odds_3ways', 'odds_totals', 'odds_points', 'odds_ggng', 'odds_dc', 'odds_tq', 'odds_points_q1', 'odds_totals_q1'];
|
||||
foreach ($tables as $table) {
|
||||
DB::transaction(function () use ($table, $event_id_collector) {
|
||||
DB::table($table)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->whereNotIn('event_id', $event_id_collector)->update(['flags' => 0]);
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\FilterHandicap;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStorePoints;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotals;
|
||||
use App\Console\Commands\Nuh;
|
||||
|
||||
class Basketball
|
||||
{
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$n_totals = [];
|
||||
$n_totals_qt = [];
|
||||
$n_points = [];
|
||||
$n_points_qt = [];
|
||||
|
||||
$c_totals = [];
|
||||
$c_totals_qt = [];
|
||||
$c_points = [];
|
||||
$c_points_qt = [];
|
||||
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
/*
|
||||
case 'B_1X2_1':
|
||||
$event['h3w'] = $value;
|
||||
break;
|
||||
case 'B_1X2_X':
|
||||
$event['d3w'] = $value;
|
||||
break;
|
||||
case 'B_1X2_2':
|
||||
$event['a3w'] = $value;
|
||||
break;
|
||||
|
||||
case 'B_12_1':
|
||||
$_bai_2way['h2w'] = $value;
|
||||
break;
|
||||
case 'B_12_2':
|
||||
$_bai_2way['a2w'] = $value;
|
||||
break;
|
||||
*/
|
||||
|
||||
if (strpos($name, '@') !== false) {
|
||||
$pos = strpos($name, '@');
|
||||
$market = substr($name, 0, $pos);
|
||||
|
||||
switch ($market) {
|
||||
// NIGERIA
|
||||
case 'B_OUN':
|
||||
$n_totals[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_1QOU':
|
||||
$n_totals_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_H':
|
||||
$n_points[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_1QH':
|
||||
$n_points_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
// COLOMBIA
|
||||
case 'B_OUHND':
|
||||
$c_totals[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_OUHND1P':
|
||||
$c_totals_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_12HND':
|
||||
$c_points[$name] = number_format($value, 2);
|
||||
break;
|
||||
case 'B_12HND1P':
|
||||
$c_points_qt[$name] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$_spreads = [];
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'B_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_totals_qt) {
|
||||
FilterHandicap::filter($_spreads['total_qt'], 'B_OUHND1P@', $c_totals_qt, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'B_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
if ($c_points_qt) {
|
||||
FilterHandicap::filter($_spreads['point_qt'], 'B_12HND1P@', $c_points_qt, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'B_OUN@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_totals_qt) {
|
||||
FilterHandicap::filter($_spreads['total_qt'], 'B_1QOU@', $n_totals_qt, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'B_H@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
if ($n_points_qt) {
|
||||
FilterHandicap::filter($_spreads['point_qt'], 'B_1QH@', $n_points_qt, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
$base = [];
|
||||
$base['event_id'] = $event['id'];
|
||||
$base['bookmaker_id'] = $event['bookmaker_id'];
|
||||
$base['sport_id'] = $event['sport_id'];
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = $event['event_id'];
|
||||
$base['flags'] = 1;
|
||||
|
||||
if (isset($_spreads['total'])) {
|
||||
LogifutureStoreTotals::store($_spreads['total'], $base);
|
||||
}
|
||||
if (isset($_spreads['point'])) {
|
||||
LogifutureStorePoints::store($_spreads['point'], $base);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\FilterHandicap;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStorePoints;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStorePointsQ1;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotals;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotalsQ1;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2way;
|
||||
use App\Models\Odds2wayS1;
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Icehockey
|
||||
{
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$ml = [];
|
||||
$mls1 = [];
|
||||
$_3way = [];
|
||||
$n_totals = [];
|
||||
$n_points = [];
|
||||
$c_totals = [];
|
||||
$c_points = [];
|
||||
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'IH_1X2_1':
|
||||
$_3way['h3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_1X2_X':
|
||||
$_3way['d3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_1X2_2':
|
||||
$_3way['a3w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'IH_12_1':
|
||||
$ml['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_12_2':
|
||||
$ml['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'IH_12OTAP_1':
|
||||
$mls1['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'IH_12OTAP_2':
|
||||
$mls1['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strpos($name, '@') !== false) {
|
||||
$pos = strpos($name, '@');
|
||||
$market = substr($name, 0, $pos);
|
||||
|
||||
switch ($market) {
|
||||
// NIGERIA
|
||||
case 'IH_TF':
|
||||
$n_totals[$name] = $value;
|
||||
break;
|
||||
case 'IH_HR1':
|
||||
$n_points[$name] = $value;
|
||||
break;
|
||||
|
||||
// COLOMBIA
|
||||
case 'IH_OUHND':
|
||||
$c_totals[$name] = $value;
|
||||
break;
|
||||
case 'IH_12HND':
|
||||
$c_points[$name] = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$base = [];
|
||||
$base['event_id'] = $event['id'];
|
||||
$base['bookmaker_id'] = $event['bookmaker_id'];
|
||||
$base['sport_id'] = $event['sport_id'];
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = $event['event_id'];
|
||||
$base['flags'] = 1;
|
||||
|
||||
// 1x2
|
||||
if (\count($_3way) == 3) {
|
||||
|
||||
$_3way['margin'] = (float) Margin::calculate($_3way, 1);
|
||||
|
||||
$_3way = array_merge($_3way, $base);
|
||||
|
||||
$res = Odds3way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($_3way);
|
||||
} else {
|
||||
$res->h3w = number_format($_3way['h3w'], 2);
|
||||
$res->d3w = number_format($_3way['d3w'], 2);
|
||||
$res->a3w = number_format($_3way['a3w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_3way['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// ML
|
||||
if (\count($ml) == 2) {
|
||||
|
||||
$ml['margin'] = (float) Margin::calculate($ml, 1);
|
||||
|
||||
$ml = array_merge($ml, $base);
|
||||
|
||||
$res = Odds2way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2way::create($ml);
|
||||
} else {
|
||||
$res->h2w = number_format($ml['h2w'], 2);
|
||||
$res->a2w = number_format($ml['a2w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $ml['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
if (\count($mls1) == 2) {
|
||||
|
||||
$mls1['margin'] = (float) Margin::calculate($mls1, 1);
|
||||
|
||||
$mls1 = array_merge($mls1, $base);
|
||||
|
||||
$res = Odds2wayS1::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2wayS1::create($mls1);
|
||||
} else {
|
||||
$res->h2w = number_format($mls1['h2w'], 2);
|
||||
$res->a2w = number_format($mls1['a2w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $mls1['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'IH_OUHND@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'IH_12HND@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'IH_TF@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'IH_HR1@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
if (isset($_spreads['total'])) {
|
||||
LogifutureStoreTotals::store($_spreads['total'], $base);
|
||||
}
|
||||
if (isset($_spreads['total_qt'])) {
|
||||
LogifutureStoreTotalsQ1::store($_spreads['total_qt'], $base);
|
||||
}
|
||||
if (isset($_spreads['point'])) {
|
||||
LogifutureStorePoints::store($_spreads['point'], $base);
|
||||
}
|
||||
if (isset($_spreads['point_qt'])) {
|
||||
LogifutureStorePointsQ1::store($_spreads['point_qt'], $base);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3way;
|
||||
use App\Models\OddsDc;
|
||||
use App\Models\OddsGgng;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Models\OddsTq;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Soccer
|
||||
{
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$_3way = [];
|
||||
$_total = [];
|
||||
$_ggng = [];
|
||||
$_dc = [];
|
||||
$_tq = [];
|
||||
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'S_1X2_1':
|
||||
$_3way['h3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_1X2_X':
|
||||
$_3way['d3w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_1X2_2':
|
||||
$_3way['a3w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_OU@2.5_O':
|
||||
$_total['over'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_OU@2.5_U':
|
||||
$_total['under'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_GGNG_Y':
|
||||
$_ggng['gg'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_GGNG_N':
|
||||
$_ggng['ng'] = number_format($value, 2);
|
||||
break;
|
||||
// case 'S_DNB_1':
|
||||
// break;
|
||||
// case 'S_DNB_2':
|
||||
// break;
|
||||
case 'S_DC_12':
|
||||
$_dc['dc12'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_DC_1X':
|
||||
$_dc['dc1x'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_DC_X2':
|
||||
$_dc['dcx2'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'S_12QUALIFY_1':
|
||||
$_tq['htq'] = number_format($value, 2);
|
||||
break;
|
||||
case 'S_12QUALIFY_2':
|
||||
$_tq['atq'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$base = [];
|
||||
$base['event_id'] = $event['id'];
|
||||
$base['bookmaker_id'] = $event['bookmaker_id'];
|
||||
$base['sport_id'] = $event['sport_id'];
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = $event['event_id'];
|
||||
$base['flags'] = 1;
|
||||
|
||||
// 1x2
|
||||
if (\count($_3way) == 3) {
|
||||
|
||||
$_3way['margin'] = (float) Margin::calculate($_3way, 1);
|
||||
|
||||
$_3way = array_merge($_3way, $base);
|
||||
|
||||
$res = Odds3way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($_3way);
|
||||
} else {
|
||||
$res->h3w = number_format($_3way['h3w'], 2);
|
||||
$res->d3w = number_format($_3way['d3w'], 2);
|
||||
$res->a3w = number_format($_3way['a3w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_3way['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
// OU
|
||||
if (\count($_total) == 2) {
|
||||
|
||||
$_total['margin'] = (float) Margin::calculate($_total, 1);
|
||||
$_total['total'] = 2.5;
|
||||
$_total['active_spread'] = 1;
|
||||
|
||||
$_total = array_merge($_total, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $event['id'])
|
||||
->where('bookmaker_id', $event['bookmaker_id'])
|
||||
->where('total', $_total['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($_total);
|
||||
} else {
|
||||
$res->over = number_format($_total['over'], 2);
|
||||
$res->under = number_format($_total['under'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_total['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
// GG NG
|
||||
if (\count($_ggng) == 2) {
|
||||
|
||||
$_ggng['margin'] = (float) Margin::calculate($_ggng, 1);
|
||||
|
||||
$_ggng = array_merge($_ggng, $base);
|
||||
|
||||
$res = OddsGgng::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($_ggng);
|
||||
} else {
|
||||
$res->gg = number_format($_ggng['gg'], 2);
|
||||
$res->ng = number_format($_ggng['ng'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_ggng['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// DC
|
||||
if (\count($_dc) == 3) {
|
||||
|
||||
$_dc['margin'] = (float) Margin::calculate($_dc, 1);
|
||||
|
||||
$_dc = array_merge($_dc, $base);
|
||||
|
||||
$res = OddsDc::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($_dc);
|
||||
} else {
|
||||
$res->dc1x = number_format($_dc['dc1x'], 2);
|
||||
$res->dc12 = number_format($_dc['dc12'], 2);
|
||||
$res->dcx2 = number_format($_dc['dcx2'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_dc['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
// TQ
|
||||
if (\count($_tq) == 2) {
|
||||
|
||||
$_tq['margin'] = (float) Margin::calculate($_tq, 1);
|
||||
|
||||
$_tq = array_merge($_tq, $base);
|
||||
|
||||
$res = OddsTq::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTq::create($_tq);
|
||||
} else {
|
||||
$res->htq = number_format($_tq['htq'], 2);
|
||||
$res->atq = number_format($_tq['atq'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $_tq['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\FilterHandicap;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStorePoints;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotals;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2way;
|
||||
use App\Models\Odds2wayS1;
|
||||
use App\Utilities\Margin;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Tennis
|
||||
{
|
||||
public static function get(&$event, $match)
|
||||
{
|
||||
$ml = [];
|
||||
$mls1 = [];
|
||||
$n_totals = [];
|
||||
$n_points = [];
|
||||
$c_totals = [];
|
||||
$c_points = [];
|
||||
|
||||
foreach ($match['odds'] as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'T_12_1':
|
||||
$ml['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'T_12_2':
|
||||
$ml['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
|
||||
case 'T_121P_1':
|
||||
$mls1['h2w'] = number_format($value, 2);
|
||||
break;
|
||||
case 'T_121P_2':
|
||||
$mls1['a2w'] = number_format($value, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strpos($name, '@') !== false) {
|
||||
$pos = strpos($name, '@');
|
||||
$market = substr($name, 0, $pos);
|
||||
|
||||
switch ($market) {
|
||||
// NIGERIA
|
||||
case 'T_OUG':
|
||||
$n_totals[$name] = $value;
|
||||
$c_totals[$name] = $value;
|
||||
break;
|
||||
case 'T_GH':
|
||||
$n_points[$name] = $value;
|
||||
break;
|
||||
|
||||
// COLOMBIA
|
||||
case 'T_HNDGAMES':
|
||||
$c_points[$name] = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$base = [];
|
||||
$base['event_id'] = $event['id'];
|
||||
$base['bookmaker_id'] = $event['bookmaker_id'];
|
||||
$base['sport_id'] = $event['sport_id'];
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = $event['event_id'];
|
||||
$base['flags'] = 1;
|
||||
|
||||
// ML
|
||||
if (\count($ml) == 2) {
|
||||
|
||||
$ml['margin'] = (float) Margin::calculate($ml, 1);
|
||||
|
||||
$ml = array_merge($ml, $base);
|
||||
|
||||
// Notice::note($ml, 'g');
|
||||
|
||||
$res = Odds2way::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2way::create($ml);
|
||||
} else {
|
||||
$res->h2w = number_format($ml['h2w'], 2);
|
||||
$res->a2w = number_format($ml['a2w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $ml['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (\count($mls1) == 2) {
|
||||
|
||||
$mls1['margin'] = (float) Margin::calculate($mls1, 1);
|
||||
|
||||
$mls1 = array_merge($mls1, $base);
|
||||
|
||||
$res = Odds2wayS1::where('event_id', $event['id'])->where('bookmaker_id', $event['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2wayS1::create($ml);
|
||||
} else {
|
||||
$res->h2w = number_format($ml['h2w'], 2);
|
||||
$res->a2w = number_format($ml['a2w'], 2);
|
||||
$res->flags = 1;
|
||||
$res->margin = $mls1['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$_spreads = [];
|
||||
// COLUMBIA
|
||||
if ($c_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'T_OUG@', $c_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($c_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'T_HNDGAMES@', $c_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
// NIGERIA
|
||||
if ($n_totals) {
|
||||
FilterHandicap::filter($_spreads['total'], 'T_OUG@', $n_totals, ['over', 'under', 'total']);
|
||||
}
|
||||
if ($n_points) {
|
||||
FilterHandicap::filter($_spreads['point'], 'T_GH@', $n_points, ['hth1', 'hth2', 'hcap']);
|
||||
}
|
||||
|
||||
if (isset($_spreads['total'])) {
|
||||
LogifutureStoreTotals::store($_spreads['total'], $base);
|
||||
}
|
||||
if (isset($_spreads['point'])) {
|
||||
LogifutureStorePoints::store($_spreads['point'], $base);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
class ActiveHandicap
|
||||
{
|
||||
public static function set(&$_spreads)
|
||||
{
|
||||
$tmp = 10000;
|
||||
$hcap = false;
|
||||
foreach ($_spreads as $key => $value) {
|
||||
$x = 0;
|
||||
foreach ($value as $k => $v) {
|
||||
if ($x == 0) {
|
||||
$x = $v;
|
||||
} else {
|
||||
$x -= $v;
|
||||
}
|
||||
}
|
||||
$x = abs($x);
|
||||
if ($x < $tmp) {
|
||||
$hcap = $key;
|
||||
$tmp = $x;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_spreads as $key => $value) {
|
||||
if ($key == $hcap) {
|
||||
$_spreads[$key]['active_spread'] = 1;
|
||||
} else {
|
||||
$_spreads[$key]['active_spread'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Authentication
|
||||
{
|
||||
public static function authenticate()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$url = Nuh::$options['base_url'].'/v1/authentication/token';
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH with PROXY'.PHP_EOL.$url, 'p');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_auth.php');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, ['url' => $url, 'password' => config('env.logifuture_token')]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH direct'.PHP_EOL.$url, 'b');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||
'username' => 'nuhodds',
|
||||
'password' => config('env.logifuture_token'),
|
||||
]));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'accept: application/json',
|
||||
'content-type: application/json',
|
||||
]);
|
||||
}
|
||||
|
||||
$file = curl_exec($ch);
|
||||
|
||||
$data = json_decode($file, true);
|
||||
|
||||
$header = [];
|
||||
$header[] = 'Authorization: Bearer '.$data['token'];
|
||||
$header[] = 'accept: application/json';
|
||||
$header[] = 'content-type: application/json';
|
||||
|
||||
Logifuture::$auth_header = $header;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
class FilterHandicap
|
||||
{
|
||||
public static function filter(&$_spreads, $filter, $data, $oddnames)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$key = str_replace($filter, '', $key);
|
||||
|
||||
if (strpos($key, '_O') !== false) {
|
||||
$hcap = str_replace('_O', '', $key);
|
||||
$_spreads[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_1H') !== false) {
|
||||
$hcap = str_replace('_1H', '', $key);
|
||||
$_spreads[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_1') !== false) {
|
||||
$hcap = str_replace('_1', '', $key);
|
||||
$_spreads[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_U') !== false) {
|
||||
$hcap = str_replace('_U', '', $key);
|
||||
$_spreads[$hcap]['ele2'] = $value;
|
||||
} elseif (strpos($key, '_2H') !== false) {
|
||||
$hcap = str_replace('_2H', '', $key);
|
||||
$_spreads[$hcap]['ele2'] = $value;
|
||||
} elseif (strpos($key, '_2') !== false) {
|
||||
$hcap = str_replace('_2', '', $key);
|
||||
$_spreads[$hcap]['ele2'] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class LogifutureData
|
||||
{
|
||||
public static $testfiles = '/Console/Commands/TestFiles/';
|
||||
|
||||
public static function load($logifuture_sport_id)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$save = Nuh::$options['s'] ?? 0;
|
||||
$read = Nuh::$options['r'] ?? 0;
|
||||
|
||||
$filename = app_path().self::$testfiles.str_replace(' ', '_', strtolower(Nuh::$options['sport'].'_'.Nuh::$options['provider'])).'.json';
|
||||
|
||||
if ($read) {
|
||||
if ($debug) {
|
||||
Notice::note('data read localy', 'g');
|
||||
}
|
||||
|
||||
$file = file_get_contents($filename);
|
||||
|
||||
return json_decode($file, true);
|
||||
}
|
||||
|
||||
$url = Nuh::$options['base_url'].'/v1/matches?sportId='.$logifuture_sport_id;
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DATA with PROXY'.PHP_EOL.$url, 'p');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_data.php');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
||||
'url' => $url,
|
||||
'header' => json_encode(Logifuture::$auth_header),
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DATA direct'.PHP_EOL.$url, 'b');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, Logifuture::$auth_header);
|
||||
}
|
||||
|
||||
$file = curl_exec($ch);
|
||||
|
||||
if ($save) {
|
||||
|
||||
file_put_contents($filename, $file);
|
||||
|
||||
Notice::note('file saved localy', 'g');
|
||||
}
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
echo curl_error($ch);
|
||||
}
|
||||
|
||||
return json_decode($file, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsPoint;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStorePoints
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $handicap => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['home'] = $value['ele1'];
|
||||
$odds['away'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['handicap'] = $handicap;
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
$odds['flags'] = 1;
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsPoint::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPoint::create($odds);
|
||||
} else {
|
||||
$res->home = number_format($odds['home'], 2);
|
||||
$res->away = number_format($odds['away'], 2);
|
||||
$res->handicap = number_format($odds['handicap'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsPointQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStorePointsQ1
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $handicap => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['home'] = $value['ele1'];
|
||||
$odds['away'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['handicap'] = $handicap;
|
||||
$odds['flags'] = 1;
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsPointQ1::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPointQ1::create($odds);
|
||||
} else {
|
||||
$res->home = number_format($odds['home'], 2);
|
||||
$res->away = number_format($odds['away'], 2);
|
||||
$res->handicap = number_format($odds['handicap'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStoreTotals
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $total => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['over'] = $value['ele1'];
|
||||
$odds['under'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['flags'] = 1;
|
||||
$odds['total'] = $total;
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} else {
|
||||
$res->over = number_format($odds['over'], 2);
|
||||
$res->under = number_format($odds['under'], 2);
|
||||
$res->total = number_format($odds['total'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Models\OddsTotalQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LogifutureStoreTotalsQ1
|
||||
{
|
||||
public static function store(&$_spreads, $base)
|
||||
{
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
foreach ($_spreads as $total => $value) {
|
||||
// code...
|
||||
$odds = [];
|
||||
$odds['over'] = $value['ele1'];
|
||||
$odds['under'] = $value['ele2'];
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['flags'] = 1;
|
||||
$odds['total'] = $total;
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTotalQ1::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotalQ1::create($odds);
|
||||
} else {
|
||||
$res->over = number_format($odds['over'], 2);
|
||||
$res->under = number_format($odds['under'], 2);
|
||||
$res->total = number_format($odds['total'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class MapEvent
|
||||
{
|
||||
public static function filter($sport_id, $match)
|
||||
{
|
||||
$event = [];
|
||||
$event['event_id'] = (int) $match['id'];
|
||||
$event['bookmaker_id'] = Nuh::$options['bookmaker_id'];
|
||||
$event['betradar_id'] = (int) preg_replace('"\D"', '', $match['externalId']);
|
||||
$event['sport_id'] = $sport_id;
|
||||
$event['provider_id'] = Nuh::$options['provider_id'];
|
||||
$event['starttime'] = Carbon::parse($match['startDate'])->toDateTimeString();
|
||||
$event['country'] = $match['sportCategory'];
|
||||
$event['group_id'] = (int) $match['tournamentId'];
|
||||
$event['group'] = addslashes($match['tournamentName']);
|
||||
|
||||
$str = str_replace('||', '|', $match['description']);
|
||||
$str = trim(str_replace('|', ' ', $str));
|
||||
if (Nuh::$options['bookmaker_id'] == 36) {
|
||||
$teams = explode(' v ', $str);
|
||||
} else {
|
||||
$teams = explode(' - ', $str);
|
||||
}
|
||||
$event['home'] = addslashes($teams[0]);
|
||||
$event['away'] = addslashes($teams[1]);
|
||||
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Grapper\Magloo\Fixtures;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Magloo
|
||||
{
|
||||
public static function switch()
|
||||
{
|
||||
switch (Nuh::$options['name']) {
|
||||
case 'Fixtures':
|
||||
Fixtures::grap();
|
||||
break;
|
||||
case 'Odds':
|
||||
Odds::grap();
|
||||
break;
|
||||
default:
|
||||
Notice::note('prosses name does not exist', 'r', 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Fixtures\FindFixture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Fixtures
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$proxy = Nuh::$options['p'] ?? 0;
|
||||
|
||||
FindFixture::start();
|
||||
|
||||
$sportmap = Sport::map('magl', false, [1, 3]);
|
||||
|
||||
// dd($sportmap);
|
||||
|
||||
if ($proxy) {
|
||||
Notice::note('PROXY USED', 'r');
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider'].' '.Nuh::$options['name'], 'g');
|
||||
}
|
||||
|
||||
foreach ($sportmap as $sport_id => $magloo_sport_id) {
|
||||
|
||||
$event_id_collector = [];
|
||||
/**
|
||||
* Tornaments
|
||||
*/
|
||||
$url = Nuh::$options['base_url'].'/en/'.$magloo_sport_id.'/prematch/sport';
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (is_array($data) or \count($data)) {
|
||||
|
||||
$ligas = [];
|
||||
foreach ($data as $value) {
|
||||
$tmp = [];
|
||||
if ($value['i'] == $magloo_sport_id) {
|
||||
$tmp['sport'] = $value['n'];
|
||||
$tmp['sport_id'] = $sport_id;
|
||||
foreach ($value['C'] as $key => $val1) {
|
||||
$tmp['country_id'] = $val1['i'];
|
||||
$tmp['country'] = $val1['n'];
|
||||
foreach ($val1['T'] as $key => $val2) {
|
||||
$tmp['group_id'] = $val2['i'];
|
||||
$tmp['group'] = $val2['n'];
|
||||
$ligas[] = $tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($ligas as $liga) {
|
||||
|
||||
// 19 => array:6 [
|
||||
// "sport" => "Basketball"
|
||||
// "sport_id" => 3
|
||||
// "country_id" => 146
|
||||
// "country" => "Israel"
|
||||
// "group_id" => 525
|
||||
// "group" => "Super League"
|
||||
// ]
|
||||
|
||||
if ($liga['group'] && strpos($liga['group'], 'Simulated') === false) {
|
||||
|
||||
$sport_id = $liga['sport_id'];
|
||||
|
||||
$url = Nuh::$options['base_url'].'/en/'.$magloo_sport_id.'/prematch/tournament/'.$liga['group_id'].'/event';
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
if (! count($data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($data as $magloo) {
|
||||
|
||||
$event = [];
|
||||
$event['event_id'] = (int) $magloo['i'];
|
||||
$event['betradar_id'] = (int) preg_replace('/\D/', '', $magloo['p']);
|
||||
$event['sport_id'] = $sport_id;
|
||||
$event['provider_id'] = Nuh::$options['provider_id'];
|
||||
$event['country_id'] = $liga['country_id'];
|
||||
$event['country'] = $liga['country'];
|
||||
$event['group_id'] = $liga['group_id'];
|
||||
$event['group'] = $liga['group'];
|
||||
$event['starttime'] = Carbon::parse($magloo['dt'])->toDateTimeString();
|
||||
$teams = explode(' v ', str_replace('|', ' ', $magloo['n']));
|
||||
$event['home_id'] = $magloo['htId'];
|
||||
$event['home'] = addslashes($teams[0]);
|
||||
$event['away_id'] = $magloo['atId'];
|
||||
$event['away'] = addslashes($teams[1]);
|
||||
|
||||
FindFixture::find($event);
|
||||
|
||||
if (isset($event['id'])) {
|
||||
|
||||
$event_id_collector[] = $event['id'];
|
||||
|
||||
DB::transaction(function () use ($event, $sport_id) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event['id'],
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'starttime' => $event['starttime']]);
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($event_id_collector) {
|
||||
EventBookmaker::whereNotIn('event_id', $event_id_collector)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->update(['in_feed' => 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\FilterHandicap;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\FilterHandicapQ1;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\FilterTotals;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\FilterTotalsQ1;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStore1x2;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStoreDc;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStoreGgng;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStorePoints;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStorePointsQ1;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStoreTotals;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStoreTotalsQ1;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\MaglooStoreTq;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$proxy = Nuh::$options['p'] ?? 0;
|
||||
|
||||
$event_id_collector = [];
|
||||
|
||||
$sportmap = Sport::map('magl', 1, [1, 3]);
|
||||
|
||||
if ($proxy) {
|
||||
Notice::note('PROXY USED', 'r');
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider'].' '.Nuh::$options['name'], 'g');
|
||||
}
|
||||
|
||||
foreach ($sportmap as $magloo_sport_id => $sport_id) {
|
||||
|
||||
$url = Nuh::$options['base_url'].'/1/prematch/sport/'.$magloo_sport_id.'/odds';
|
||||
|
||||
$data = Curl::load($url, ['timeout' => 30]);
|
||||
|
||||
if (! is_array($data) or \count($data) == 0) {
|
||||
Notice::note('no data in feed', 'r', 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($data as $match) {
|
||||
|
||||
$betradar_id = (int) preg_replace('/\D/', '', $match['p']);
|
||||
|
||||
$starttime = Carbon::parse($match['dt'])->toDateTimeString();
|
||||
|
||||
$event_id = Event::where('betradar_id', $betradar_id)->value('id');
|
||||
|
||||
if ($event_id) {
|
||||
$base = [];
|
||||
$base['event_id'] = $event_id;
|
||||
$base['bookmaker_id'] = Nuh::$options['bookmaker_id'];
|
||||
$base['sport_id'] = $sport_id;
|
||||
$base['provider_id'] = Nuh::$options['provider_id'];
|
||||
$base['bmoid'] = preg_replace('/\D/', '', $match['i']);
|
||||
$base['flag'] = 1;
|
||||
|
||||
$event_id_collector[] = $event_id;
|
||||
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event_id,
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => Nuh::$options['bookmaker_id'],
|
||||
], ['starttime' => $starttime, 'in_feed' => 1, 'bmoid' => $base['bmoid']]);
|
||||
|
||||
// if ($event_id == 14190947) {
|
||||
// dd($match['M']);
|
||||
// }
|
||||
|
||||
foreach ($match['M'] as $magloo_bettype_id => $value) {
|
||||
switch ($magloo_bettype_id) {
|
||||
case 1:
|
||||
// 1x2
|
||||
MaglooStore1x2::store($value, $base);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// to qalify
|
||||
MaglooStoreTq::store($value, $base);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
// double chance
|
||||
MaglooStoreDc::store($value, $base);
|
||||
break;
|
||||
|
||||
case 27:
|
||||
// ggng
|
||||
MaglooStoreGgng::store($value, $base);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 2000:
|
||||
// points
|
||||
$odds = FilterHandicap::get($value);
|
||||
|
||||
MaglooStorePoints::store($odds, $base);
|
||||
|
||||
break;
|
||||
|
||||
case 2025:
|
||||
// points qt
|
||||
$odds = FilterHandicapQ1::get($value);
|
||||
|
||||
MaglooStorePointsQ1::store($odds, $base);
|
||||
|
||||
break;
|
||||
|
||||
case 17:
|
||||
case 2002:
|
||||
// totals
|
||||
$odds = FilterTotals::get($value, $sport_id);
|
||||
|
||||
MaglooStoreTotals::store($odds, $base);
|
||||
|
||||
break;
|
||||
|
||||
case 2012:
|
||||
// totals qt
|
||||
$odds = FilterTotalsQ1::get($value, $sport_id);
|
||||
|
||||
MaglooStoreTotalsQ1::store($odds, $base);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EventBookmaker::whereNotIn('event_id', $event_id_collector)
|
||||
->where('bookmaker_id', Nuh::$options['bookmaker_id'])
|
||||
->update(['in_feed' => 0]);
|
||||
|
||||
$tables = ['odds_3ways', 'odds_dc', 'odds_ggng', 'odds_points', 'odds_points_q1', 'odds_totals', 'odds_totals_q1', 'odds_tq'];
|
||||
foreach ($tables as $table) {
|
||||
DB::table($table)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->whereNotIn('event_id', $event_id_collector)->update(['flags' => 0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
class ActiveHandicap
|
||||
{
|
||||
public static function set(&$_spreads)
|
||||
{
|
||||
$tmp = 10000;
|
||||
$hcap = false;
|
||||
foreach ($_spreads as $key => $value) {
|
||||
$x = 0;
|
||||
foreach ($value as $k => $v) {
|
||||
if ($x == 0) {
|
||||
$x = $v;
|
||||
} else {
|
||||
$x -= $v;
|
||||
}
|
||||
}
|
||||
$x = abs($x);
|
||||
if ($x < $tmp) {
|
||||
$hcap = $key;
|
||||
$tmp = $x;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($_spreads as $key => $value) {
|
||||
if ($key == $hcap) {
|
||||
$_spreads[$key]['active_spread'] = 1;
|
||||
} else {
|
||||
$_spreads[$key]['active_spread'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture\Tools\ActiveHandicap;
|
||||
|
||||
class FilterHandicap
|
||||
{
|
||||
public static function get($_spreads)
|
||||
{
|
||||
|
||||
ActiveHandicap::set($_spreads);
|
||||
|
||||
$_points = [];
|
||||
foreach ($_spreads as $handicap => $value) {
|
||||
if (fmod(abs($handicap), 1) == 0.5) {
|
||||
if ($value[1714] > 1 and $value[1715] > 1) {
|
||||
$_points[$handicap]['home'] = number_format($value[1714], 2);
|
||||
$_points[$handicap]['away'] = number_format($value[1715], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_points;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
class FilterHandicapQ1
|
||||
{
|
||||
public static function get($_array)
|
||||
{
|
||||
$_points = [];
|
||||
foreach ($_array as $key => $value) {
|
||||
$t = explode('_', $key);
|
||||
$matchpart = $t[0];
|
||||
$handicap = (float) $t[1];
|
||||
if ($matchpart == 1) {
|
||||
if (fmod(abs($handicap), 1) == 0.5) {
|
||||
if ($value[1714] > 1 and $value[1715] > 1) {
|
||||
$_points[$handicap]['home'] = number_format($value[1714], 2);
|
||||
$_points[$handicap]['away'] = number_format($value[1715], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_points;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
class FilterTotals
|
||||
{
|
||||
public static function get($_array, $sport_id)
|
||||
{
|
||||
$_totals = [];
|
||||
foreach ($_array as $total => $value) {
|
||||
if ($sport_id == 1) {
|
||||
if ($total == 2.5) {
|
||||
if ($value[12] > 1 and $value[13] > 1) {
|
||||
$_totals[$total]['over'] = number_format($value[12], 2);
|
||||
$_totals[$total]['under'] = number_format($value[13], 2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (fmod(abs($total), 1) == 0.5) {
|
||||
if ($value[12] > 1 and $value[13] > 1) {
|
||||
$_totals[$total]['over'] = number_format($value[12], 2);
|
||||
$_totals[$total]['under'] = number_format($value[13], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_totals;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
class FilterTotalsQ1
|
||||
{
|
||||
public static function get($_array, $sport_id)
|
||||
{
|
||||
$_totals = [];
|
||||
foreach ($_array as $key => $value) {
|
||||
$t = explode('_', $key);
|
||||
$matchpart = $t[0];
|
||||
$total = (float) $t[1];
|
||||
if ($matchpart == 1) {
|
||||
if (fmod(abs($total), 1) == 0.5) {
|
||||
if ($value[12] > 1 and $value[13] > 1) {
|
||||
$_totals[$total]['over'] = number_format($value[12], 2);
|
||||
$_totals[$total]['under'] = number_format($value[13], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $_totals;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStore1x2
|
||||
{
|
||||
public static function store($value, $base)
|
||||
{
|
||||
$odds = [];
|
||||
$odds['h3w'] = number_format($value['static'][1], 2) ?? 1;
|
||||
$odds['d3w'] = number_format($value['static'][2], 2) ?? 1;
|
||||
$odds['a3w'] = number_format($value['static'][3], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['flags'] = 1;
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = Odds3way::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} else {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->a3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsDc;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStoreDc
|
||||
{
|
||||
public static function store($value, $base)
|
||||
{
|
||||
$odds = [];
|
||||
$odds['dc1x'] = number_format($value['static'][9], 2) ?? 1;
|
||||
$odds['dc12'] = number_format($value['static'][10], 2) ?? 1;
|
||||
$odds['dcx2'] = number_format($value['static'][11], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['flags'] = 1;
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsDc::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($odds);
|
||||
} else {
|
||||
$res->dc1x = $odds['dc1x'];
|
||||
$res->dc12 = $odds['dc12'];
|
||||
$res->dcx2 = $odds['dcx2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsGgng;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStoreGgng
|
||||
{
|
||||
public static function store($value, $base)
|
||||
{
|
||||
$odds = [];
|
||||
$odds['gg'] = number_format($value['static'][74], 2) ?? 1;
|
||||
$odds['ng'] = number_format($value['static'][76], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds['flags'] = 1;
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsGgng::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($odds);
|
||||
} else {
|
||||
$res->gg = $odds['gg'];
|
||||
$res->ng = $odds['ng'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsPoint;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStorePoints
|
||||
{
|
||||
public static function store($data, $base)
|
||||
{
|
||||
ActiveHandicap::set($data);
|
||||
|
||||
foreach ($data as $handicap => $value) {
|
||||
$odds = $value;
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['handicap'] = $handicap;
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
$odds['flags'] = 1;
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsPoint::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPoint::create($odds);
|
||||
} else {
|
||||
$res->flags = 1;
|
||||
$res->home = number_format($odds['home'], 2);
|
||||
$res->away = number_format($odds['away'], 2);
|
||||
$res->handicap = number_format($odds['handicap'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsPointQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStorePointsQ1
|
||||
{
|
||||
public static function store($data, $base)
|
||||
{
|
||||
ActiveHandicap::set($data);
|
||||
|
||||
foreach ($data as $handicap => $value) {
|
||||
$odds = $value;
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['handicap'] = $handicap;
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
$odds['flags'] = 1;
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsPointQ1::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPointQ1::create($odds);
|
||||
} else {
|
||||
$res->flags = 1;
|
||||
$res->home = number_format($odds['home'], 2);
|
||||
$res->away = number_format($odds['away'], 2);
|
||||
$res->handicap = number_format($odds['handicap'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStoreTotals
|
||||
{
|
||||
public static function store($data, $base)
|
||||
{
|
||||
ActiveHandicap::set($data);
|
||||
|
||||
foreach ($data as $total => $value) {
|
||||
$odds = $value;
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['total'] = $total;
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
$odds['flags'] = 1;
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTotal::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} else {
|
||||
$res->flags = 1;
|
||||
$res->over = number_format($odds['over'], 2);
|
||||
$res->under = number_format($odds['under'], 2);
|
||||
$res->total = number_format($odds['total'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsTotalQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStoreTotalsQ1
|
||||
{
|
||||
public static function store($data, $base)
|
||||
{
|
||||
ActiveHandicap::set($data);
|
||||
|
||||
foreach ($data as $total => $value) {
|
||||
$odds = $value;
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
|
||||
$odds['active_spread'] = $value['active_spread'];
|
||||
$odds['total'] = $total;
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
$odds['flags'] = 1;
|
||||
|
||||
$odds = array_merge($odds, $base);
|
||||
|
||||
$res = OddsTotalQ1::where('event_id', $base['event_id'])
|
||||
->where('bookmaker_id', $base['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotalQ1::create($odds);
|
||||
} else {
|
||||
$res->flags = 1;
|
||||
$res->over = number_format($odds['over'], 2);
|
||||
$res->under = number_format($odds['under'], 2);
|
||||
$res->total = number_format($odds['total'], 2);
|
||||
$res->active_spread = $odds['active_spread'];
|
||||
$res->difference = $odds['difference'];
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Magloo\Odds;
|
||||
|
||||
use App\Models\OddsTq;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MaglooStoreTq
|
||||
{
|
||||
public static function store($value, $base)
|
||||
{
|
||||
$odds = [];
|
||||
$odds['htq'] = number_format($value['static'][4], 2) ?? 1;
|
||||
$odds['atq'] = number_format($value['static'][5], 2) ?? 1;
|
||||
$odds['margin'] = (float) Margin::calculate($odds, 1);
|
||||
$odds = array_merge($odds, $base);
|
||||
$odds['flags'] = 1;
|
||||
|
||||
$res = OddsTq::where('event_id', $base['event_id'])->where('bookmaker_id', $base['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTq::create($odds);
|
||||
} else {
|
||||
$res->flags = 1;
|
||||
$res->htq = $odds['htq'];
|
||||
$res->atq = $odds['atq'];
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
||||
use App\Models\Country;
|
||||
use App\Models\SofaScoreCategory;
|
||||
use App\Models\SofaScoreDayTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DaysTournament
|
||||
{
|
||||
/**
|
||||
* a Grap --d --f 67 --fun=4 --task=1
|
||||
*
|
||||
* Ita Serie-A-Saison 23-08-2025 - 24-05-2026
|
||||
* Ger Bundesliga 22-08-2025 – 16-05-2026
|
||||
* Eng Premier league 15-08-2025 - 24-05-2026
|
||||
* Spa La Liga 15-08-2025 - 24-05-2026
|
||||
* Fra Liggue 15-08-2025 - 17-05-2026
|
||||
*/
|
||||
public static function get(string $day)
|
||||
{
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
$force = Grap::$options['F'] ?? 0;
|
||||
|
||||
$tournaments_counter = 0;
|
||||
|
||||
$has = SofaScoreDayTournament::where('day', $day)->first();
|
||||
|
||||
$sport = [];
|
||||
$sport[1] = 'football';
|
||||
|
||||
foreach ($sport as $sport_id => $slug) {
|
||||
if (!$force && $has) {
|
||||
if ($debug) {
|
||||
Notice::note("Tournaments $day for " . strtoupper($slug) . ' allready grapped', 'bb');
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("$day\ngrappig", 'g');
|
||||
}
|
||||
|
||||
$page = 1;
|
||||
|
||||
while ($page) {
|
||||
|
||||
$url = Grap::$options['base_url'] . "api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
|
||||
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
if ($data['hasNextPage']) {
|
||||
$page++;
|
||||
} else {
|
||||
$page = false;
|
||||
}
|
||||
|
||||
foreach ($data['scheduled'] as $row) {
|
||||
|
||||
if (isset($row['tournament']['uniqueTournament'])) {
|
||||
$tournament = $row['tournament']['uniqueTournament'];
|
||||
} else {
|
||||
$tournament = $row['tournament'];
|
||||
}
|
||||
|
||||
$category = $tournament['category'];
|
||||
|
||||
if ($sport_id == 5) {
|
||||
$country_id = 470;
|
||||
} else {
|
||||
|
||||
/**
|
||||
* CATEGORY
|
||||
*/
|
||||
$find = [
|
||||
'Amateur',
|
||||
'Bosnia & Herzegovina',
|
||||
'Czechia',
|
||||
'DR Congo',
|
||||
'Netherlands',
|
||||
'North & Central America',
|
||||
'Bonaire',
|
||||
'Sao Tome and Principe',
|
||||
'Cape Verde',
|
||||
'Macao',
|
||||
'Saint Kitts and Nevis',
|
||||
'Eswatini',
|
||||
'Timor Leste',
|
||||
'Laos',
|
||||
'Congo Republic',
|
||||
|
||||
];
|
||||
$replace = [
|
||||
'',
|
||||
'Bosnia Herzegovina',
|
||||
'Czech Republic',
|
||||
'Congo DR',
|
||||
'Holland',
|
||||
'North America',
|
||||
'Bonaire, Sint Eustatius and Saba',
|
||||
'Sao Tome e Principe',
|
||||
'Cape Verde Islands',
|
||||
'Macau',
|
||||
'St. Kitts and Nevis',
|
||||
'Swaziland',
|
||||
'East Timor',
|
||||
'Lao Peoples\'s Democratic Republic',
|
||||
'Congo DR',
|
||||
];
|
||||
$country_id = Country::where('name', trim(str_replace($find, $replace, $category['name'])))->value('id');
|
||||
}
|
||||
|
||||
// dd($category, $country_id);
|
||||
|
||||
if (! $country_id) {
|
||||
// platzhalter fix later sofa_score_categories => txodds countries
|
||||
// CATEGORY find <-> replace
|
||||
// Log::channel('sofascore')->info($tournament);
|
||||
|
||||
$sofa_score_category_id = 10000000;
|
||||
} else {
|
||||
$call = SofaScoreCategory::updateOrCreate([
|
||||
'id' => (int) $category['id'],
|
||||
'country_id' => (int) $country_id,
|
||||
'slug' => $category['slug'],
|
||||
], [
|
||||
'name' => $category['name'],
|
||||
]);
|
||||
|
||||
$sofa_score_category_id = $call->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* TOURNAMENT
|
||||
*/
|
||||
SofaScoreTournament::updateOrCreate([
|
||||
'sport_id' => (int) $sport_id,
|
||||
'tournament_id' => (int) $tournament['id'],
|
||||
'sofa_score_category_id' => (int) $sofa_score_category_id,
|
||||
], [
|
||||
'name' => $tournament['name'],
|
||||
'slug' => $tournament['slug'],
|
||||
]);
|
||||
$tournaments_counter++;
|
||||
|
||||
// if ($debug) {
|
||||
// Notice::note('tournament: ' . $tournament['name'], 'p');
|
||||
// }
|
||||
|
||||
/**
|
||||
* DAY TOURNAMENT
|
||||
*/
|
||||
SofaScoreDayTournament::updateOrCreate([
|
||||
'tournament_id' => (int) $tournament['id'],
|
||||
'sport_id' => (int) $sport_id,
|
||||
'day' => $day,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("tournaments: $tournaments_counter", 'p');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($debug) {
|
||||
Notice::note('days tournament done', 'g');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\LoadDays;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
||||
use App\Models\SofaScoreDayTournament;
|
||||
use App\Models\SofaScoreEventGrapped;
|
||||
use App\Models\SofaScoreTaskDay;
|
||||
use App\Models\SofaScoreTaskTournament;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class Grapper
|
||||
{
|
||||
public static function load(int $task_id)
|
||||
{
|
||||
/**
|
||||
* , JSON_PRETTY_PRINT
|
||||
* to fromat json
|
||||
*/
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
$restart = Grap::$options['r'] ?? 0;
|
||||
$force = Grap::$options['f'] ?? 0;
|
||||
|
||||
if (! $task_id) {
|
||||
Notice::note('task id missing', 'r', 1);
|
||||
}
|
||||
|
||||
$days = LoadDays::load($task_id);
|
||||
|
||||
$count = 0;
|
||||
|
||||
/** take for task 2 the same like for task 1 */
|
||||
switch ($task_id) {
|
||||
case 1:
|
||||
case 2:
|
||||
$active_tournaments = SofaScoreTaskTournament::with('tournament')->where('sofa_score_task_id', 1)->where('disabled', false)->get();
|
||||
break;
|
||||
|
||||
default:
|
||||
$active_tournaments = SofaScoreTaskTournament::with('tournament')->where('sofa_score_task_id', $task_id)->where('disabled', false)->get();
|
||||
// $active_tournaments = SofaScoreTaskTournament::with('tournament')->where('sofa_score_tournament_id', 247)->where('sofa_score_task_id', $task_id)->where('disabled', false)->get();
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart
|
||||
*/
|
||||
if ($restart) {
|
||||
|
||||
SofaScoreEventGrapped::where('grapper_id', $task_id)->delete();
|
||||
|
||||
foreach ($days as $day) {
|
||||
// if restarting find position
|
||||
SofaScoreTaskDay::where('grapper_id', (int) $task_id)
|
||||
->where('day', $day)
|
||||
->update(['done' => 0]);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Restarted grapper', 'br', 1);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($days as $day) {
|
||||
|
||||
DaysTournament::get($day);
|
||||
|
||||
dd($active_tournaments);
|
||||
|
||||
foreach ($active_tournaments as $tournament) {
|
||||
|
||||
$res = SofaScoreDayTournament::whereDate('day', '=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
|
||||
|
||||
if ($res) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($tournament->sofa_score_tournament_id, 'bb');
|
||||
}
|
||||
|
||||
if (! $force) {
|
||||
Sleeper::rand(1);
|
||||
} else {
|
||||
Sleeper::rand();
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($day, 'br');
|
||||
}
|
||||
|
||||
$url = Grap::$options['base_url']."api/v1/unique-tournament/$tournament->sofa_score_tournament_id/scheduled-events/$day";
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
Notice::note($data, 'bb');
|
||||
|
||||
if (isset($data['events'])) {
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($tournament->tournament->name, 'bb');
|
||||
}
|
||||
|
||||
foreach ($data['events'] as $event) {
|
||||
|
||||
Grap::$useragent = rand(1, 6);
|
||||
|
||||
if (! $force && SofaScoreEventGrapped::where('grapper_id', $task_id)->where('id', (int) $event['id'])->exists()) {
|
||||
if ($debug) {
|
||||
Notice::note('DB - Allready grapped at '.$day.' - '.$event['homeTeam']['name'].' vs '.$event['awayTeam']['name'], 'g');
|
||||
}
|
||||
} else {
|
||||
|
||||
$now = Carbon::now()->subHours(3);
|
||||
|
||||
$carbon_day = new Carbon($day);
|
||||
|
||||
$starttime = Carbon::createFromTimestamp($event['startTimestamp']);
|
||||
|
||||
// dd($starttime);
|
||||
|
||||
// if ($now->greaterThan($starttime) && $starttime->isSameDay($carbon_day)) {
|
||||
|
||||
if (! $force) {
|
||||
Sleeper::rand(1);
|
||||
} else {
|
||||
Sleeper::rand();
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($day.' - '.$event['homeTeam']['name'].' vs '.$event['awayTeam']['name'], 'bg');
|
||||
}
|
||||
|
||||
$folder = strtolower(Grap::$storage.'/'.$day.'/'.$day.'-'.$event['tournament']['category']['slug'].'-'.$event['tournament']['slug'].'/'.$event['slug']);
|
||||
|
||||
File::makeDirectory($folder, 0775, true, true);
|
||||
|
||||
/*********************************
|
||||
* EVENT event
|
||||
*********************************/
|
||||
|
||||
File::put($folder.'/event.json', json_encode($event));
|
||||
|
||||
/*********************************
|
||||
* EVENT statistics
|
||||
*********************************/
|
||||
|
||||
$event_id = $event['id'];
|
||||
|
||||
$url = Grap::$options['base_url']."api/v1/event/$event_id/statistics";
|
||||
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
$data['id'] = $event_id;
|
||||
|
||||
File::put($folder.'/statistics.json', json_encode($data));
|
||||
|
||||
/*********************************
|
||||
* EVENT lineups
|
||||
*********************************/
|
||||
|
||||
$url = Grap::$options['base_url']."api/v1/event/$event_id/lineups";
|
||||
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
$data['id'] = $event_id;
|
||||
|
||||
File::put($folder.'/lineups.json', json_encode($data));
|
||||
|
||||
/*********************************
|
||||
* EVENT odds
|
||||
*********************************/
|
||||
|
||||
$url = Grap::$options['base_url']."api/v1/event/$event_id/odds/1/all";
|
||||
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
$data['id'] = $event_id;
|
||||
|
||||
File::put($folder.'/odds.json', json_encode($data));
|
||||
|
||||
/*********************************
|
||||
* EVENT incidents
|
||||
*********************************/
|
||||
|
||||
$url = Grap::$options['base_url']."api/v1/event/$event_id/incidents";
|
||||
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
$data['id'] = $event_id;
|
||||
|
||||
File::put($folder.'/incidents.json', json_encode($data));
|
||||
|
||||
$grapped = SofaScoreEventGrapped::firstOrNew(['id' => $event['id']]);
|
||||
$grapped->grapper_id = $task_id;
|
||||
$grapped->day = $day;
|
||||
$grapped->liga = $event['tournament']['name'];
|
||||
$grapped->name = $event['homeTeam']['name'].' vs '.$event['awayTeam']['name'];
|
||||
$grapped->url = $url;
|
||||
$grapped->starttime = $starttime->toDateTimeString();
|
||||
$grapped->save();
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SofaScoreTaskDay::updateOrCreate([
|
||||
'grapper_id' => (int) $task_id,
|
||||
'day' => $day,
|
||||
], [
|
||||
'done' => 1,
|
||||
]);
|
||||
|
||||
$count++;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("$count days done, sleep 10-20 sec", 'p');
|
||||
}
|
||||
|
||||
if (! $force) {
|
||||
Sleeper::rand(2);
|
||||
} else {
|
||||
Sleeper::rand();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlLivescore;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
||||
use App\Utilities\Notice;
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
|
||||
class GrapperTest
|
||||
{
|
||||
public static $testfiles = '/Testfiles/';
|
||||
|
||||
public static function load()
|
||||
{
|
||||
$read = Grap::$options['R'] ?? 0;
|
||||
$save = Grap::$options['S'] ?? 0;
|
||||
|
||||
$testfile = 'livescore.txt';
|
||||
|
||||
$path = __DIR__ . self::$testfiles . $testfile;
|
||||
|
||||
Notice::note('Grapper testing ' . $testfile, 'b');
|
||||
|
||||
// $url = 'https://www.livescore.in/horse-racing/canada/woodbine-2020/';
|
||||
$url = 'https://www.sofascore.com/api/v1/event/16298660/statistics';
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
Notice::note($data, '', 1);
|
||||
|
||||
if ($read) {
|
||||
Notice::note('data read localy', 'p');
|
||||
|
||||
$data = file_get_contents($path);
|
||||
} else {
|
||||
$data = CurlLivescore::load($url);
|
||||
}
|
||||
|
||||
if ($save) {
|
||||
|
||||
file_put_contents($path, $data);
|
||||
|
||||
Notice::note('file saved localy', 'g');
|
||||
}
|
||||
|
||||
$dom = new DOMDocument;
|
||||
|
||||
// Prevent warnings caused by HTML5 tags that native DOMDocument doesn't fully understand
|
||||
libxml_use_internal_errors(true);
|
||||
|
||||
// Use mb_convert_encoding to ensure DOMDocument treats the input as UTF-8
|
||||
$dom->loadHTML(mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8'));
|
||||
libxml_clear_errors();
|
||||
|
||||
// 3. Use XPath to query specific HTML elements
|
||||
$xpath = new DOMXPath($dom);
|
||||
|
||||
// Example: Target match rows or team names (Update classes based on actual DOM structure)
|
||||
// Modern livescore sites often use classes like '.event__match' or '.event__participant'
|
||||
$teams = $xpath->query("//div[contains(@class, 'event__participant')]");
|
||||
|
||||
foreach ($teams as $team) {
|
||||
echo trim($team->nodeValue) . PHP_EOL;
|
||||
}
|
||||
|
||||
Notice::note($data, 'p', 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ClearDir
|
||||
{
|
||||
public static function clear($dir = ''): void
|
||||
{
|
||||
$file = new Filesystem;
|
||||
$debug = Grap::$options['d'];
|
||||
|
||||
if ($dir) {
|
||||
$file->cleanDirectory($dir);
|
||||
if ($debug) {
|
||||
Notice::note('Folder removed', 'br');
|
||||
}
|
||||
} else {
|
||||
$file->cleanDirectory(Grap::$storage);
|
||||
if ($debug) {
|
||||
Notice::note('Folder content deleted', 'br');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class CurlSofa
|
||||
{
|
||||
public static function load(string $url)
|
||||
{
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($url, 'b');
|
||||
}
|
||||
// $useragents = [];
|
||||
// $useragents[1] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36";
|
||||
// $useragents[2] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36";
|
||||
// $useragents[3] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Safari/605.1.15";
|
||||
// $useragents[4] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0";
|
||||
// $useragents[5] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0";
|
||||
// $useragents[6] = "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Mobile Safari/537.36";
|
||||
$useragents = [];
|
||||
$useragents[1] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15';
|
||||
$useragents[2] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3.1 Safari/605.1.15';
|
||||
$useragents[3] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36';
|
||||
$useragents[4] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.1 Safari/605.1.15';
|
||||
$useragents[5] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0';
|
||||
$useragents[6] = 'Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36';
|
||||
|
||||
// GET /api/v1/config/default-unique-tournaments/AT/football HTTP/2
|
||||
// Host: www.sofascore.com
|
||||
// User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:139.0) Gecko/20100101 Firefox/139.0
|
||||
// Accept: */*
|
||||
// Accept-Language: de,en-US;q=0.7,en;q=0.3
|
||||
// Accept-Encoding: gzip, deflate, br, zstd
|
||||
// Referer: https://www.sofascore.com/
|
||||
// X-Requested-With: 629800
|
||||
// DNT: 1
|
||||
// Sec-GPC: 1
|
||||
// Connection: keep-alive
|
||||
// Sec-Fetch-Dest: empty
|
||||
// Sec-Fetch-Mode: cors
|
||||
// Sec-Fetch-Site: same-origin
|
||||
// Priority: u=4
|
||||
// Pragma: no-cache
|
||||
// Cache-Control: no-cache
|
||||
// TE: trailers
|
||||
$headers = [
|
||||
'User-Agent: '.$useragents[Grap::$useragent],
|
||||
'Accept: */*',
|
||||
'Accept-Language: de,en-US;q=0.7,en;q=0.3',
|
||||
'Accept-Encoding: gzip, deflate, br, zstd',
|
||||
'Referer: https://www.sofascore.com/',
|
||||
'X-Requested-With: 629800',
|
||||
'DNT: 1',
|
||||
'Sec-GPC: 1',
|
||||
'Connection: keep-alive',
|
||||
'Sec-Fetch-Dest: empty',
|
||||
'Sec-Fetch-Mode: cors',
|
||||
'Sec-Fetch-Site: same-origin',
|
||||
'Priority: u=4',
|
||||
'Pragma: no-cache',
|
||||
'Cache-Control: no-cache',
|
||||
'TE: trailers',
|
||||
];
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
// This line magically handles all decompression out-of-the-box:
|
||||
curl_setopt($ch, CURLOPT_ENCODING, '');
|
||||
$data = curl_exec($ch);
|
||||
|
||||
$data = json_decode($data, true);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
class FileType
|
||||
{
|
||||
public static function filter(array $files, array $types = ['json'])
|
||||
{
|
||||
$filtered = [];
|
||||
foreach ($files as $file) {
|
||||
$path_parts = pathinfo($file);
|
||||
if (isset($path_parts['extension']) && in_array($path_parts['extension'], $types)) {
|
||||
$filtered[] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Models\SofaScoreTask;
|
||||
use App\Models\SofaScoreTaskDay;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class LoadDays
|
||||
{
|
||||
public static function load(int $task_id)
|
||||
{
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
$restart = Grap::$options['r'] ?? 0;
|
||||
|
||||
$dates = [];
|
||||
|
||||
if (! $task_id) {
|
||||
Notice::note('no task id', 'br');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
$task = SofaScoreTask::with('sport')->where('id', $task_id)->first();
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Task id:' . $task->id . ', mode:' . $task->mode . ', sport:' . $task->sport->name);
|
||||
}
|
||||
|
||||
switch ($task->mode) {
|
||||
|
||||
case 'daily':
|
||||
$dates[] = ValidateDate::get(Grap::$folder);
|
||||
break;
|
||||
|
||||
case 'last3days':
|
||||
case 'range':
|
||||
switch ($task_id) {
|
||||
case 2:
|
||||
$from = Carbon::now()->subDays(3);
|
||||
$to = Carbon::now()->subDays(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
$from = ValidateDate::get($task->day_from);
|
||||
$from = Carbon::createFromDate($from);
|
||||
$to = ValidateDate::get($task->day_to);
|
||||
$to = Carbon::createFromDate($to);
|
||||
break;
|
||||
}
|
||||
|
||||
$lengthdates = $from->diffInDays($to);
|
||||
|
||||
if ($lengthdates < 1) {
|
||||
Notice::note('start must be before end', 'r', 1);
|
||||
}
|
||||
|
||||
if ($restart) {
|
||||
// get all days
|
||||
while ($from <= $to) {
|
||||
$dates[] = $from->format('Y-m-d');
|
||||
$from->addDay();
|
||||
}
|
||||
} else {
|
||||
// remove days done
|
||||
while ($from <= $to) {
|
||||
|
||||
$res = SofaScoreTaskDay::firstOrNew(['grapper_id' => (int) $task_id, 'day' => $from->format('Y-m-d')]);
|
||||
|
||||
if (! $res->done) {
|
||||
$dates[] = $from->format('Y-m-d');
|
||||
}
|
||||
$from->addDay();
|
||||
}
|
||||
|
||||
shuffle($dates);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (! $dates) {
|
||||
Notice::note('NO DATES OR ALL GRAPPED', 'br', 1);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note($dates, 'b');
|
||||
}
|
||||
|
||||
// remove when element in array is double (day and slug)
|
||||
$dates = array_unique($dates, SORT_REGULAR);
|
||||
|
||||
return $dates;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class LoadTournaments
|
||||
{
|
||||
public static function load()
|
||||
{
|
||||
$sport_id = Nuh::$options['sport_id'];
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('LoadTournaments, sport: ' . $sport_id);
|
||||
}
|
||||
|
||||
$tornaments = SofaScoreTournament::select('name', 'tournament_id')->where('sport_id', $sport_id)->where('enabled', 1)->get();
|
||||
|
||||
if (! $tornaments) {
|
||||
Notice::note('no tornaments active for task', 'r', 1);
|
||||
}
|
||||
|
||||
return $tornaments;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
|
||||
class MoveToArchive
|
||||
{
|
||||
public static function move(int $task_id)
|
||||
{
|
||||
$files = ReadDir::get_tree(Grap::$storage);
|
||||
|
||||
$filtered_files = FileType::filter($files, ['xlsx', 'json']);
|
||||
|
||||
|
||||
foreach ($filtered_files as $file) {
|
||||
|
||||
switch ($task_id) {
|
||||
case 1:
|
||||
$nfile = \str_replace('/daily/', '/daily_archiv/', $file);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
rename($file, $nfile);
|
||||
|
||||
dd($file, $nfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
class ReadDir
|
||||
{
|
||||
public static function get_tree(string $dir, &$results = array())
|
||||
{
|
||||
$files = scandir($dir);
|
||||
foreach ($files as $value) {
|
||||
$path = realpath($dir . DIRECTORY_SEPARATOR . $value);
|
||||
if (!is_dir($path)) {
|
||||
$results[] = $path;
|
||||
} else if ($value != "." && $value != "..") {
|
||||
self::get_tree($path, $results);
|
||||
$results[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class RemoveDir
|
||||
{
|
||||
public static function remove(): void
|
||||
{
|
||||
$debug = Grap::$options['d'];
|
||||
|
||||
// Deletes the directory and everything inside it relative to the disk root
|
||||
|
||||
Storage::deleteDirectory(Grap::$storage . '/' . Grap::$folder);
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Directory: ' . Grap::$storage . '/' . Grap::$folder . ' removed', 'p');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Models\SofaScoreTask;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class SetStorage
|
||||
{
|
||||
public static function set(int $task_id)
|
||||
{
|
||||
$debug = Grap::$options['d'];
|
||||
|
||||
$force = Grap::$options['f'];
|
||||
|
||||
$folder = Grap::$options['folder'] ?? '';
|
||||
|
||||
$date = Grap::$options['date'] ?? '';
|
||||
|
||||
$day = Grap::$options['day'] ?? 1;
|
||||
|
||||
// must be connectet to task for activated ligas
|
||||
$task = SofaScoreTask::where('id', $task_id)->first();
|
||||
|
||||
$sofascore_data = storage_path('sofascore_data') . '/';
|
||||
if ($task) {
|
||||
$storage_name = Strings::clean($task->name);
|
||||
|
||||
switch ($task->id) {
|
||||
case 1:
|
||||
Grap::$storage = $sofascore_data . $storage_name;
|
||||
Grap::$folder = Carbon::now()->subDays($day)->format('Y-m-d');
|
||||
Grap::$excel = Grap::$storage . '/' . Grap::$folder;
|
||||
break;
|
||||
case 2:
|
||||
Grap::$storage = $sofascore_data . $storage_name;
|
||||
Grap::$folder = $date;
|
||||
Grap::$excel = $sofascore_data . $storage_name . '/' . $date;
|
||||
break;
|
||||
case 3:
|
||||
Grap::$storage = $sofascore_data . 'range/' . $storage_name;
|
||||
Grap::$folder = $storage_name;
|
||||
Grap::$excel = $sofascore_data . 'range/' . $storage_name;
|
||||
break;
|
||||
case 4:
|
||||
Grap::$storage = $sofascore_data . $storage_name;
|
||||
Grap::$folder = 'rosa-' . Carbon::now()->format('Y-m-d');
|
||||
Grap::$excel = Grap::$storage . '/rosa-' . Carbon::now()->format('Y-m-d');
|
||||
break;
|
||||
case 5:
|
||||
Grap::$storage = $sofascore_data . 'excel';
|
||||
Grap::$folder = $folder;
|
||||
Grap::$excel = $sofascore_data . 'excel/' . $storage_name;
|
||||
break;
|
||||
}
|
||||
} elseif ($folder) {
|
||||
Grap::$storage = $sofascore_data;
|
||||
Grap::$folder = $folder;
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Grap::$storage, 'g');
|
||||
Notice::note(Grap::$folder, 'g');
|
||||
if (!$force) {
|
||||
sleep(4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
class Sleeper
|
||||
{
|
||||
public static function rand($speed = false)
|
||||
{
|
||||
switch ($speed) {
|
||||
case 1:
|
||||
// 5 -10 sec
|
||||
$sleep = rand(5000000, 10000000);
|
||||
break;
|
||||
case 2:
|
||||
// 10 - 20 sec
|
||||
$sleep = rand(10000000, 20000000);
|
||||
break;
|
||||
|
||||
default:
|
||||
// 1 -1.5 sec
|
||||
$sleep = rand(100000, 150000);
|
||||
break;
|
||||
}
|
||||
|
||||
usleep($sleep);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
class Strings
|
||||
{
|
||||
|
||||
public static function clean(string $string)
|
||||
{
|
||||
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
|
||||
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
|
||||
$string = strtolower($string);
|
||||
|
||||
return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class ValidateDate
|
||||
{
|
||||
public static function get(string $date)
|
||||
{
|
||||
if (Carbon::createFromDate($date) !== false) {
|
||||
return $date;
|
||||
} else {
|
||||
Notice::note('Wrong date format', 'r', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore\Helper;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use RecursiveDirectoryIterator;
|
||||
use RecursiveIteratorIterator;
|
||||
use ZipArchive;
|
||||
|
||||
class ZipFolder
|
||||
{
|
||||
public static function create()
|
||||
{
|
||||
|
||||
$zip = new ZipArchive;
|
||||
|
||||
if ($zip->open(Grap::$zipfile, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) {
|
||||
|
||||
if (is_dir(Grap::$storage)) {
|
||||
|
||||
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(Grap::$storage));
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (! $file->isDir()) {
|
||||
$filePath = $file->getRealPath();
|
||||
$relativePath = substr($filePath, strlen(Grap::$storage) + 1);
|
||||
$zip->addFile($filePath, $relativePath);
|
||||
}
|
||||
}
|
||||
$zip->close();
|
||||
}
|
||||
} else {
|
||||
return response()->json(['error' => 'Failed to create ZIP archive'], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\FileType;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\ReadDir;
|
||||
use App\Utilities\Notice;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
|
||||
class MakeExcel
|
||||
{
|
||||
public static $max = 2000;
|
||||
|
||||
public static function create(string $what = '')
|
||||
{
|
||||
ini_set('memory_limit', -1);
|
||||
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("Make Excel");
|
||||
}
|
||||
|
||||
if ($what == 'day') {
|
||||
$files = ReadDir::get_tree(Grap::$storage . '/' . Grap::$folder);
|
||||
} else {
|
||||
$files = ReadDir::get_tree(Grap::$storage);
|
||||
}
|
||||
|
||||
|
||||
$files = array_chunk(FileType::filter($files), self::$max);
|
||||
|
||||
foreach ($files as $key => $value) {
|
||||
|
||||
$has = count($value);
|
||||
if (! $key && $has < self::$max) {
|
||||
$from = 1;
|
||||
$to = $has;
|
||||
} elseif (! $key) {
|
||||
$from = 1;
|
||||
$key++;
|
||||
$to = $key * self::$max;
|
||||
} elseif ($has == self::$max) {
|
||||
$from = $key * self::$max + 1;
|
||||
$key++;
|
||||
$to = $key * self::$max;
|
||||
} else {
|
||||
$from = $key * self::$max + 1;
|
||||
$to = $key * self::$max + $has;
|
||||
}
|
||||
|
||||
$spreadsheet = new Spreadsheet;
|
||||
$spreadsheet->getProperties()->setTitle(Grap::$excel . '_' . $from . '-' . $to);
|
||||
$activeWorksheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$column = 1;
|
||||
foreach ($value as $file) {
|
||||
$data = file_get_contents($file);
|
||||
$data = json_decode($data, true);
|
||||
$json_string = json_encode($data, JSON_PRETTY_PRINT);
|
||||
|
||||
$arr = explode(PHP_EOL, $json_string);
|
||||
$row = 0;
|
||||
foreach ($arr as $string) {
|
||||
$row++;
|
||||
$replacedString = preg_replace("/\\\\u([0-9abcdef]{4})/", "&#x$1;", $string);
|
||||
$utf8string = mb_convert_encoding($replacedString, 'UTF-8', 'HTML-ENTITIES');
|
||||
$activeWorksheet->setCellValue([$column, $row], $utf8string);
|
||||
}
|
||||
$column++;
|
||||
}
|
||||
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
|
||||
$writer->save(Grap::$excel . '_' . $from . '-' . $to . '.xlsx');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
class Player
|
||||
{
|
||||
public static function call()
|
||||
{
|
||||
// https://www.sofascore.com/api/v1/player/824509
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Strings;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
class Rose
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
$restart = Grap::$options['r'] ?? 0;
|
||||
|
||||
if ($debug && ! $restart) {
|
||||
Notice::note('RESTART ?', 'bb');
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
File::makeDirectory(Grap::$storage.'/'.Grap::$folder, 0775, true, true);
|
||||
|
||||
if ($restart) {
|
||||
SofaScoreRosa::query()->update(['grapped' => 0]);
|
||||
if ($debug) {
|
||||
Notice::note('reset all grapped to 0', 'r', 1);
|
||||
}
|
||||
} else {
|
||||
if ($debug) {
|
||||
Notice::note('continuing grapping', 'bg');
|
||||
}
|
||||
}
|
||||
|
||||
$res = SofaScoreRosa::where('is_active', 1)->where('grapped', 0)->get();
|
||||
|
||||
$all = $res->count();
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("total $all", 'br');
|
||||
}
|
||||
|
||||
foreach ($res as $key => $value) {
|
||||
|
||||
if ($debug) {
|
||||
$key++;
|
||||
echo "\n$key/$all\n";
|
||||
}
|
||||
|
||||
$url = Grap::$options['base_url'].'api/v1/team/'.$value->ss_team_id.'/players';
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
$data['ss_team_id'] = $value->ss_team_id;
|
||||
$data['ss_team_name'] = $value->ss_team_name;
|
||||
|
||||
/*********************************
|
||||
* add team to folder
|
||||
*********************************/
|
||||
|
||||
File::put(Grap::$storage.'/'.Grap::$folder.'/'.Strings::clean($value->ss_team_name).'.json', json_encode($data));
|
||||
|
||||
SofaScoreRosa::where('id', $value->id)->update(['grapped' => 1]);
|
||||
|
||||
Sleeper::rand(rand(0, 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\FileType;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\ReadDir;
|
||||
use App\Mail\SofaScoreDataMail;
|
||||
use App\Models\SofaScoreEventGrapped;
|
||||
use App\Models\SofaScoreTask;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendMail
|
||||
{
|
||||
public static function run(int $task_id)
|
||||
{
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Send Mail', 'bb');
|
||||
}
|
||||
|
||||
$task = SofaScoreTask::where('id', $task_id)->first();
|
||||
|
||||
$files = ReadDir::get_tree(Grap::$storage);
|
||||
|
||||
$sendfiles = FileType::filter($files, ['xlsx']);
|
||||
|
||||
$header = self::createHeader($task);
|
||||
|
||||
$table = self::createTable($task);
|
||||
|
||||
Mail::to('hermann.telser@gmail.com')
|
||||
->cc('ubaldo.perrucci@gmail.com')
|
||||
->send(
|
||||
new SofaScoreDataMail($header, $table, $sendfiles)
|
||||
);
|
||||
if ($debug) {
|
||||
Notice::note("Mail Send", 'bg');
|
||||
}
|
||||
}
|
||||
|
||||
public static function createTable(SofaScoreTask $task)
|
||||
{
|
||||
$res = SofaScoreEventGrapped::where('grapper_id', $task->id)->get();
|
||||
|
||||
$table = '';
|
||||
foreach ($res as $value) {
|
||||
$table .= '|' . $value->liga . '|' . $value->name . '|' . $value->starttime . '|
|
||||
';
|
||||
}
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
public static function createHeader(SofaScoreTask $task)
|
||||
{
|
||||
switch ($task->id) {
|
||||
case 2:
|
||||
$text = $task->name . ' - ' . $task->day_from;
|
||||
break;
|
||||
case 3:
|
||||
$text = $task->name . ' - ' . $task->day_from . ' - ' . $task->day_to;
|
||||
break;
|
||||
|
||||
default:
|
||||
$text = $task->name . ' - ' . Grap::$folder;
|
||||
break;
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\SofaScoreTask;
|
||||
use App\Models\SofaScoreTaskTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SettingsToLocal
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
$debug = Grap::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('⚽ settings to local');
|
||||
Notice::note('⚽ close all vpn');
|
||||
}
|
||||
exec('killall ssh');
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('⚽ open vpn');
|
||||
}
|
||||
exec('ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190');
|
||||
/**
|
||||
* SofaScoreRosa
|
||||
*/
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreRosa', 'g');
|
||||
}
|
||||
SofaScoreRosa::truncate();
|
||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_rosas')->get();
|
||||
foreach ($rows as $row) {
|
||||
SofaScoreRosa::insert((array) $row);
|
||||
}
|
||||
/**
|
||||
* SofaScoreTask
|
||||
*/
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreTask', 'g');
|
||||
}
|
||||
SofaScoreTask::truncate();
|
||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_tasks')->get();
|
||||
foreach ($rows as $row) {
|
||||
SofaScoreTask::insert((array) $row);
|
||||
}
|
||||
/**
|
||||
* SofaScoreTaskTournament
|
||||
*/
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreTaskTournament', 'g');
|
||||
}
|
||||
SofaScoreTaskTournament::truncate();
|
||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_task_tournaments')->get();
|
||||
foreach ($rows as $row) {
|
||||
SofaScoreTaskTournament::insert((array) $row);
|
||||
}
|
||||
/**
|
||||
* SofaScoreTournament
|
||||
*/
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreTournament', 'g');
|
||||
}
|
||||
SofaScoreTournament::truncate();
|
||||
$rows = DB::connection('remote_mariadb')->table('sofa_score_tournaments')->get();
|
||||
foreach ($rows as $row) {
|
||||
SofaScoreTournament::insert((array) $row);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('⚽ close all vpn');
|
||||
}
|
||||
exec('killall ssh');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\SofaScoreRosaTournament;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class SettingsToProduction
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('Settings To Production', 'bb');
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('SofaScoreRosaTournament', 'g');
|
||||
}
|
||||
|
||||
DB::connection('remote_mariadb')->table('sofa_score_rosa_tournaments')->truncate();
|
||||
|
||||
$rows = SofaScoreRosaTournament::get();
|
||||
|
||||
foreach ($rows as $row) {
|
||||
|
||||
DB::connection('remote_mariadb')->table('sofa_score_rosa_tournaments')->insert([
|
||||
"ss_team_id" => $row->ss_team_id,
|
||||
"ss_tournament_id" => $row->ss_tournament_id,
|
||||
"disabled" => $row->disabled,
|
||||
"grapped" => $row->grapped,
|
||||
"created_at" => $row->created_at,
|
||||
"updated_at" => $row->updated_at,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grap;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\ReadDir;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Strings;
|
||||
use App\Models\SofaScoreCategory;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\SofaScoreTask;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class SqlMover
|
||||
{
|
||||
public static function run()
|
||||
{
|
||||
|
||||
Notice::note('SqlMover', 'b');
|
||||
|
||||
|
||||
// $task = SofaScoreTask::where('id', 3)->first();
|
||||
// $folder = Strings::clean($task->name) . '-' . $task->day_from . '-' . $task->day_to;
|
||||
// $sofascore_data = storage_path('sofascore_data') . '/';
|
||||
// $files = ReadDir::get_tree($sofascore_data . $folder);
|
||||
// dd($files);
|
||||
|
||||
$file = file_get_contents(__dir__ . '/SqlMover/country.txt');
|
||||
$data = explode(PHP_EOL, $file);
|
||||
foreach ($data as $key => $value) {
|
||||
if ($key) {
|
||||
$row = explode(',', $value);
|
||||
$country_id = $row[0];
|
||||
$flag = $row[2];
|
||||
$season_mode = $row[6];
|
||||
SofaScoreCategory::where('country_id', $country_id)->update([
|
||||
'season_mode' => $season_mode,
|
||||
'flag' => $flag,
|
||||
'in_soccer' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Notice::note('DONE', 'r', 1);
|
||||
|
||||
|
||||
// Notice::note('StatistikoPlayer', 'b');
|
||||
// $res = StatistikoEvent::pluck('match_id');
|
||||
// foreach ($res as $match_id) {
|
||||
// $has = StatistikoPlayer::where('match_id', (int) $match_id)->first();
|
||||
// if (!$has)
|
||||
// echo $match_id . "\n";
|
||||
// }
|
||||
|
||||
// Notice::note('StatistikoEvent', 'b');
|
||||
// $res = StatistikoPlayer::get();
|
||||
// foreach ($res as $pl) {
|
||||
// $has = StatistikoEvent::where('match_id', (int) $pl->match_id)->first();
|
||||
// if (!$has) {
|
||||
// echo $match_id . "\n";
|
||||
// }
|
||||
// }
|
||||
|
||||
Notice::note('done', 'bb', 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
id,name,icon,iso2,iso3,cc,season_mode,is_country,disabled,created_at,updated_at
|
||||
467,Argentina,flag-country-ar,AR,ARG,ARG,fullyear,1,0,NULL,2026-06-15 17:26:31
|
||||
454,Australia,flag-country-au,AU,AUS,AUS,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
383,Austria,flag-country-at,AT,AUT,AUT,halfyear,1,0,NULL,2026-06-15 15:46:53
|
||||
377,Belgium,flag-country-be,BE,BEL,BEL,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
409,Brazil,flag-country-br,BR,BRA,BRA,fullyear,1,0,NULL,2026-06-15 15:46:11
|
||||
363,Bulgaria,flag-country-bg,BG,BGR,BUL,halfyear,1,0,NULL,2026-06-15 17:22:37
|
||||
424,China,flag-country-cn,CN,CHN,CHN,fullyear,1,0,NULL,2026-06-15 15:44:40
|
||||
389,Colombia,flag-country-co,CO,COL,COL,fullyear,1,0,NULL,2026-06-15 17:25:12
|
||||
415,Croatia,flag-country-hr,HR,HRV,CRO,NULL,1,0,NULL,NULL
|
||||
468,Czech Republic,flag-country-cz,CZ,CZE,CZE,NULL,1,0,NULL,2025-08-30 05:52:59
|
||||
378,Denmark,flag-country-dk,DK,DNK,DEN,fullyear,1,0,NULL,2026-06-15 17:25:12
|
||||
382,England,extra-england,NULL,ENG,ENG,NULL,1,0,2025-05-24 06:40:45,2025-05-24 06:40:45
|
||||
678,Europe,flag-country-eu,NULL,NULL,REUROPE,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:30:36
|
||||
381,European Cup,flag-country-eu,NULL,NULL,ECUP,halfyear,1,0,2025-08-30 04:45:37,2026-06-15 17:21:02
|
||||
403,Finland,flag-country-fi,FI,FIN,FIN,fullyear,1,0,NULL,2026-06-15 17:25:12
|
||||
408,France,flag-country-fr,FR,FRA,FRA,halfyear,1,0,NULL,2026-06-15 15:47:10
|
||||
446,Germany,flag-country-de,DE,DEU,GER,halfyear,1,0,NULL,2026-06-15 15:47:39
|
||||
394,Greece,flag-country-gr,GR,GRC,GRE,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
407,Holland,flag-country-nl,NL,NLD,DUT,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
412,Hungary,flag-country-hu,HU,HUN,HUN,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
373,Iceland,flag-country-is,IS,NULL,ICE,NULL,1,0,2025-08-30 04:45:33,2025-08-30 05:52:59
|
||||
466,International,extra-caf,NULL,NULL,INT,NULL,1,0,2025-08-30 04:45:33,2025-08-30 05:52:59
|
||||
543,International Cup,extra-world,NULL,NULL,ICUP,NULL,1,0,2025-08-30 04:45:36,2025-08-30 05:52:59
|
||||
435,Ireland,flag-country-ie,IE,IRL,IRE,NULL,1,0,NULL,NULL
|
||||
398,Italy,flag-country-it,IT,ITA,ITA,halfyear,1,0,NULL,2026-06-15 15:46:41
|
||||
416,Japan,flag-country-jp,JP,JPN,JPN,fullyear,1,0,NULL,2026-06-15 15:44:23
|
||||
406,Major League Soccer,NULL,NULL,NULL,MLS,fullyear,1,0,2025-08-30 04:45:33,2026-06-15 17:25:12
|
||||
413,Mexico,flag-country-mx,MX,MEX,MEX,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
426,Northern Ireland,extra-nordirland,NULL,NIR,NIR,NULL,1,0,2025-05-24 06:40:45,2025-05-24 06:40:45
|
||||
431,Norway,flag-country-no,NO,NOR,NOR,fullyear,1,0,NULL,2026-06-15 15:45:46
|
||||
457,Peru,flag-country-pe,PE,PER,PER,NULL,1,0,NULL,2025-05-24 06:40:45
|
||||
386,Poland,flag-country-pl,PL,POL,POL,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
418,Portugal,flag-country-pt,PT,PRT,POR,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
443,Romania,flag-country-ro,RO,ROU,ROM,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
368,Russia,flag-country-ru,RU,RUS,RUS,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
462,Saudi Arabia,flag-country-sa,SA,SAU,KSA,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
449,Scotland,extra-scotland,NULL,SCO,SCO,halfyear,1,0,2025-05-24 06:40:45,2026-06-15 17:21:02
|
||||
428,Serbia,flag-country-rs,RS,SRB,SRB,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
391,Slovakia,flag-country-sk,SK,SVK,SVK,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
441,Slovenia,flag-country-si,SI,SVN,SLO,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
680,South America,extra-world,NULL,NULL,RSOAM,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:28:34
|
||||
465,South America Cup,extra-world,NULL,NULL,SACUP,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:28:34
|
||||
437,South Korea,flag-country-kr,KR,KOR,KOR,fullyear,1,0,NULL,2026-06-15 17:25:12
|
||||
438,Spain,flag-country-es,ES,ESP,SPA,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
410,Sweden,flag-country-se,SE,SWE,SWE,fullyear,1,0,NULL,2026-06-15 15:45:31
|
||||
451,Switzerland,flag-country-ch,CH,CHE,SWI,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
405,Turkey,flag-country-tr,TR,TUR,TUR,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
452,Ukraine,flag-country-ua,UA,UKR,UKR,halfyear,1,0,NULL,2026-06-15 17:21:02
|
||||
1,World,extra-world,NULL,NULL,NULL,NULL,0,0,NULL,NULL
|
||||
531,World Club Cup,NULL,NULL,NULL,WCLUB,NULL,0,0,2026-02-24 16:28:34,2026-02-24 16:28:34
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,880 @@
|
||||
ARG1;Aldosivi;36836;Aldosivi;aldosivi
|
||||
ARG1;Argentinos Juniors;3216;Argentinos Juniors;argentinos-juniors
|
||||
ARG1;Atletico Tucuman;36833;Atletico Tucuman;atletico-tucuman
|
||||
ARG1;Banfield;3219;Banfield;banfield
|
||||
ARG1;Barracas Central;65668;Barracas Central;barracas-central
|
||||
ARG1;Belgrano;3203;Belgrano;belgrano
|
||||
ARG1;Boca Juniors;3202;Boca Juniors;boca-juniors
|
||||
ARG1;Central Cordoba;65676;Central Córdoba;central-cordoba
|
||||
ARG1;Defensa y Justicia;36839;Defensa y Justicia;defensa-y-justicia
|
||||
ARG1;Deportivo Riestra;189723;Deportivo Riestra;deportivo-riestra
|
||||
ARG1;Estudiantes;3206;Estudiantes de La Plata;estudiantes-de-la-plata
|
||||
ARG1;Estudiantes Rio Cuarto;266694;Estudiantes de Río Cuarto;estudiantes-de-rio-cuarto
|
||||
ARG1;Gimnasia LP;3205;Gimnasia y Esgrima;gimnasia-y-esgrima
|
||||
ARG1;Gimnasia Mendoza;188441;Gimnasia y Esgrima Mendoza;gimnasia-y-esgrima-mendoza
|
||||
ARG1;Huracan;7629;CA Huracan;ca-huracan
|
||||
ARG1;Independiente;3209;Independiente;independiente
|
||||
ARG1;Independiente Rivadavia;36842;Independiente Rivadavia;independiente-rivadavia
|
||||
ARG1;Instituto Cordoba;4937;Instituto Córdoba;instituto-cordoba
|
||||
ARG1;Lanus;3218;Lanús;lanus
|
||||
ARG1;Newell's Old Boys;3212;Newell's Old Boys;newells-old-boys
|
||||
ARG1;Platense;36837;Platense;platense
|
||||
ARG1;Racing Club;3215;Racing Club;racing-club
|
||||
ARG1;River Plate;3211;River Plate;river-plate
|
||||
ARG1;Rosario Central;3217;Rosario Central;rosario-central
|
||||
ARG1;San Lorenzo;3201;San Lorenzo;san-lorenzo
|
||||
ARG1;Sarmiento;42338;Sarmiento;sarmiento
|
||||
ARG1;Talleres;3210;Talleres;talleres
|
||||
ARG1;Tigre;7628;Tigre;tigre
|
||||
ARG1;Union Santa Fe;3204;Unión de Santa Fe;union-de-santa-fe
|
||||
ARG1;Velez Sarsfield;3208;Velez Sarsfield;velez-sarsfield
|
||||
AUS1;Adelaide United;2946;Adelaide United;adelaide-united
|
||||
AUS1;Auckland ;800224;Auckland FC;auckland-fc
|
||||
AUS1;Brisbane Roar;5968;Brisbane Roar;brisbane-roar
|
||||
AUS1;Central Coast Mariners;5966;Central Coast Mariners;central-coast-mariners
|
||||
AUS1;Macarthur;371682;Macarthur FC;macarthur-fc
|
||||
AUS1;Melbourne City;42210;Melbourne City;melbourne-city
|
||||
AUS1;Melbourne Victory;5970;Melbourne Victory;melbourne-victory
|
||||
AUS1;Newcastle Jets;2934;Newcastle Jets;newcastle-jets
|
||||
AUS1;Perth Glory;2945;Perth Glory;perth-glory
|
||||
AUS1;Sydney;5971;Sydney FC;sydney-fc
|
||||
AUS1;Wellington Phoenix;7568;Wellington Phoenix;wellington-phoenix
|
||||
AUS1;Western Sidney Wanderers;72926;Western Sydney Wanderers;western-sydney-wanderers
|
||||
AUT1;Altach;4856;SC Rheindorf Altach;sc-rheindorf-altach
|
||||
AUT1;Austria Lustenau;2062;Austria Lustenau;austria-lustenau
|
||||
AUT1;Austria Wien;2203;Austria Wien;austria-wien
|
||||
AUT1;Grazer;2052;Grazer AK 1902;grazer-ak-1902
|
||||
AUT1;Hartberg;2075;TSV Hartberg;tsv-hartberg
|
||||
AUT1;LASK Linz;2058;LASK;lask
|
||||
AUT1;Rapid Wien;2055;Rapid Wien;rapid-wien
|
||||
AUT1;Ried;2049;SV Ried;sv-ried
|
||||
AUT1;Salzburg;2046;Red Bull Salzburg;red-bull-salzburg
|
||||
AUT1;Sturm Graz;2051;SK Sturm Graz;sk-sturm-graz
|
||||
AUT1;Tirol Innsbruck;5405;WSG Swarovski Tirol;wsg-swarovski-tirol
|
||||
AUT1;Wolfsberger;2076;Wolfsberger AC;wolfsberger-ac
|
||||
BEL1;Anderlecht;2900;RSC Anderlecht;rsc-anderlecht
|
||||
BEL1;Antwerp;2889;Royal Antwerp FC;royal-antwerp-fc
|
||||
BEL1;Beveren;4859;SK Beveren;sk-beveren
|
||||
BEL1;Cercle Brugge;2929;Cercle Brugge;cercle-brugge
|
||||
BEL1;Charleroi;2898;RC Sporting Charleroi;rc-sporting-charleroi
|
||||
BEL1;Club Brugge;2888;Club Brugge;club-brugge
|
||||
BEL1;Genk;2890;KRC Genk;krc-genk
|
||||
BEL1;Gent;2903;KAA Gent;kaa-gent
|
||||
BEL1;Kortrijk;4858;KV Kortrijk;kv-kortrijk
|
||||
BEL1;La Louviere;368506;RAAL La Louvière;raal-la-louviere
|
||||
BEL1;Lommel;5046;Lommel SK;lommel-sk
|
||||
BEL1;Mechelen;5044;KV Mechelen;kv-mechelen
|
||||
BEL1;OH Leuven;2918;Oud-Heverlee Leuven;oud-heverlee-leuven
|
||||
BEL1;Sint Truiden;2895;Sint-Truidense VV;sint-truidense-vv
|
||||
BEL1;Standard Liege;2901;Standard Liege;standard-liege
|
||||
BEL1;Union Saint Gilloise;4860;Royale Union Saint-Gilloise;royale-union-saint-gilloise
|
||||
BEL1;Westerlo;2893;KVC Westerlo;kvc-westerlo
|
||||
BEL1;Zulte Waregem;2933;SV Zulte Waregem;sv-zulte-waregem
|
||||
BOL1;Always Ready;268083;Club Always Ready;club-always-ready
|
||||
BOL1;Blooming;6968;Blooming;blooming
|
||||
BOL1;Bolivar;7059;Bolívar;bolivar
|
||||
BOL1;Independiente Petrolero;372975;Club Independiente;independiente-petrolero
|
||||
BRA1;Atletico MG;1977;Atletico Mineiro;atletico-mineiro
|
||||
BRA1;Atletico PR;1967;Athletico Paranaense;athletico-paranaense
|
||||
BRA1;Bahia;1955;Bahia;bahia
|
||||
BRA1;Botafogo;1958;Botafogo;botafogo
|
||||
BRA1;Bragantino;1999;RB Bragantino;red-bull-bragantino
|
||||
BRA1;Chapecoense;21845;Chapecoense;chapecoense
|
||||
BRA1;Corinthians;1957;Corinthians;corinthians
|
||||
BRA1;Coritiba;1982;Coritiba;coritiba
|
||||
BRA1;Cruzeiro;1954;Cruzeiro;cruzeiro
|
||||
BRA1;Flamengo;5981;Flamengo;flamengo
|
||||
BRA1;Fluminense;1961;Fluminense;fluminense
|
||||
BRA1;Gremio;5926;Gremio;gremio
|
||||
BRA1;Internacional;1966;Internacional;internacional
|
||||
BRA1;Mirassol;21982;Mirassol;mirassol
|
||||
BRA1;Palmeiras;1963;Palmeiras;palmeiras
|
||||
BRA1;Remo;2012;Remo;remo
|
||||
BRA1;Santos;1968;Santos;santos
|
||||
BRA1;Sao Paulo;1981;Sao Paulo;sao-paulo
|
||||
BRA1;Vasco da Gama;1974;Vasco da Gama;vasco-da-gama
|
||||
BRA1;Vitoria;1962;Vitória;vitoria
|
||||
BUL1;Arda;274971;Arda Kardzhali;arda-kardzhali
|
||||
BUL1;Botev Plovdiv;5241;Botev Plovdiv;botev-plovdiv
|
||||
BUL1;Botev Vratsa;36938;Botev Vratsa;botev-vratsa
|
||||
BUL1;Cherno More;3280;Cherno More Varna;cherno-more-varna
|
||||
BUL1;CSKA 1948 Sofia;252080;FC CSKA 1948 Sofia;fc-cska-1948-sofia
|
||||
BUL1;CSKA Sofia;3275;CSKA Sofia;cska-sofia
|
||||
BUL1;Dunav Ruse;3286;Dunav Ruse;dunav-ruse
|
||||
BUL1;Levski Sofia;3273;Levski Sofia;levski-sofia
|
||||
BUL1;Lokomotiv Plovdiv;3272;Lokomotiv Plovdiv;lokomotiv-plovdiv
|
||||
BUL1;Lokomotiv Sofia;3277;Lokomotiv Sofia;lokomotiv-sofia
|
||||
BUL1;Ludogorets;43840;Ludogorets Razgrad;ludogorets-razgrad
|
||||
BUL1;Septemvri Sofia;201203;FK Septemvri Sofia;fk-septemvri-sofia
|
||||
BUL1;Slavia Sofia;3274;Slavia Sofia;slavia-sofia
|
||||
BUL1;Spartak Varna;3278;FK Spartak Varna;fk-spartak-varna
|
||||
CHI1;Audax Italiano;3162;Audax Italiano;audax-italiano
|
||||
CHI1;Coquimbo Unido;3165;Coquimbo Unido;coquimbo-unido
|
||||
CHI1;O'Higgins;3163;O'Higgins;ohiggins
|
||||
CHI1;Palestino;3157;Palestino;palestino
|
||||
CHI1;UC Chile;3151;Universidad Católica;universidad-catolica
|
||||
CHN1;Beijing Guoan;3376;Beijing Sinobo Guoan;beijing-sinobo-guoan
|
||||
CHN1;Chengdu Rongcheng;221241;Chengdu Rongcheng;chengdu-rongcheng
|
||||
CHN1;Chongqing Tonglianglong;474989;Chongqing Tonglianglong FC;chongqing-tonglianglong-fc
|
||||
CHN1;Dalian Yingbo;474992;Dalian Yingbo FC;dalian-young-boy-fc
|
||||
CHN1;Henan Songshan;34692;Henan Jianye;henan-jianye
|
||||
CHN1;Liaoning Tieren;221240;Liaoning Tieren FC;liaoning-shenyang-urban
|
||||
CHN1;Qingdao Hainiu;34695;Qingdao Hainiu;qingdao-hainiu
|
||||
CHN1;Qingdao West Coast;369532;Qingdao West Coast;qingdao-west-coast
|
||||
CHN1;Shandong Taishan;3371;Shandong Luneng Taishan;shandong-luneng-taishan
|
||||
CHN1;Shanghai Port;41537;Shanghai Port;shanghai-port
|
||||
CHN1;Shanghai Shenhua;3373;Shanghai Greenland Shenhua;shanghai-greenland-shenhua
|
||||
CHN1;Shenzhen Peng City;281331;Shenzhen City;shenzhen-city
|
||||
CHN1;Tianjin Tigers;3367;Tianjin Tigers;tianjin-tigers
|
||||
CHN1;Wuhan Three Towns;295152;Wuhan Three Towns;wuhan-three-towns
|
||||
CHN1;Yunnan Yukun;474991;Yunnan Yukun;yunnan-yukun
|
||||
CHN1;Zhejiang Professional;34697;Zhejiang;zhejiang
|
||||
COL1;Aguilas Doradas;48244;Rionegro Águilas Doradas;rionegro-aguilas-doradas
|
||||
COL1;Alianza FC;504899;Alianza Valledupar FC;alianza-futbol-club
|
||||
COL1;America de Cali;6102;América de Cali;america-de-cali
|
||||
COL1;Atletico Bucaramanga;6103;Atlético Bucaramanga;atletico-bucaramanga
|
||||
COL1;Atletico Nacional;6106;Atlético Nacional;atletico-nacional
|
||||
COL1;Boyaca Chico;6107;Boyacá Chicó FC;boyaca-chico-fc
|
||||
COL1;Deportes Tolima;6111;Deportes Tolima;deportes-tolima
|
||||
COL1;Deportivo Cali;6112;Deportivo Cali;deportivo-cali
|
||||
COL1;Deportivo Cucuta;6108;Cúcuta Deportivo;cucuta-deportivo
|
||||
COL1;Deportivo Pasto;6113;Deportivo Pasto;deportivo-pasto
|
||||
COL1;Deportivo Pereira;6109;Deportivo Pereira;deportivo-pereira
|
||||
COL1;Fortaleza CEIF;89368;Fortaleza CEIF;fortaleza-ceif
|
||||
COL1;Independiente Medellin;6115;Independiente Medellín;independiente-medellin
|
||||
COL1;Independiente Santa Fe;6116;Independiente Santa Fe;independiente-santa-fe
|
||||
COL1;Inter Bogota;1164534;Internacional de Bogota;internacional-de-bogota
|
||||
COL1;Jaguares de Cordoba;89370;Jaguares de Córdoba;jaguares-de-cordoba
|
||||
COL1;Junior FC;6105;Junior Barranquilla;junior-barranquilla
|
||||
COL1;Llaneros;89374;Llaneros FC;llaneros-fc
|
||||
COL1;Millonarios;6117;Millonarios;millonarios
|
||||
COL1;Once Caldas;6118;Once Caldas;once-caldas
|
||||
CRO1;Dinamo Zagreb;2032;GNK Dinamo Zagreb;gnk-dinamo-zagreb
|
||||
CRO1;Hajduk Split;2036;HNK Hajduk Split;hnk-hajduk-split
|
||||
CRO1;Istra;25529;NK Istra 1961;nk-istra-1961
|
||||
CRO1;Lokomotiva Zagreb;36246;NK Lokomotiva Zagreb;nk-lokomotiva-zagreb
|
||||
CRO1;Osijek;2040;NK Osijek;nk-osijek
|
||||
CRO1;Rijeka;2039;HNK Rijeka;hnk-rijeka
|
||||
CRO1;Rudes;35226;NK Rudeš;nk-rudes
|
||||
CRO1;Slaven Koprivnica;2042;NK Slaven Belupo;nk-slaven-belupo
|
||||
CRO1;Varazdin;231380;NK Varaždin;nk-varazdin
|
||||
CRO1;Velika Gorica;43917;HNK Gorica;hnk-gorica
|
||||
CZE1;Artis Brno;35264;SK Artis Brno;sk-lisen
|
||||
CZE1;Banik Ostrava;2204;Baník Ostrava;banik-ostrava
|
||||
CZE1;Bohemians Praha;6064;Bohemians Praha 1905;bohemians-praha-1905
|
||||
CZE1;Hradec Kralove;2217;FC Hradec Kralove;fc-hradec-kralove
|
||||
CZE1;Jablonec;2205;FK Jablonec;fk-jablonec
|
||||
CZE1;Mlada Boleslav;2224;Mlada Boleslav;mlada-boleslav
|
||||
CZE1;Pardubice;2230;Pardubice;pardubice
|
||||
CZE1;Sigma Olomouc;2207;SK Sigma Olomouc;sk-sigma-olomouc
|
||||
CZE1;Slavia Praha;2216;Slavia Praha;slavia-praha
|
||||
CZE1;Slovacko;4871;1. FC Slovacko;1-fc-slovacko
|
||||
CZE1;Slovan Liberec;2219;Slovan Liberec;slovan-liberec
|
||||
CZE1;Sparta Praha;2218;Sparta Praha;sparta-praha
|
||||
CZE1;Teplice;2208;FK Teplice;fk-teplice
|
||||
CZE1;Viktoria Plzen;4502;Viktoria Plzeň;viktoria-plzen
|
||||
CZE1;Zbrojovka Brno;2210;FC Zbrojovka Brno;fc-zbrojovka-brno
|
||||
CZE1;Zlin;2220;Fastav Zlín;fastav-zlin
|
||||
DEN1;AGF Aarhus;1291;AGF;agf
|
||||
DEN1;Brondby;1281;Brøndby IF;brondby-if
|
||||
DEN1;Horsens;1297;AC Horsens;ac-horsens
|
||||
DEN1;Kobenhavn;1284;FC København;fc-kobenhavn
|
||||
DEN1;Lyngby;1756;Lyngby BK;lyngby-bk
|
||||
DEN1;Midtjylland;1289;FC Midtjylland;fc-midtjylland
|
||||
DEN1;Nordsjaelland;1292;FC Nordsjælland;fc-nordsjaelland
|
||||
DEN1;OB Odense;1286;OB;ob
|
||||
DEN1;Randers;1301;Randers FC;randers-fc
|
||||
DEN1;Silkeborg;1285;Silkeborg;silkeborg
|
||||
DEN1;Sonderjyske;1295;SønderjyskE;sonderjyske
|
||||
DEN1;Viborg;1288;Viborg FF;viborg-ff
|
||||
ECU1;Barcelona Guayaquil;5250;Barcelona SC Guayaquil;barcelona-sc
|
||||
ECU1;Deportivo Cuenca;5251;Deportivo Cuenca;deportivo-cuenca
|
||||
ECU1;Independiente Del Valle;39723;Independiente del Valle;independiente-del-valle
|
||||
ECU1;LDU Quito;5257;LDU;ldu
|
||||
ECU1;Macara;6001;Macará;macara
|
||||
ENG1;Arsenal;42;Arsenal;arsenal
|
||||
ENG1;Aston Villa;40;Aston Villa;aston-villa
|
||||
ENG1;Bournemouth;60;Bournemouth;bournemouth
|
||||
ENG1;Brentford;50;Brentford;brentford
|
||||
ENG1;Brighton & Hove;30;Brighton & Hove Albion;brighton-hove-albion
|
||||
ENG1;Chelsea;38;Chelsea;chelsea
|
||||
ENG1;Coventry;11;Coventry City;coventry-city
|
||||
ENG1;Crystal Palace;7;Crystal Palace;crystal-palace
|
||||
ENG1;Everton;48;Everton;everton
|
||||
ENG1;Fulham;43;Fulham;fulham
|
||||
ENG1;Hull;96;Hull City;hull-city
|
||||
ENG1;Ipswich;32;Ipswich Town;ipswich-town
|
||||
ENG1;Leeds;34;Leeds United;leeds-united
|
||||
ENG1;Liverpool;44;Liverpool;liverpool
|
||||
ENG1;Manchester City;17;Manchester City;manchester-city
|
||||
ENG1;Manchester United;35;Manchester United;manchester-united
|
||||
ENG1;Newcastle;39;Newcastle United;newcastle-united
|
||||
ENG1;Nottingham;14;Nottingham Forest;nottingham-forest
|
||||
ENG1;Sunderland;41;Sunderland;sunderland
|
||||
ENG1;Tottenham;33;Tottenham;tottenham
|
||||
ENG2;Birmingham;9;Birmingham City;birmingham-city
|
||||
ENG2;Blackburn;46;Blackburn Rovers;blackburn-rovers
|
||||
ENG2;Bolton;5;Bolton Wanderers;bolton-wanderers
|
||||
ENG2;Bristol City;58;Bristol City;bristol-city
|
||||
ENG2;Burnley;6;Burnley;burnley
|
||||
ENG2;Cardiff;61;Cardiff City;cardiff-city
|
||||
ENG2;Charlton;47;Charlton Athletic;charlton-athletic
|
||||
ENG2;Derby;27;Derby County;derby-county
|
||||
ENG2;Lincoln;92;Lincoln City;lincoln-city
|
||||
ENG2;Middlesbrough;36;Middlesbrough;middlesbrough
|
||||
ENG2;Millwall;25;Millwall;millwall
|
||||
ENG2;Norwich;263;Norwich City;norwich-city
|
||||
ENG2;Portsmouth;2;Portsmouth;portsmouth
|
||||
ENG2;Preston;21;Preston North End;preston-north-end
|
||||
ENG2;QPR;1;Queens Park Rangers;queens-park-rangers
|
||||
ENG2;Sheffield United;15;Sheffield United;sheffield-united
|
||||
ENG2;Southampton;45;Southampton;southampton
|
||||
ENG2;Stoke;29;Stoke City;stoke-city
|
||||
ENG2;Swansea;74;Swansea City;swansea-city
|
||||
ENG2;Watford;24;Watford;watford
|
||||
ENG2;West Bromwich;8;West Bromwich Albion;west-bromwich-albion
|
||||
ENG2;West Ham;37;West Ham United;west-ham-united
|
||||
ENG2;Wolverhampton;3;Wolverhampton;wolverhampton
|
||||
ENG2;Wrexham;64;Wrexham;wrexham
|
||||
ENG3;Barnsley;23;Barnsley;barnsley
|
||||
ENG3;Blackpool;67;Blackpool;blackpool
|
||||
ENG3;Bradford City;22;Bradford City;bradford-city
|
||||
ENG3;Bromley;180;Bromley;bromley
|
||||
ENG3;Burton;134;Burton Albion;burton-albion
|
||||
ENG3;Cambridge United;63;Cambridge United;cambridge-united
|
||||
ENG3;Doncaster;84;Doncaster Rovers;doncaster-rovers
|
||||
ENG3;Huddersfield;59;Huddersfield Town;huddersfield-town
|
||||
ENG3;Leicester;31;Leicester City;leicester-city
|
||||
ENG3;Leyton Orient;83;Leyton Orient;leyton-orient
|
||||
ENG3;Luton;72;Luton Town;luton-town
|
||||
ENG3;Mansfield;70;Mansfield Town;mansfield-town
|
||||
ENG3;Milton Keynes;4;Milton Keynes Dons;milton-keynes-dons
|
||||
ENG3;Notts County;56;Notts County;notts-county
|
||||
ENG3;Oxford United;95;Oxford United;oxford-united
|
||||
ENG3;Peterborough;54;Peterborough United;peterborough-united
|
||||
ENG3;Plymouth;71;Plymouth Argyle;plymouth-argyle
|
||||
ENG3;Reading;28;Reading;reading
|
||||
ENG3;Sheffield Wednesday;12;Sheffield Wednesday;sheffield-wednesday
|
||||
ENG3;Stevenage;133;Stevenage;stevenage
|
||||
ENG3;Stockport;10;Stockport County;stockport-county
|
||||
ENG3;Wigan;49;Wigan Athletic;wigan-athletic
|
||||
ENG3;Wimbledon;23957;AFC Wimbledon;afc-wimbledon
|
||||
ENG3;Wycombe;62;Wycombe Wanderers;wycombe-wanderers
|
||||
ENG4;Accrington;187;Accrington Stanley;accrington-stanley
|
||||
ENG4;Barnet;77;Barnet;barnet
|
||||
ENG4;Bristol Rovers;76;Bristol Rovers;bristol-rovers
|
||||
ENG4;Cheltenham;69;Cheltenham Town;cheltenham-town
|
||||
ENG4;Chesterfield;68;Chesterfield;chesterfield
|
||||
ENG4;Colchester;66;Colchester United;colchester-united
|
||||
ENG4;Crawley;4875;Crawley Town;crawley-town
|
||||
ENG4;Crewe;19;Crewe Alexandra;crewe-alexandra
|
||||
ENG4;Exeter;86;Exeter City;exeter-city
|
||||
ENG4;Fleetwood;23959;Fleetwood Town;fleetwood-town
|
||||
ENG4;Gillingham;20;Gillingham;gillingham
|
||||
ENG4;Grimsby;18;Grimsby Town;grimsby-town
|
||||
ENG4;Newport;79;Newport County;newport-county
|
||||
ENG4;Northampton;57;Northampton Town;northampton-town
|
||||
ENG4;Oldham;65;Oldham Athletic;oldham-athletic
|
||||
ENG4;Port Vale;55;Port Vale;port-vale
|
||||
ENG4;Rochdale;103;Rochdale;rochdale
|
||||
ENG4;Rotherham;13;Rotherham United;rotherham-united
|
||||
ENG4;Salford;37998;Salford City;salford-city
|
||||
ENG4;Shrewsbury;82;Shrewsbury Town;shrewsbury-town
|
||||
ENG4;Swindon;53;Swindon Town;swindon-town
|
||||
ENG4;Tranmere;51;Tranmere Rovers;tranmere-rovers
|
||||
ENG4;Walsall;26;Walsall;walsall
|
||||
ENG4;York City;73;York City;york-city
|
||||
FIN1;Gnistan;2271;Gnistan;gnistan
|
||||
FIN1;HJK;2242;HJK Helsinki;hjk-helsinki
|
||||
FIN1;Ilves;22386;Ilves Tampere;ilves-tampere
|
||||
FIN1;Inter Turku;2247;Inter Turku;inter-turku
|
||||
FIN1;Jaro;2252;FF Jaro;ff-jaro
|
||||
FIN1;KuPS;2244;KuPS Kuopio;kups-kuopio
|
||||
FIN1;Lahti;2249;FC Lahti;fc-lahti
|
||||
FIN1;Mariehamn;5058;IFK Mariehamn;ifk-mariehamn
|
||||
FIN1;Oulu;5114;AC Oulu;ac-oulu
|
||||
FIN1;SJK;22395;SJK Seinajoki;sjk-seinajoki
|
||||
FIN1;TPS;2254;TPS Turku;tps-turku
|
||||
FIN1;VPS;2246;VPS;vps
|
||||
FRA1;Angers;1684;Angers;angers
|
||||
FRA1;Auxerre;1646;AJ Auxerre;aj-auxerre
|
||||
FRA1;Brest;1715;Stade Brestois 29;stade-brestois-29
|
||||
FRA1;Le Havre;1662;Le Havre;le-havre
|
||||
FRA1;Le Mans;1672;Le Mans;le-mans
|
||||
FRA1;Lens;1648;RC Lens;rc-lens
|
||||
FRA1;Lille;1643;Lille OSC;lille-osc
|
||||
FRA1;Lorient;1656;Lorient;lorient
|
||||
FRA1;Lyon;1649;Olympique Lyonnais;olympique-lyonnais
|
||||
FRA1;Marseille;1641;Olympique de Marseille;olympique-de-marseille
|
||||
FRA1;Monaco;1653;AS Monaco;as-monaco
|
||||
FRA1;Nice;1661;OGC Nice;ogc-nice
|
||||
FRA1;Paris;6070;Paris FC;paris-fc
|
||||
FRA1;PSG;1644;Paris Saint-Germain;paris-saint-germain
|
||||
FRA1;Rennes;1658;Stade Rennais;stade-rennais
|
||||
FRA1;Strasbourg;1659;Strasbourg;strasbourg
|
||||
FRA1;Toulouse;1681;Toulouse;toulouse
|
||||
FRA1;Troyes;1652;Troyes;troyes
|
||||
FRA2;Annecy;210894;Annecy FC;annecy-fc
|
||||
FRA2;Boulogne;1711;US Boulogne Côte-d'Opale;us-boulogne-cote-dopale
|
||||
FRA2;Clermont;1680;Clermont Foot 63;clermont-foot-63
|
||||
FRA2;Dijon;1686;Dijon;dijon
|
||||
FRA2;Dunkerque;6918;Dunkerque;dunkerque
|
||||
FRA2;Grenoble;1671;Grenoble;grenoble
|
||||
FRA2;Guingamp;1654;Guingamp;guingamp
|
||||
FRA2;Laval;1673;Stade Lavallois;stade-lavallois
|
||||
FRA2;Metz;1651;Metz;metz
|
||||
FRA2;Montpellier;1642;Montpellier;montpellier
|
||||
FRA2;Nancy;1675;Nancy;nancy
|
||||
FRA2;Nantes;1647;FC Nantes;fc-nantes
|
||||
FRA2;Pau;1685;Pau FC;pau-fc
|
||||
FRA2;Red Star;52874;Red Star FC;red-star-fc
|
||||
FRA2;Reims;1682;Stade de Reims;stade-de-reims
|
||||
FRA2;Rodez;6925;Rodez AF;rodez-af
|
||||
FRA2;Saint Etienne;1678;Saint-Étienne;saint-etienne
|
||||
FRA2;Sochaux;1657;Sochaux;sochaux
|
||||
GER1;Augsburg;2600;Augsburg;augsburg
|
||||
GER1;Bayern Munchen;2672;Bayern München;bayern-munchen
|
||||
GER1;Dortmund;2673;Borussia Dortmund;borussia-dortmund
|
||||
GER1;Eintracht Frankfurt;2674;Eintracht Frankfurt;eintracht-frankfurt
|
||||
GER1;Elversberg;2598;SV 07 Elversberg;sv-07-elversberg
|
||||
GER1;Freiburg;2538;Freiburg;freiburg
|
||||
GER1;Hamburger;2676;Hamburger SV;hamburger-sv
|
||||
GER1;Hoffenheim;2569;1899 Hoffenheim;1899-hoffenheim
|
||||
GER1;Koln;2671;1. FC Köln;1-fc-koln
|
||||
GER1;Leipzig;36360;RB Leipzig;rb-leipzig
|
||||
GER1;Leverkusen;2681;Bayer 04 Leverkusen;bayer-04-leverkusen
|
||||
GER1;Mainz;2556;1. FSV Mainz 05;1-fsv-mainz-05
|
||||
GER1;Monchengladbach;2527;Borussia M'gladbach;borussia-mgladbach
|
||||
GER1;Paderborn;2561;SC Paderborn 07;sc-paderborn-07
|
||||
GER1;Schalke;2530;FC Schalke 04;fc-schalke-04
|
||||
GER1;Stuttgart;2677;VfB Stuttgart;vfb-stuttgart
|
||||
GER1;Union Berlin;2547;1. FC Union Berlin;1-fc-union-berlin
|
||||
GER1;Werder Bremen;2534;Werder Bremen;werder-bremen
|
||||
GER2;Arminia Bielefeld;2540;Arminia Bielefeld;arminia-bielefeld
|
||||
GER2;Bochum;2542;VfL Bochum;vfl-bochum
|
||||
GER2;Darmstadt;2576;Darmstadt 98;darmstadt-98
|
||||
GER2;Dynamo Dresden;2595;Dynamo Dresden;dynamo-dresden
|
||||
GER2;Eintracht Braunschweig;2557;Eintracht Braunschweig;eintracht-braunschweig
|
||||
GER2;Energie Cottbus;2532;Energie Cottbus;energie-cottbus
|
||||
GER2;Greuther Furth;2551;SpVgg Greuther Fürth;spvgg-greuther-furth
|
||||
GER2;Hannover;2541;Hannover 96;hannover-96
|
||||
GER2;Heidenheim;5885;1. FC Heidenheim;1-fc-heidenheim
|
||||
GER2;Hertha;2528;Hertha BSC;hertha-bsc
|
||||
GER2;Holstein Kiel;2573;Holstein Kiel;holstein-kiel
|
||||
GER2;Kaiserslautern;2675;1. FC Kaiserslautern;1-fc-kaiserslautern
|
||||
GER2;Karlsruher;2553;Karlsruher SC;karlsruher-sc
|
||||
GER2;Magdeburg;2591;1. FC Magdeburg;1-fc-magdeburg
|
||||
GER2;Nurnberg;2523;1. FC Nürnberg;1-fc-nurnberg
|
||||
GER2;Osnabruck;2581;VfL Osnabrück;vfl-osnabruck
|
||||
GER2;St. Pauli;2526;FC St. Pauli;fc-st-pauli
|
||||
GER2;Wolfsburg;2524;Wolfsburg;wolfsburg
|
||||
GRE1;AEK Athens;3250;AEK Athens;aek-athens
|
||||
GRE1;Aris;3252;Aris Thessaloniki;aris-thessaloniki
|
||||
GRE1;Asteras Tripolis;6342;Asteras Tripolis;asteras-tripolis
|
||||
GRE1;Atromitos;5062;Atromitos Athens;atromitos-athens
|
||||
GRE1;Iraklis;0;---;---
|
||||
GRE1;Kalamata;412056;PS Kalamata;pae-ps-kalamata
|
||||
GRE1;Kifisia;120224;A.E. Kifisia FC;ae-kifisia-fc
|
||||
GRE1;Levadiakos;5063;Levadiakos;levadiakos
|
||||
GRE1;OFI;3241;OFI Crete;ofi-crete
|
||||
GRE1;Olympiakos;3245;Olympiacos;olympiacos
|
||||
GRE1;Panaitolikos;7004;Panetolikos;panetolikos
|
||||
GRE1;Panathinaikos;3248;Panathinaikos;panathinaikos
|
||||
GRE1;PAOK;3251;PAOK;paok
|
||||
GRE1;Volos;267459;Volos NFC;volos-nfc
|
||||
HUN1;Debrecen;1921;Debreceni VSC;debreceni-vsc
|
||||
HUN1;Ferencvaros;1925;Ferencvarosi TC;ferencvarosi-tc
|
||||
HUN1;Gyori ETO;1923;ETO FC Győr;eto-fc-gyor
|
||||
HUN1;Honved;1916;Budapest Honved;budapest-honved
|
||||
HUN1;Kisvarda;25397;Kisvarda Master Good;kisvarda-fc
|
||||
HUN1;MTK;1915;MTK Budapest;mtk-budapest
|
||||
HUN1;Nyiregyhaza;5124;Nyiregyháza Spartacus;nyiregyhaza-spartacus
|
||||
HUN1;Paksi;6059;Paksi;paksi
|
||||
HUN1;Puskas;25596;Puskas Akademia;puskas-akademia
|
||||
HUN1;Ujpest;1924;Újpest;ujpest
|
||||
HUN1;Vasas;1919;Vasas;vasas
|
||||
HUN1;Zalaegerszegi;1922;Zalaegerszegi TE;zalaegerszegi-te
|
||||
ISL1;Akranes;1898;ÍA Akranes;ia-akranes
|
||||
ISL1;Akureyri;1904;KA Akureyri;ka-akureyri
|
||||
ISL1;Breidablik;1901;Breiðablik Kópavogur;breidablik-kopavogur
|
||||
ISL1;Fram;1893;Fram Reykjavík;fram-reykjavik
|
||||
ISL1;Hafnarfjardar;1894;FH Hafnarfjörður;fh-hafnarfjordur
|
||||
ISL1;Keflavik;1900;Keflavík IF;keflavik-if
|
||||
ISL1;KR Reykjavik;1902;KR Reykjavík;kr-reykjavik
|
||||
ISL1;Stjarnan;1912;Stjarnan Garðabær;stjarnan-gardabaer
|
||||
ISL1;Thor Akureyri;1903;Þór Akureyri;thor-akureyri
|
||||
ISL1;Valur;1899;Valur Reykjavík;valur-reykjavik
|
||||
ISL1;Vestmannaeyja;1895;ÍBV;ibv
|
||||
ISL1;Vikingur Reykjavik;1908;Víkingur Reykjavík;vikingur-reykjavik
|
||||
IRL1;Bohemian Dublin;3173;Bohemian;bohemian
|
||||
IRL1;Derry;3170;Derry City;derry-city
|
||||
IRL1;Drogheda;3180;Drogheda United;drogheda-united
|
||||
IRL1;Dundalk;3179;Dundalk;dundalk
|
||||
IRL1;Galway;137382;Galway United;galway-united
|
||||
IRL1;Shamrock Rovers;3177;Shamrock Rovers;shamrock-rovers
|
||||
IRL1;Shelbourne;3174;Shelbourne;shelbourne
|
||||
IRL1;Sligo Rovers;3190;Sligo Rovers;sligo-rovers
|
||||
IRL1;St Patrick's;3169;St. Patrick's Athletic;st-patricks-athletic
|
||||
IRL1;Waterford;3194;Waterford;waterford
|
||||
ITA1;Atalanta;2686;Atalanta;atalanta
|
||||
ITA1;Bologna;2685;Bologna;bologna
|
||||
ITA1;Cagliari;2719;Cagliari;cagliari
|
||||
ITA1;Como;2704;Como;como
|
||||
ITA1;Fiorentina;2693;Fiorentina;fiorentina
|
||||
ITA1;Frosinone;2801;Frosinone;frosinone
|
||||
ITA1;Genoa;2713;Genoa;genoa
|
||||
ITA1;Internazionale;2697;Inter;inter
|
||||
ITA1;Juventus;2687;Juventus;juventus
|
||||
ITA1;Lazio;2699;Lazio;lazio
|
||||
ITA1;Lecce;2689;Lecce;lecce
|
||||
ITA1;Milan;2692;Milan;milan
|
||||
ITA1;Monza;2729;Monza;monza
|
||||
ITA1;Napoli;2714;Napoli;napoli
|
||||
ITA1;Parma;2690;Parma;parma
|
||||
ITA1;Roma;2702;Roma;roma
|
||||
ITA1;Sassuolo;2793;Sassuolo;sassuolo
|
||||
ITA1;Torino;2696;Torino;torino
|
||||
ITA1;Udinese;2695;Udinese;udinese
|
||||
ITA1;Venezia;2688;Venezia;venezia
|
||||
ITA2;Arezzo;2731;Arezzo;arezzo
|
||||
ITA2;Ascoli;2707;Ascoli;ascoli
|
||||
ITA2;Avellino;2730;Avellino;avellino
|
||||
ITA2;Benevento;2759;Benevento;benevento
|
||||
ITA2;Carrarese;2745;Carrarese;carrarese
|
||||
ITA2;Catanzaro;2796;Catanzaro;catanzaro
|
||||
ITA2;Cesena;2742;Cesena;cesena
|
||||
ITA2;Cremonese;2761;Cremonese;cremonese
|
||||
ITA2;Empoli;2705;Empoli;empoli
|
||||
ITA2;Entella;43680;Virtus Entella;virtus-entella
|
||||
ITA2;Juve Stabia;5324;Juve Stabia;juve-stabia
|
||||
ITA2;Mantova;2770;Mantova;mantova
|
||||
ITA2;Modena;2706;Modena;modena
|
||||
ITA2;Padova;2741;Padova;padova
|
||||
ITA2;Palermo;2715;Palermo;palermo
|
||||
ITA2;Pisa;2737;Pisa;pisa
|
||||
ITA2;Sampdoria;2711;Sampdoria;sampdoria
|
||||
ITA2;Sudtirol;2760;Südtirol;sudtirol
|
||||
ITA2;Verona;2701;Hellas Verona;hellas-verona
|
||||
ITA2;Vicenza;2722;L.R. Vicenza;lr-vicenza
|
||||
JPN1;Avispa Fukuoka;3143;Avispa Fukuoka;avispa-fukuoka
|
||||
JPN1;Cerezo Osaka;3141;Cerezo Osaka;cerezo-osaka
|
||||
JPN1;Fagiano Okayama;34034;Fagiano Okayama;fagiano-okayama
|
||||
JPN1;Gamba Osaka;3138;Gamba Osaka;gamba-osaka
|
||||
JPN1;JEF United;3144;JEF United Chiba;jef-united-chiba
|
||||
JPN1;Kashima Antlers;3134;Kashima Antlers;kashima-antlers
|
||||
JPN1;Kashiwa Reysol;3140;Kashiwa Reysol;kashiwa-reysol
|
||||
JPN1;Kawasaki Frontale;5127;Kawasaki Frontale;kawasaki-frontale
|
||||
JPN1;Kyoto Sanga;3149;Kyoto Sanga FC;kyoto-sanga-fc
|
||||
JPN1;Machida Zelvia;44409;Machida Zelvia;machida-zelvia
|
||||
JPN1;Mito Hollyhock;21901;Mito Hollyhock;mito-hollyhock
|
||||
JPN1;Nagoya Grampus;3136;Nagoya Grampus Eight;nagoya-grampus-eight
|
||||
JPN1;Sanfrecce Hiroshima;3135;Sanfrecce Hiroshima;sanfrecce-hiroshima
|
||||
JPN1;Shimizu S Pulse;3133;Shimizu S-Pulse;shimizu-s-pulse
|
||||
JPN1;Tokyo FC;3147;FC Tokyo;fc-tokyo
|
||||
JPN1;Tokyo Verdy;3139;Tokyo Verdy;tokyo-verdy
|
||||
JPN1;Urawa Reds;3145;Urawa Red Diamonds;urawa-red-diamonds
|
||||
JPN1;Varen Nagasaki;38154;V-Varen Nagasaki;v-varen-nagasaki
|
||||
JPN1;Vissel Kobe;3146;Vissel Kobe;vissel-kobe
|
||||
JPN1;Yokohama F. Marinos;3137;Yokohama F. Marinos;yokohama-f-marinos
|
||||
MEX1;Atlante;1943;Atlante FC;atlante-fc
|
||||
MEX1;Atlas;1949;Atlas;atlas
|
||||
MEX1;Atletico San Luis;1950;Atletico de San Luis;atletico-de-san-luis
|
||||
MEX1;Club America;1939;Club America;club-america
|
||||
MEX1;Club Guadalajara;1938;CD Guadalajara;cd-guadalajara
|
||||
MEX1;Club Necaxa;1944;Club Necaxa;club-necaxa
|
||||
MEX1;Cruz Azul;1947;Cruz Azul;cruz-azul
|
||||
MEX1;Juarez;201624;Juarez FC;juarez-fc
|
||||
MEX1;Leon;36534;Club León;club-leon
|
||||
MEX1;Monterrey;1932;Monterrey;monterrey
|
||||
MEX1;Pachuca;1936;Pachuca;pachuca
|
||||
MEX1;Puebla;1941;Puebla;puebla
|
||||
MEX1;Pumas UNAM;1933;Pumas UNAM;pumas-unam
|
||||
MEX1;Queretaro;1951;Queretaro;queretaro
|
||||
MEX1;Santos Laguna;1948;Santos Laguna;santos-laguna
|
||||
MEX1;Tigres UANL;1940;Tigres UANL;tigres-uanl
|
||||
MEX1;Tijuana;36525;Club Tijuana;club-tijuana
|
||||
MEX1;Toluca;1931;Toluca;toluca
|
||||
NED1;Ajax;2953;Ajax;ajax
|
||||
NED1;AZ Alkmaar;2950;AZ Alkmaar;az-alkmaar
|
||||
NED1;Cambuur;2970;SC Cambuur;sc-cambuur
|
||||
NED1;Den Haag;2966;ADO Den Haag;ado-den-haag
|
||||
NED1;Excelsior;2967;Excelsior;excelsior
|
||||
NED1;Feyenoord;2959;Feyenoord;feyenoord
|
||||
NED1;Fortuna Sittard;2957;Fortuna Sittard;fortuna-sittard
|
||||
NED1;Go Ahead Eagles;2979;Go Ahead Eagles;go-ahead-eagles
|
||||
NED1;Groningen;2951;Groningen;groningen
|
||||
NED1;Heerenveen;2964;Heerenveen;heerenveen
|
||||
NED1;NEC Nijmegen;2962;NEC Nijmegen;nec-nijmegen
|
||||
NED1;PSV;2952;PSV Eindhoven;psv-eindhoven
|
||||
NED1;Sparta Rotterdam;2960;Sparta Rotterdam;sparta-rotterdam
|
||||
NED1;Telstar;2972;SC Telstar;sc-telstar
|
||||
NED1;Twente;2955;FC Twente;fc-twente
|
||||
NED1;Utrecht;2948;FC Utrecht;fc-utrecht
|
||||
NED1;Willem II;2961;Willem II Tilburg;willem-ii-tilburg
|
||||
NED1;Zwolle;2971;PEC Zwolle;pec-zwolle
|
||||
NED2;Almere;2990;Almere City FC;almere-city-fc
|
||||
NED2;De Graafschap;2949;De Graafschap;de-graafschap
|
||||
NED2;Den Bosch;2963;FC Den Bosch;fc-den-bosch
|
||||
NED2;Dordrecht;2973;FC Dordrecht;fc-dordrecht
|
||||
NED2;Eindhoven;2994;FC Eindhoven;fc-eindhoven
|
||||
NED2;Emmen;2965;FC Emmen;fc-emmen
|
||||
NED2;Helmond;2974;Helmond Sport;helmond-sport
|
||||
NED2;Heracles;2977;Heracles Almelo;heracles-almelo
|
||||
NED2;Jong Ajax;46160;Jong Ajax;jong-ajax
|
||||
NED2;Jong AZ;46161;Jong AZ Alkmaar;jong-az-alkmaar
|
||||
NED2;Jong PSV;46168;Jong PSV Eindhoven;jong-psv-eindhoven
|
||||
NED2;Jong Utrecht;53067;Jong FC Utrecht;jong-fc-utrecht
|
||||
NED2;MVV Maastricht;2976;MVV Maastricht;mvv-maastricht
|
||||
NED2;NAC Breda;2947;NAC Breda;nac-breda
|
||||
NED2;Oss;2978;TOP Oss;top-oss
|
||||
NED2;RKC Waalwijk;2956;RKC Waalwijk;rkc-waalwijk
|
||||
NED2;Roda;2954;Roda JC Kerkrade;roda-jc-kerkrade
|
||||
NED2;Vitesse;2958;Vitesse;vitesse
|
||||
NED2;Volendam;2968;Volendam;volendam
|
||||
NED2;VVV Venlo;2980;VVV-Venlo;vvv-venlo
|
||||
NOR1;Aalesund;677;Aalesunds FK;aalesunds-fk
|
||||
NOR1;Bodo/Glimt;656;Bodø/Glimt;bodoglimt
|
||||
NOR1;Brann;1159;SK Brann;sk-brann
|
||||
NOR1;Fredrikstad;687;Fredrikstad FK;fredrikstad-fk
|
||||
NOR1;Ham Kam;666;HamKam;hamkam
|
||||
NOR1;KFUM Oslo;786;KFUM Oslo;kfum-oslo
|
||||
NOR1;Kristiansund;957;Kristiansund BK;kristiansund-bk
|
||||
NOR1;Lillestrom;664;Lillestrøm SK;lillestrom-sk
|
||||
NOR1;Molde;661;Molde FK;molde-fk
|
||||
NOR1;Rosenborg;1161;Rosenborg BK;rosenborg-bk
|
||||
NOR1;Sandefjord;676;Sandefjord Fotball;sandefjord-fotball
|
||||
NOR1;Sarpsborg;822;Sarpsborg 08;sarpsborg-08
|
||||
NOR1;Start;667;IK Start;ik-start
|
||||
NOR1;Tromso;660;Tromsø IL;tromso-il
|
||||
NOR1;Valerenga;1165;Valerenga IF;valerenga-if
|
||||
NOR1;Viking;1164;Viking FK;viking-fk
|
||||
PAR1;Cerro Porteno;5991;Cerro Porteño;cerro-porteno
|
||||
PAR1;Libertad Asuncion;5996;Libertad;libertad
|
||||
PAR1;Olimpia Asuncion;5997;Olimpia;olimpia
|
||||
PAR1;Recoleta;292595;Recoleta FC;deportivo-recoleta
|
||||
PER1;AD Tarma;335557;Asociación Deportiva Tarma;asociacion-deportiva-tarma
|
||||
PER1;Alianza Atletico;2307;Alianza Atlético de Sullana;alianza-atletico-de-sullana
|
||||
PER1;Alianza Lima;2311;Alianza Lima;alianza-lima
|
||||
PER1;Atletico Grau;282538;Club Atlético Grau;club-atletico-grau
|
||||
PER1;Cienciano;2301;Cienciano;cienciano
|
||||
PER1;Comerciantes Unidos;213609;Comerciantes Unidos;comerciantes-unidos
|
||||
PER1;Cusco FC;63760;Cusco FC;cusco-fc
|
||||
PER1;Deportivo Garcilaso;458584;Deportivo Garcilaso;deportivo-garcilaso
|
||||
PER1;FC Cajamarca;1082002;FC Cajamarca;fc-cajamarca
|
||||
PER1;Juan Pablo II;511206;ADC Juan Pablo II;adc-juan-pablo-ii
|
||||
PER1;Los Chankas;252254;Los Chankas CYC;los-chankas-cyc
|
||||
PER1;Melgar;2308;Melgar;melgar
|
||||
PER1;Moquegua;492848;CD Moquegua;ucv-de-moquegua
|
||||
PER1;Sport Boys;2312;Sport Boys;sport-boys
|
||||
PER1;Sport Huancayo;33895;Sport Huancayo;sport-huancayo
|
||||
PER1;Sporting Cristal;2302;Club Sporting Cristal;club-sporting-cristal
|
||||
PER1;Universitario de Deportes;2305;Universitario;universitario
|
||||
PER1;UTC Cajamarca;87854;Universidad Técnica de Cajamarca;universidad-tecnica-de-cajamarca
|
||||
POL1;Cracovia Krakow;4901;KS Cracovia;ks-cracovia-krakow
|
||||
POL1;GKS Katowice;3112;GKS Katowice;gks-katowice
|
||||
POL1;Gornik Zabrze;3110;Górnik Zabrze;gornik-zabrze
|
||||
POL1;Jagiellonia Bialystok;7691;Jagiellonia Białystok;jagiellonia-bialystok
|
||||
POL1;Korona Kielce;5065;MKS Korona Kielce;mks-korona-kielce
|
||||
POL1;Lech Poznan;3121;Lech Poznań;lech-poznan
|
||||
POL1;Legia Warszawa;3106;Legia Warszawa;legia-warszawa
|
||||
POL1;Motor Lublin;7915;Motor Lublin;motor-lublin
|
||||
POL1;Piast Gliwice;7918;Piast Gliwice;piast-gliwice
|
||||
POL1;Pogon Szczecin;3117;Pogoń Szczecin;pogon-szczecin
|
||||
POL1;Radomiak Radom;7295;RKS Radomiak Radom;rks-radomiak-radom
|
||||
POL1;Rakow Czestochowa;35268;Raków Częstochowa;rakow-czestochowa
|
||||
POL1;Slask Wroclaw;3108;Śląsk Wrocław;slask-wroclaw
|
||||
POL1;Widzew Lodz;3115;Widzew Łódź;widzew-lodz
|
||||
POL1;Wieczysta Krakow;334956;Wieczysta Kraków;wieczysta-krakow
|
||||
POL1;Wisla Krakow;3111;Wisła Kraków;wisla-krakow
|
||||
POL1;Wisla Plock;3122;Wisła Płock;wisla-plock
|
||||
POL1;Zaglebie Lubin;3113;Zagłębie Lubin;zaglebie-lubin
|
||||
POR1;Academico Viseu;3022;Academico Viseu;academico-viseu
|
||||
POR1;Alverca;190328;FC Alverca;fc-alverca
|
||||
POR1;Arouca;25777;Arouca;arouca
|
||||
POR1;Benfica;3006;SL Benfica;sl-benfica
|
||||
POR1;Casa Pia;36365;Casa Pia;casa-pia
|
||||
POR1;Estoril;4500;Estoril Praia;estoril-praia
|
||||
POR1;Estrela;3035;CF Estrela da Amadora;cf-estrela-da-amadora
|
||||
POR1;Famalicao;49531;FC Famalicao;fc-famalicao
|
||||
POR1;Gil Vicente;3010;Gil Vicente FC;gil-vicente-fc
|
||||
POR1;Maritimo;3007;Marítimo;maritimo
|
||||
POR1;Moreirense;3014;Moreirense;moreirense
|
||||
POR1;Nacional Madeira;3013;CD Nacional;cd-nacional
|
||||
POR1;Porto;3002;FC Porto;fc-porto
|
||||
POR1;Rio Ave;3036;Rio Ave;rio-ave
|
||||
POR1;Santa Clara;3011;CD Santa Clara;cd-santa-clara
|
||||
POR1;Sporting Braga;2999;Sporting Braga;sporting-braga
|
||||
POR1;Sporting CP;3001;Sporting CP;sporting-cp
|
||||
POR1;Vitoria Guimaraes;3009;Vitória de Guimaraes;vitoria-de-guimaraes
|
||||
POR2;Academica Coimbra;3015;Academica Coimbra;academica-coimbra
|
||||
POR2;Amarante;207139;Amarante FC;amarante-fc
|
||||
POR2;Avs;483088;AVS - Futebol SAD;avs-futebol-sad
|
||||
POR2;Benfica II;74465;SL Benfica B;sl-benfica-b
|
||||
POR2;Chaves;3025;GD Chaves;gd-chaves
|
||||
POR2;Farense;2998;SC Farense;sc-farense
|
||||
POR2;Feirense;4501;Feirense;feirense
|
||||
POR2;Felgueiras;3030;Felgueiras;felgueiras
|
||||
POR2;Leixoes;3018;Leixões SC;leixoes-sc
|
||||
POR2;Lusitania de Lourosa;35174;Lusitânia Lourosa;lusitania-lourosa
|
||||
POR2;Penafiel;3017;Penafiel;penafiel
|
||||
POR2;Portimonense;3026;Portimonense;portimonense
|
||||
POR2;Porto II;74469;FC Porto B;fc-porto-b
|
||||
POR2;Sporting CP II;74467;Sporting CP B;sporting-cp-b
|
||||
POR2;Tondela;38396;Tondela;tondela
|
||||
POR2;Torreense;25787;Torreense;torreense
|
||||
POR2;Uniao Leiria;3000;União Leiria;uniao-leiria
|
||||
POR2;Vizela;5136;FC Vizela;fc-vizela
|
||||
ROU1;Arges Pitesti;116221;FC Argeş Piteşti;fc-arges-pitesti
|
||||
ROU1;Botosani;24798;FC Botoșani;fc-botosani
|
||||
ROU1;CFR Cluj;5287;CFR Cluj;cfr-cluj
|
||||
ROU1;Corvinul Hunedoara;148278;FC Corvinul Hunedoara;fc-corvinul-hunedoara
|
||||
ROU1;Dinamo Bucuresti;3292;Dinamo București;dinamo-bucuresti
|
||||
ROU1;Farul Constanta;3294;Farul Constanța;farul-constanta
|
||||
ROU1;Miercurea Ciuc;283972;FK Csíkszereda Miercurea Ciuc;fk-csikszereda-miercurea-ciuc
|
||||
ROU1;Otelul Galati;3291;SC Oțelul Galați;sc-otelul-galati
|
||||
ROU1;Petrolul Ploiesti;25856;FC Petrolul Ploieşti;fc-petrolul-ploiesti
|
||||
ROU1;Rapid Bucuresti;295403;FC Rapid București;fc-rapid-bucuresti
|
||||
ROU1;Sepsi Sfantu Gheorghe;189789;Sepsi OSK;sepsi-osk
|
||||
ROU1;Steaua Bucuresti;3301;FCSB;fcsb
|
||||
ROU1;Universitatea Cluj;7734;FC Universitatea Cluj;fc-universitatea-cluj
|
||||
ROU1;Universitatea Craiova;116223;Universitatea Craiova;universitatea-craiova
|
||||
ROU1;UTA Arad;204657;UTA Arad;uta-arad
|
||||
ROU1;Voluntari;44255;FC Voluntari;fc-voluntari
|
||||
RUS1;Akhmat Grozny;5131;Akhmat Grozny;akhmat-grozny
|
||||
RUS1;Akron;285689;Akron Togliatti;akron-togliatti
|
||||
RUS1;Baltika;7517;Baltika Kaliningrad;baltika-kaliningrad
|
||||
RUS1;CSKA Moskva;2325;CSKA Moscow;cska-moscow
|
||||
RUS1;Dinamo Moskva;2315;Dynamo Moscow;dynamo-moscow
|
||||
RUS1;Dynamo Makhachkala;362016;Dinamo Makhachkala;dinamo-makhachkala
|
||||
RUS1;Fakel;2317;Fakel Voronezh;fakel-voronezh
|
||||
RUS1;Gazovik Orenburg;24118;Orenburg;orenburg
|
||||
RUS1;Krasnodar;34425;FC Krasnodar;fc-krasnodar
|
||||
RUS1;Krylya Sovetov;2322;Krylya Sovetov Samara;krylya-sovetov-samara
|
||||
RUS1;Lokomotiv Moskva;2320;Lokomotiv Moscow;lokomotiv-moscow
|
||||
RUS1;Rodina Moskva;322699;Rodina Moscow;rodina-moscow
|
||||
RUS1;Rostov;2326;FC Rostov;fc-rostov
|
||||
RUS1;Rubin Kazan;2333;Rubin Kazan;rubin-kazan
|
||||
RUS1;Spartak Moskva;2323;Spartak Moscow;spartak-moscow
|
||||
RUS1;Zenit Sankt Peterburg;2321;Zenit St. Petersburg;zenit-st-petersburg
|
||||
KSA1;Abha;168090;Abha;abha
|
||||
KSA1;Al Ahli Jeddah;34469;Al-Ahli Saudi;al-ahli-saudi
|
||||
KSA1;Al Diriyah;853574;Al Diriyah;al-diraiyah
|
||||
KSA1;Al Faisaly;56035;Al Faisaly;al-faisaly
|
||||
KSA1;Al Fateh;56023;Al-Fateh;al-fateh
|
||||
KSA1;Al Feiha;168094;Al-Fayha;al-fayha
|
||||
KSA1;Al Hazm;168086;Al Hazem;al-hazem
|
||||
KSA1;Al Hilal;21895;Al-Hilal Saudi;al-hilal-saudi
|
||||
KSA1;Al Ittifaq;34318;Al-Ettifaq;al-ettifaq
|
||||
KSA1;Al Ittihad;34315;Al-Ittihad;al-ittihad
|
||||
KSA1;Al Khaleej;167228;Al-Khaleej;al-khaleej
|
||||
KSA1;Al Kholood;269199;Al Kholood;al-kholood
|
||||
KSA1;Al Nassr;23400;Al-Nassr;al-nassr
|
||||
KSA1;Al Qadsiah;56027;Al-Qadisiyah;al-qadisiyah
|
||||
KSA1;Al Riyadh;168088;Al Riyadh;al-riyadh
|
||||
KSA1;Al Shabab;34313;Al-Shabab;al-shabab
|
||||
KSA1;Al Taawon;56021;Al-Taawoun;al-taawoun
|
||||
KSA1;Neom;530631;Neom SC;neom-sc
|
||||
SCO1;Aberdeen;2355;Aberdeen;aberdeen
|
||||
SCO1;Celtic;2352;Celtic;celtic
|
||||
SCO1;Dundee;2357;Dundee FC;dundee-fc
|
||||
SCO1;Dundee United;2349;Dundee United;dundee-united
|
||||
SCO1;Falkirk;2363;Falkirk FC;falkirk-fc
|
||||
SCO1;Heart of Midlothian;2353;Heart of Midlothian;heart-of-midlothian
|
||||
SCO1;Hibernian;2354;Hibernian;hibernian
|
||||
SCO1;Kilmarnock;2347;Kilmarnock;kilmarnock
|
||||
SCO1;Motherwell;2346;Motherwell;motherwell
|
||||
SCO1;Rangers Glasgow;2351;Rangers;rangers
|
||||
SCO1;St. Johnstone;2348;St. Johnstone;st-johnstone
|
||||
SCO1;St. Mirren;2359;St. Mirren;st-mirren
|
||||
SRB1;Crvena Zvezda;5149;FK Crvena zvezda;fk-crvena-zvezda
|
||||
SRB1;Cukaricki;5148;FK Čukaricki;fk-cukaricki
|
||||
SRB1;IMT Beograd;308176;FK IMT;fk-imt
|
||||
SRB1;Macva Sabac;56019;FK Macva Šabac;fk-macva-sabac
|
||||
SRB1;Mladost Lucani;7771;FK Mladost Lucani;fk-mladost-lucani
|
||||
SRB1;Novi Pazar;25736;FK Novi Pazar;fk-novi-pazar
|
||||
SRB1;OFK Beograd;5153;OFK Beograd;ofk-beograd
|
||||
SRB1;Partizan Beograd;5152;FK Partizan;fk-partizan
|
||||
SRB1;Radnicki Kragujevac;43981;FK Radnicki 1923;fk-radnicki-1923
|
||||
SRB1;Radnicki Nis;25737;FK Radnicki Niš;fk-radnicki-nis
|
||||
SRB1;Radnik Surdulica;111127;FK Radnik Surdulica;fk-radnik-surdulica
|
||||
SRB1;Vojvodina;5150;FK Vojvodina;fk-vojvodina
|
||||
SRB1;Zeleznicar Pancevo;282203;FK Železničar Pančevo;fk-zeleznicar-pancevo
|
||||
SRB1;Zemun;5157;FK Zemun;fk-zemun
|
||||
SVK1;Dukla Banska Bystrica;4503;Dukla Banska Bystrica;dukla-banska-bystrica
|
||||
SVK1;Dunajska Streda;23833;DAC Dunajska Streda;dac-dunajska-streda
|
||||
SVK1;Komarno;189813;KFC Komárno;kfc-komarno
|
||||
SVK1;Kosice;168476;FC Košice;fc-kosice
|
||||
SVK1;Podbrezova;7887;FK Železiarne Podbrezova;fk-zeleziarne-podbrezova
|
||||
SVK1;Ruzomberok;2397;MFK Ružomberok;mfk-ruzomberok
|
||||
SVK1;Skalica;111061;MFK Skalica;mfk-skalica
|
||||
SVK1;Slovan Bratislava;2404;Slovan Bratislava;slovan-bratislava
|
||||
SVK1;Spartak Trnava;2406;Spartak Trnava;spartak-trnava
|
||||
SVK1;Trencin;2398;AS Trencín;as-trencin
|
||||
SVK1;Zemplin Michalovce;7885;MFK Zemplín Michalovce;mfk-zemplin-michalovce
|
||||
SVK1;Zilina;2402;MŠK Žilina;msk-zilina
|
||||
SVN1;Aluminij;2424;NK Aluminij Kidricevo;nk-aluminij-kidricevo
|
||||
SVN1;Bravo Publikum;261800;AŠK Bravo;ask-bravo
|
||||
SVN1;Brinje Grosuplje;274937;Brinje Grosuplje;brinje-grosuplje
|
||||
SVN1;Celje;2413;NK Celje;nk-celje
|
||||
SVN1;Koper;2417;FC Luka Koper;fc-luka-koper
|
||||
SVN1;Maribor;2420;NK Maribor;nk-maribor
|
||||
SVN1;Mura;213357;NŠ Mura;ns-mura
|
||||
SVN1;Nafta;2430;NK Nafta Lendava 1903;nk-nafta-lendava-1903
|
||||
SVN1;Olimpija Ljubljana;2416;NK Olimpija Ljubljana;nk-olimpija-ljubljana
|
||||
SVN1;Radomlje;37737;Kalcer Radomlje;kalcer-radomlje
|
||||
KOR1;Anyang;32675;FC Anyang;fc-anyang
|
||||
KOR1;Bucheon;92539;Bucheon FC 1995;bucheon-fc-1995
|
||||
KOR1;Daejeon Citizen;7645;Daejeon Hana Citizen;daejeon-hana-citizen
|
||||
KOR1;Gangwon;34220;Gangwon FC;gangwon-fc
|
||||
KOR1;Gwangju;48912;Gwangju FC;gwangju-fc
|
||||
KOR1;Incheon;7648;Incheon United;incheon-united
|
||||
KOR1;Jeju;7649;Jeju United;jeju-united
|
||||
KOR1;Jeonbuk Motors;6908;Jeonbuk Hyundai Motors;jeonbuk-hyundai-motors
|
||||
KOR1;Pohang Steelers;7650;Pohang Steelers;pohang-steelers
|
||||
KOR1;Sangju Sangmu;7647;Sangju Sangmu;sangju-sangmu
|
||||
KOR1;Seoul;7646;FC Seoul;fc-seoul
|
||||
KOR1;Ulsan;7653;Ulsan Hyundai;ulsan-hyundai
|
||||
ESP1;Alaves;2885;Deportivo Alaves;deportivo-alaves
|
||||
ESP1;Athletic Bilbao;2825;Athletic Bilbao;athletic-bilbao
|
||||
ESP1;Atletico Madrid;2836;Atletico Madrid;atletico-madrid
|
||||
ESP1;Barcelona;2817;Barcelona;barcelona
|
||||
ESP1;Betis;2816;Real Betis;real-betis
|
||||
ESP1;Celta Vigo;2821;Celta Vigo;celta-vigo
|
||||
ESP1;Deportivo La Coruna;2832;Deportivo La Coruña;deportivo-la-coruna
|
||||
ESP1;Elche;2846;Elche CF;elche-cf
|
||||
ESP1;Espanyol;2814;Espanyol;espanyol
|
||||
ESP1;Getafe;2859;Getafe;getafe
|
||||
ESP1;Levante;2849;Levante;levante
|
||||
ESP1;Malaga;2830;Malaga;malaga
|
||||
ESP1;Osasuna;2820;Osasuna;osasuna
|
||||
ESP1;Racing Santander;2835;Racing de Santander;racing-de-santander
|
||||
ESP1;Rayo Vallecano;2818;Rayo Vallecano;rayo-vallecano
|
||||
ESP1;Real Madrid;2829;Real Madrid;real-madrid
|
||||
ESP1;Real Sociedad;2824;Real Sociedad;real-sociedad
|
||||
ESP1;Sevilla;2833;Sevilla;sevilla
|
||||
ESP1;Valencia;2828;Valencia;valencia
|
||||
ESP1;Villarreal;2819;Villarreal;villarreal
|
||||
ESP2;Albacete;2848;Albacete Balompie;albacete-balompie
|
||||
ESP2;Almeria;2858;Almería;almeria
|
||||
ESP2;Andorra CF;324871;FC Andorra;fc-andorra
|
||||
ESP2;Burgos;2854;Burgos;burgos
|
||||
ESP2;Cadiz;4488;Cadiz;cadiz
|
||||
ESP2;Castellon;5067;CD Castellón;cd-castellon
|
||||
ESP2;Celta Vigo II;24336;Celta Fortuna;celta-vigo-b
|
||||
ESP2;Ceuta;2869;AD Ceuta;ad-ceuta
|
||||
ESP2;Cordoba;2850;Córdoba;cordoba
|
||||
ESP2;Eibar;2839;Eibar;eibar
|
||||
ESP2;Eldense;47321;CD Eldense;cd-eldense
|
||||
ESP2;Gijon;2852;Sporting Gijón;sporting-gijon
|
||||
ESP2;Girona;24264;Girona;girona
|
||||
ESP2;Granada;33779;Granada;granada
|
||||
ESP2;Las Palmas;6577;Las Palmas;las-palmas
|
||||
ESP2;Leganes;2845;Leganes;leganes
|
||||
ESP2;Mallorca;2826;RCD Mallorca;rcd-mallorca
|
||||
ESP2;Oviedo;2851;Real Oviedo;real-oviedo
|
||||
ESP2;Real Sociedad II;24360;Real Sociedad B;real-sociedad-b
|
||||
ESP2;Sabadell;24335;CE Sabadell;ce-sabadell
|
||||
ESP2;Tenerife;2822;Tenerife;tenerife
|
||||
ESP2;Valladolid;2831;Real Valladolid;real-valladolid
|
||||
SWE1;AIK;1764;AIK;aik
|
||||
SWE1;Brommapojkarna;1787;IF Brommapojkarna;if-brommapojkarna
|
||||
SWE1;Degerfors;1807;Degerfors IF;degerfors-if
|
||||
SWE1;Djurgarden;1759;Djurgardens IF;djurgardens-if
|
||||
SWE1;Elfsborg;1762;IF Elfsborg;if-elfsborg
|
||||
SWE1;GAIS;1786;GAIS Göteborg;gais-goteborg
|
||||
SWE1;Goteborg;1761;IFK Göteborg;ifk-goteborg
|
||||
SWE1;Hacken;1760;BK Hacken;bk-hacken
|
||||
SWE1;Halmstad;1767;Halmstads BK;halmstads-bk
|
||||
SWE1;Hammarby;1758;Hammarby IF;hammarby-if
|
||||
SWE1;Kalmar;1891;Kalmar FF;kalmar-ff
|
||||
SWE1;Malmo;1892;Malmö FF;malmo-ff
|
||||
SWE1;Mjallby;1783;Mjallby AIF;mjallby-aif
|
||||
SWE1;Orgryte;1766;Örgryte IS;orgryte-is
|
||||
SWE1;Sirius;1793;IK Sirius;ik-sirius
|
||||
SWE1;Vasteras;1775;Västerås SK;vasteras-sk
|
||||
SUI1;Basel;2501;FC Basel;fc-basel
|
||||
SUI1;Grasshopper;2449;Grasshopper Club Zürich;grasshopper-club-zurich
|
||||
SUI1;Lausanne;2446;FC Lausanne-Sport;fc-lausanne-sport
|
||||
SUI1;Lugano;2443;FC Lugano;fc-lugano
|
||||
SUI1;Luzern;2453;FC Luzern;fc-luzern
|
||||
SUI1;Servette;2448;Servette;servette
|
||||
SUI1;Sion;2452;FC Sion;fc-sion
|
||||
SUI1;St. Gallen;2442;FC St. Gallen 1879;fc-st-gallen-1879
|
||||
SUI1;Thun;2454;FC Thun;fc-thun
|
||||
SUI1;Vaduz;2463;FC Vaduz;fc-vaduz
|
||||
SUI1;Young Boys;2445;Young Boys;young-boys
|
||||
SUI1;Zurich;2450;FC Zürich;fc-zurich
|
||||
TUR1;Alanyaspor;6362;Alanyaspor;alanyaspor
|
||||
TUR1;Amedspor;207011;Amed Sportif Faaliyetler;amed-sportif-faaliyetler
|
||||
TUR1;Basaksehir;3086;Başakşehir F.K.;medipol-basaksehir
|
||||
TUR1;Besiktas;3050;Beşiktaş;besiktas
|
||||
TUR1;Caykur Rizespor;3064;Çaykur Rizespor;caykur-rizespor
|
||||
TUR1;Corum;77629;Çorum FK;corum-fk
|
||||
TUR1;Erzurumspor;55603;BB Erzurumspor;bb-erzurumspor
|
||||
TUR1;Eyupspor;7040;Eyüpspor;eyupspor
|
||||
TUR1;Fenerbahce;3052;Fenerbahce;fenerbahce
|
||||
TUR1;Galatasaray;3061;Galatasaray;galatasaray
|
||||
TUR1;Gaziantep BB;5138;Gaziantep FK;gaziantep-fk
|
||||
TUR1;Genclerbirligi;7802;Genclerbirliği;genclerbirligi
|
||||
TUR1;Goztepe;3054;Göztepe;goztepe-sk
|
||||
TUR1;Kasimpasa;6063;Kasımpaşa;kasimpasa
|
||||
TUR1;Kocaelispor;3065;Kocaelispor;kocaelispor
|
||||
TUR1;Konyaspor;3085;Konyaspor;konyaspor
|
||||
TUR1;Samsunspor;3053;Samsunspor;samsunspor
|
||||
TUR1;Trabzonspor;3051;Trabzonspor;trabzonspor
|
||||
UKR1;Bukovyna;43336;Bukovyna Chernivtsi;bukovyna-chernivtsi
|
||||
UKR1;Chornomorets;3310;Chornomorets Odesa;chornomorets-odesa
|
||||
UKR1;Dynamo Kyiv;3305;Dynamo Kyiv;dynamo-kyiv
|
||||
UKR1;Epitsentr;323552;FC Epicentr Dunaivtsi;fc-epicentr-dunaivtsi
|
||||
UKR1;FC Kharkiv;266889;FC Kharkiv;metalist-1925
|
||||
UKR1;Hirnyk Kryvbas;294048;FC Kryvbas Kryvyi Rih;fc-kryvbas-kryvyi-rih
|
||||
UKR1;Karpaty;3316;Karpaty Lviv;karpaty-lviv
|
||||
UKR1;Kolos Kovalivka;200776;Kolos Kovalivka;kolos-kovalivka
|
||||
UKR1;Kudrivka;316055;Kudrivka;kudrivka-irpin
|
||||
UKR1;Livyi Bereh;388209;FC Livyi Bereh Kyiv;fc-livyi-bereh-kyiv
|
||||
UKR1;LNZ Cherkasy;284427;LNZ Cherkasy;lnz-cherkasy
|
||||
UKR1;Obolon Kyiv;138564;Obolon Kyiv;obolon-kyiv
|
||||
UKR1;Polissya;258536;Polissya Zhytomyr;polissya-zhytomyr
|
||||
UKR1;Shakhtar Donetsk;3313;Shakhtar Donetsk;shakhtar-donetsk
|
||||
UKR1;Veres Rivne;200773;Veres Rivne;veres-rivne
|
||||
UKR1;Zorya;5987;Zorya Luhansk;zorya-luhansk
|
||||
URU1;Boston River;174970;Boston River;boston-river
|
||||
URU1;Juventud de Las Piedras;3224;Juventud de Las Piedras;juventud-de-las-piedras
|
||||
URU1;Montevideo City Torque;174972;Montevideo City Torque;montevideo-city-torque
|
||||
URU1;Nacional Montevideo;3230;Nacional;club-nacional-de-football
|
||||
URU1;Penarol;3227;Peñarol;penarol
|
||||
USA1;Atlanta United;243211;Atlanta United FC;atlanta-united
|
||||
USA1;Austin FC;377973;Austin FC;austin-fc
|
||||
USA1;Charlotte FC;404108;Charlotte FC;charlotte-fc
|
||||
USA1;Chicago Fire;2505;Chicago Fire;chicago-fire
|
||||
USA1;Cincinnati FC;215167;FC Cincinnati;fc-cincinnati
|
||||
USA1;Colorado Rapids;2510;Colorado Rapids;colorado-rapids
|
||||
USA1;Columbus Crew;2504;Columbus Crew;columbus-crew
|
||||
USA1;Dallas FC;2512;FC Dallas;fc-dallas
|
||||
USA1;DC United;2502;DC United;dc-united
|
||||
USA1;Houston Dynamo;2508;Houston Dynamo;houston-dynamo
|
||||
USA1;Inter Miami;337602;Inter Miami CF;inter-miami-cf
|
||||
USA1;Los Angeles FC;274650;Los Angeles FC;los-angeles-fc
|
||||
USA1;Los Angeles Galaxy;2513;LA Galaxy;la-galaxy
|
||||
USA1;Minnesota United;41618;Minnesota United FC;minnesota-united
|
||||
USA1;Montreal Impact;22006;Impact Montreal;impact-montreal
|
||||
USA1;Nashville SC;337612;Nashville SC;nashville-sc
|
||||
USA1;New England Revolution;2511;New England Revolution;new-england-revolution
|
||||
USA1;New York City;187643;New York City FC;new-york-city-fc
|
||||
USA1;New York RB;2506;New York Red Bulls;new-york-red-bulls
|
||||
USA1;Orlando City;52237;Orlando City SC;orlando-city
|
||||
USA1;Philadelphia Union;39833;Philadelphia Union;philadelphia-union
|
||||
USA1;Portland Timbers;22007;Portland Timbers;portland-timbers
|
||||
USA1;Real Salt Lake;5133;Real Salt Lake;real-salt-lake
|
||||
USA1;San Diego;1043961;San Diego FC;san-diego-fc
|
||||
USA1;San Jose Earthquakes;21825;San Jose Earthquakes;san-jose-earthquakes
|
||||
USA1;Seattle Sounders;22009;Seattle Sounders;seattle-sounders
|
||||
USA1;Sporting Kansas City;2509;Sporting Kansas City;sporting-kansas-city
|
||||
USA1;St. Louis City;407803;Saint Louis City SC;saint-louis-city-sc
|
||||
USA1;Toronto FC;7080;Toronto FC;toronto-fc
|
||||
USA1;Vancouver Whitecaps;22010;Vancouver Whitecaps;vancouver-whitecaps
|
||||
VEN1;Academia Puerto Cabello;230725;Academia Puerto Cabello;academia-puerto-cabello
|
||||
VEN1;Carabobo;6229;Carabobo FC;carabobo
|
||||
VEN1;Caracas FC;6230;Caracas F.C.;caracas-fc
|
||||
VEN1;Deportivo La Guaira;36437;Deportivo La Guaira;deportivo-la-guaira
|
||||
VEN1;Universidad Central;249952;Universidad Central;ucv-fc
|
||||
|
Binary file not shown.
Whitespace-only changes.
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Sofascore;
|
||||
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\CurlSofa;
|
||||
use App\Console\Commands\Grapper\Sofascore\Helper\Sleeper;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\SofaScoreRosaTournament;
|
||||
use App\Models\SofaScoreTournament;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class TournamentTeams
|
||||
{
|
||||
public static function get()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$tournaments_counter = 0;
|
||||
|
||||
$teams_counter = 0;
|
||||
|
||||
$tournaments = SofaScoreTournament::with('sofascore_category')->where('enabled', 1)->get();
|
||||
|
||||
SofaScoreRosa::query()->update(['grapped' => 0]);
|
||||
SofaScoreRosaTournament::query()->update(['grapped' => 0]);
|
||||
|
||||
foreach ($tournaments as $tournament) {
|
||||
|
||||
$tournaments_counter++;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("$tournaments_counter Tournament: $tournament->name", 'bb');
|
||||
}
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/unique-tournament/$tournament->tournament_id/seasons";
|
||||
|
||||
Sleeper::rand(1);
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
$season_id = $data['seasons'][0]['id'];
|
||||
|
||||
$url = Nuh::$options['base_url'] . "api/v1/unique-tournament/$tournament->tournament_id/season/$season_id/standings/total";
|
||||
|
||||
Sleeper::rand();
|
||||
|
||||
$data = CurlSofa::load($url);
|
||||
|
||||
if (isset($data['standings'])) {
|
||||
foreach ($data['standings'][0]['rows'] as $row) {
|
||||
$teams_counter++;
|
||||
|
||||
$ss_team_id = $row['team']['id'];
|
||||
$name = $row['team']['name'];
|
||||
$country_id = $tournament->sofascore_category->country_id;
|
||||
|
||||
SofaScoreRosa::updateOrCreate([
|
||||
'sport_id' => $tournament->sport_id,
|
||||
'ss_team_id' => (int) $ss_team_id,
|
||||
], [
|
||||
'country_id' => (int) $country_id,
|
||||
'ss_team_name' => $name,
|
||||
'grapped' => 1,
|
||||
'disabled' => 0,
|
||||
]);
|
||||
SofaScoreRosaTournament::updateOrCreate([
|
||||
'ss_tournament_id' => (int) $tournament->tournament_id,
|
||||
'ss_team_id' => (int) $ss_team_id,
|
||||
], [
|
||||
'grapped' => 1,
|
||||
'disabled' => 0,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SofaScoreRosa::where('grapped', 0)->update(['disabled' => 1]);
|
||||
SofaScoreRosaTournament::where('grapped', 0)->update(['disabled' => 1]);
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("summe tournaments: $tournaments_counter", 'p');
|
||||
Notice::note("summe teams: $teams_counter", 'p');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Countries;
|
||||
use App\Console\Commands\Grapper\TxOdds\Fixtures;
|
||||
use App\Console\Commands\Grapper\TxOdds\Groups;
|
||||
use App\Console\Commands\Grapper\TxOdds\MajorGroups;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
|
||||
class TxOdds
|
||||
{
|
||||
public static function switch()
|
||||
{
|
||||
switch (Nuh::$options['name']) {
|
||||
case 'Fixtures':
|
||||
Fixtures::grap();
|
||||
break;
|
||||
case 'Countries':
|
||||
Countries::grap();
|
||||
break;
|
||||
case 'Groups':
|
||||
Groups::grap();
|
||||
break;
|
||||
case 'Major Groups':
|
||||
MajorGroups::grap();
|
||||
break;
|
||||
default:
|
||||
Odds::grap();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\Country;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Countries
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/countries.php';
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
$count = 0;
|
||||
foreach ($data as $row) {
|
||||
Country::updateOrCreate(
|
||||
['id' => (int) $row->id],
|
||||
['name' => (string) $row->name, 'cc' => (string) $row->cc]
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
Notice::note("$count countries processed", 'g');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\Element;
|
||||
use App\Models\ElementGroup;
|
||||
use App\Models\Event;
|
||||
use App\Models\Group;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Fixtures
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$today = Nuh::$options['t'] ?? 0;
|
||||
$week = Nuh::$options['w'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('TXODDS FIXTURES', 'b');
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$total_soccer = 0;
|
||||
$total_others = 0;
|
||||
|
||||
$sports = Sport::where('is_active', 1)->pluck('id')->toArray();
|
||||
|
||||
/**
|
||||
* Grap
|
||||
*/
|
||||
$kontos = ['soccer' => config('env.txodds_betaid1'), 'other' => config('env.txodds_betaid2')];
|
||||
|
||||
foreach ($kontos as $authentication) {
|
||||
// code...
|
||||
|
||||
if ($today) {
|
||||
Nuh::$options['days_from'] = 0;
|
||||
if (now()->between(today(), today()->addHour())) {
|
||||
Nuh::$options['days_to'] = 2;
|
||||
} else {
|
||||
Nuh::$options['days_to'] = 1;
|
||||
}
|
||||
} elseif ($week) {
|
||||
Nuh::$options['days_from'] = 0;
|
||||
Nuh::$options['days_to'] = 6;
|
||||
}
|
||||
|
||||
for ($i = Nuh::$options['days_from']; $i < Nuh::$options['days_to']; $i++) {
|
||||
|
||||
$url = "https://xml2.txodds.com/feed/result/xml.php?$authentication&days=$i,1";
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$sport_id = (int) $row->group['spid'];
|
||||
|
||||
if (in_array($sport_id, $sports)) {
|
||||
|
||||
$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'],
|
||||
];
|
||||
|
||||
DB::transaction(function () use ($event, $row) {
|
||||
Event::updateOrCreate(['id' => (int) $row['id']], $event);
|
||||
|
||||
}, 5);
|
||||
|
||||
$group = [
|
||||
'competition_group_id' => (string) $row->group['cgid'],
|
||||
'sport_id' => (int) $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
'name' => (string) $row->group['cname'],
|
||||
'fullname' => (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,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element);
|
||||
|
||||
$element_group = [
|
||||
'competition_group_id' => (int) $row->group['cgid'],
|
||||
];
|
||||
ElementGroup::updateOrCreate(['element_id' => (int) $row->hteam['id'], 'group_id' => (int) $row->group['id']], $element_group);
|
||||
|
||||
$element = [
|
||||
'name' => (string) $row->ateam,
|
||||
'sport_id' => (int) $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
|
||||
|
||||
$element_group = [
|
||||
'competition_group_id' => (int) $row->group['cgid'],
|
||||
];
|
||||
ElementGroup::updateOrCreate(['element_id' => (int) $row->ateam['id'], 'group_id' => (int) $row->group['id']], $element_group);
|
||||
|
||||
if ($sport_id == 1) {
|
||||
$total_soccer++;
|
||||
} else {
|
||||
$total_others++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(now()->toDateString()." - $count events processed", 'g');
|
||||
}
|
||||
}
|
||||
if ($debug) {
|
||||
Notice::note("Total Soccer - $total_soccer\nTotal Others - $total_others", 'g');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\Group;
|
||||
use App\Models\MajorGroup;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Groups
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$kontos = ['soccer' => config('env.txodds_betaid1'), 'other' => config('env.txodds_betaid2')];
|
||||
|
||||
$sport_map = Sport::getActiveSports();
|
||||
|
||||
Group::whereNotIn('sport_id', $sport_map)->delete();
|
||||
|
||||
$years = [date('y'), date('y') + 1];
|
||||
|
||||
foreach ($kontos as $konto => $authentication) {
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/groups.php?' . $authentication . '&sid=' . implode(',', $years);
|
||||
|
||||
// https://xml2.txodds.com/feed/groups.php?ident=betaid1&passwd=Dy59vpRC&sid=25
|
||||
|
||||
// <group>
|
||||
// <id>181996</id>
|
||||
// <mgroup id="1002">FBARG</mgroup>
|
||||
// <name>Supercopa Entre Rios</name>
|
||||
// <sid>26</sid>
|
||||
// <fullname>FBARG Supercopa Entre Rios-26</fullname>
|
||||
// <date1>2025-12-13 00:00:00</date1>
|
||||
// <date2>2026-04-30 00:00:00</date2>
|
||||
// </group>
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
$count = 0;
|
||||
foreach ($data as $row) {
|
||||
|
||||
$mgroup = $row->mgroup;
|
||||
|
||||
$sport_id = MajorGroup::where('name', $mgroup)->value('sport_id');
|
||||
|
||||
if (in_array($sport_id, $sport_map)) {
|
||||
|
||||
Group::updateOrCreate(
|
||||
['id' => (int) $row->id],
|
||||
[
|
||||
'name' => (string) $row->name,
|
||||
'fullname' => (string) $row->fullname,
|
||||
'mgroup' => (string) $row->mgroup,
|
||||
'sid' => (int) $row->sid,
|
||||
'sport_id' => (int) $sport_id,
|
||||
'date1' => (string) $row->date1,
|
||||
'date2' => (string) $row->date2,
|
||||
]
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
Notice::note("$count groups $konto processed", 'g');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\MajorGroup;
|
||||
use App\Models\Sport;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class MajorGroups
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$sports = Sport::getActiveSports();
|
||||
|
||||
foreach ($sports as $name => $sport_id) {
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/mgroups.php?spid='.$sport_id.'&active=1';
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
$count = 0;
|
||||
foreach ($data as $row) {
|
||||
|
||||
MajorGroup::updateOrCreate(
|
||||
['id' => (int) $row->id],
|
||||
[
|
||||
'name' => (string) $row->name,
|
||||
'sport_id' => $sport_id,
|
||||
'country_id' => $row->countryid,
|
||||
]
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
|
||||
Notice::note("$count major groups $name processed", 'g');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,429 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_2Way;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_2WayS1;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_3Way;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_3WayHt;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_Dc;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_Dnb;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_Ggng;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_Points;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_PointsHt;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_PointsQ1;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_Totals;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_TotalsHt;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_TotalsQ1;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Odds_Tq;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\Element;
|
||||
use App\Models\ElementGroup;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Models\Group;
|
||||
use App\Models\Supervisor;
|
||||
use App\Models\TxoddsMarket;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('TXODD ODD sport: '.Nuh::$options['sport_id'], 'b');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*/
|
||||
// $info = Event::where('starttime', '<', Carbon::now()->subMinutes(10))->delete();
|
||||
// if ($debug) {
|
||||
// Notice::note("Deleted: $info");
|
||||
// }
|
||||
|
||||
switch (Nuh::$options['sport_id']) {
|
||||
case 1:
|
||||
$res = TxoddsMarket::where('soccer', 1)->pluck('market_id', 'id')->toArray();
|
||||
break;
|
||||
case 2:
|
||||
$res = TxoddsMarket::where('ice_hockey', 1)->pluck('market_id', 'id')->toArray();
|
||||
break;
|
||||
case 3:
|
||||
$res = TxoddsMarket::where('basketball', 1)->pluck('market_id', 'id')->toArray();
|
||||
break;
|
||||
case 5:
|
||||
$res = TxoddsMarket::where('tennis', 1)->pluck('market_id', 'id')->toArray();
|
||||
break;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* markets
|
||||
*************************************************/
|
||||
$markets = '&ot='.implode(',', $res);
|
||||
|
||||
/*************************************************
|
||||
* URL
|
||||
* https://xml2.txodds.com/feed/odds/xml.php?36152-aeTRNnZxSPUwGe&all_odds=2&peid=14190947
|
||||
*************************************************/
|
||||
if (Nuh::$options['sport_id'] == 1) {
|
||||
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.config('env.txodds_betaid1').'&all_odds=2';
|
||||
} else {
|
||||
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.config('env.txodds_betaid2').'&all_odds=2';
|
||||
}
|
||||
|
||||
$_calls = [];
|
||||
|
||||
$sport = '&spid='.Nuh::$options['sport_id'];
|
||||
|
||||
if (Nuh::$options['provider_id'] == 8) {
|
||||
|
||||
/*************************************************
|
||||
* TXODDS MARKET LASTCALL
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('TXOdds MARKET Lastcall', 'p');
|
||||
}
|
||||
|
||||
$market = '&ot='.Nuh::$options['txodds_market_id'];
|
||||
|
||||
$lastcall = Nuh::$options['lastcall'] > time() - 600 ? '&last='.Nuh::$options['lastcall'] : '&last='.time() - 600;
|
||||
|
||||
$_calls[] = $url.$sport.$market.$lastcall;
|
||||
|
||||
} elseif (Nuh::$options['id']) {
|
||||
|
||||
/*************************************************
|
||||
* BY ID
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("BY ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
|
||||
$id = '&peid='.Nuh::$options['id'];
|
||||
|
||||
$_calls[] = $url.$markets.$id;
|
||||
|
||||
} elseif (Nuh::$options['gid']) {
|
||||
|
||||
/*************************************************
|
||||
* BY GROUP ID
|
||||
*************************************************/
|
||||
if ($debug) {
|
||||
Notice::note("GROUP_ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
|
||||
$from_to = '&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to'];
|
||||
|
||||
$events = Event::where('starttime', '>', Carbon::now())->where('group_id', Nuh::$options['gid'])->pluck('id');
|
||||
|
||||
foreach ($events as $event_id) {
|
||||
$_calls[] = $url.$markets.$from_to.'&peid='.$event_id;
|
||||
}
|
||||
} elseif (Nuh::$options['g']) {
|
||||
|
||||
/*************************************************
|
||||
* ALL BY GROUP ID for last changes
|
||||
*************************************************/
|
||||
if ($debug) {
|
||||
Notice::note("GROUP_ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
|
||||
$from_to = '&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to'];
|
||||
|
||||
$groupids = Event::where('starttime', '>', Carbon::now())->groupBy('group_id')->pluck('group_id');
|
||||
|
||||
foreach ($groupids as $groupid) {
|
||||
$_calls[] = $url.$markets.$from_to.'&pgid='.$groupid;
|
||||
}
|
||||
|
||||
} elseif (Nuh::$options['t']) {
|
||||
|
||||
/*************************************************
|
||||
* TODAY by ID
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("TODAY \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>=', Carbon::now())->where('starttime', '<', Carbon::now()->addDays(1))->pluck('id');
|
||||
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url.$sport.$markets.'&peid='.$id;
|
||||
}
|
||||
|
||||
} elseif (Nuh::$options['w']) {
|
||||
|
||||
/*************************************************
|
||||
* ONE WEEK FROM NOW
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("ONE WEEK FROM NOW \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>=', Carbon::now())->where('starttime', '<', Carbon::now()->addDays(7))->pluck('id');
|
||||
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url.$sport.$markets.'&peid='.$id;
|
||||
}
|
||||
|
||||
} elseif (Nuh::$options['a']) {
|
||||
|
||||
/*************************************************
|
||||
* ALL BY ID (reload)
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("ALL \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>=', Carbon::now())->pluck('id');
|
||||
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url.$sport.$markets.'&peid='.$id;
|
||||
}
|
||||
} else {
|
||||
Notice::note('BASH PARAMETER MISSING [--t, --w, --g, --a, --id=]', 'r', 1);
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* CALL
|
||||
*************************************************/
|
||||
$counter = 0;
|
||||
foreach ($_calls as $url) {
|
||||
|
||||
$counter++;
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
if (Nuh::$options['provider_id'] == 8) {
|
||||
Supervisor::where('id', Nuh::$options['supervisor_id'])->update(['lastcall' => (int) $data['timestamp']]);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('counter: '.count($_calls).'/'.$counter, 'g');
|
||||
}
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$event_id = (int) $row['id'];
|
||||
$sport_id = (int) $row->group['spid'];
|
||||
|
||||
$event = [
|
||||
'has_markets' => 1,
|
||||
'provider_id' => (int) Nuh::$options['provider_id'],
|
||||
'starttime' => Carbon::parse($row->time)->toDateTimeString(),
|
||||
'sport_id' => $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'],
|
||||
];
|
||||
|
||||
$res = DB::transaction(function () use ($row, $event) {
|
||||
return Event::updateOrCreate(['id' => (int) $row['id']], $event);
|
||||
}, 5);
|
||||
$event_id = $res->id;
|
||||
|
||||
$group = [
|
||||
'competition_group_id' => (string) $row->group['cgid'],
|
||||
'sport_id' => $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
'name' => (string) $row->group['cname'],
|
||||
'fullname' => (string) $row->group,
|
||||
];
|
||||
|
||||
Group::updateOrCreate(['id' => (int) $row->group['id']], $group);
|
||||
|
||||
$compgroup = [
|
||||
'sport_id' => $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' => $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->hteam['id']], $element);
|
||||
|
||||
$element_group = [
|
||||
'competition_group_id' => (int) $row->group['cgid'],
|
||||
];
|
||||
ElementGroup::updateOrCreate(['element_id' => (int) $row->hteam['id'], 'group_id' => (int) $row->group['id']], $element_group);
|
||||
|
||||
$element = [
|
||||
'name' => (string) $row->ateam,
|
||||
'sport_id' => $sport_id,
|
||||
'country_id' => (int) $row->group['cnid'],
|
||||
];
|
||||
Element::updateOrCreate(['id' => (int) $row->ateam['id']], $element);
|
||||
|
||||
$element_group = [
|
||||
'competition_group_id' => (int) $row->group['cgid'],
|
||||
];
|
||||
ElementGroup::updateOrCreate(['element_id' => (int) $row->ateam['id'], 'group_id' => (int) $row->group['id']], $element_group);
|
||||
|
||||
if ($event_id && Event::where('id', $event_id)->exists()) {
|
||||
// inconsistency with CONSTRAINT when getting only market updates
|
||||
|
||||
foreach ($row->bookmaker as $book) {
|
||||
|
||||
ActiveSpread::start();
|
||||
|
||||
$bookmaker_id = (int) $book['bid'];
|
||||
|
||||
$odds = [];
|
||||
$odds['event_id'] = $event_id;
|
||||
$odds['bookmaker_id'] = $bookmaker_id;
|
||||
$odds['sport_id'] = $sport_id;
|
||||
$odds['provider_id'] = Nuh::$options['provider_id'];
|
||||
$odds['flags'] = 1;
|
||||
|
||||
foreach ($book->offer as $offer) {
|
||||
|
||||
$bettypeid = 0;
|
||||
|
||||
foreach ($offer->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
case 'id':
|
||||
$odds['offer_id'] = (int) $attributeValue;
|
||||
break;
|
||||
case 'ot':
|
||||
$bettypeid = (int) $attributeValue;
|
||||
break;
|
||||
case 'bmoid':
|
||||
$odds['bmoid'] = (string) $attributeValue;
|
||||
break;
|
||||
case 'flags':
|
||||
$odds['flags'] = (string) $attributeValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch ($bettypeid) {
|
||||
case 0:
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
case 'starting_time':
|
||||
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event_id,
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => Carbon::parse($attributeValue)->toDateTimeString()]);
|
||||
|
||||
}, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Odds_3Way::grap($odds, $offer);
|
||||
break;
|
||||
case 1:
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
case 'starting_time':
|
||||
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event_id,
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => Carbon::parse($attributeValue)->toDateTimeString()]);
|
||||
|
||||
}, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Odds_2Way::grap($odds, $offer);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
switch ($attributeName) {
|
||||
case 'starting_time':
|
||||
DB::transaction(function () use ($odds, $sport_id, $event_id, $bookmaker_id, $attributeValue) {
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => $event_id,
|
||||
'sport_id' => $sport_id,
|
||||
'bookmaker_id' => $bookmaker_id,
|
||||
], ['in_feed' => 1, 'bmoid' => $odds['bmoid'], 'starttime' => Carbon::parse($attributeValue)->toDateTimeString()]);
|
||||
|
||||
}, 5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Odds_Points::grap($odds, $offer);
|
||||
break;
|
||||
case 4:
|
||||
Odds_Totals::grap($odds, $offer);
|
||||
break;
|
||||
|
||||
case 131073:
|
||||
Odds_2WayS1::grap($odds, $offer);
|
||||
break;
|
||||
|
||||
case 65536:
|
||||
Odds_3WayHt::grap($odds, $offer);
|
||||
break;
|
||||
case 65540:
|
||||
Odds_TotalsHt::grap($odds, $offer);
|
||||
break;
|
||||
case 65539:
|
||||
Odds_PointsHt::grap($odds, $offer);
|
||||
break;
|
||||
|
||||
case 131075:
|
||||
Odds_PointsQ1::grap($odds, $offer);
|
||||
break;
|
||||
case 131076:
|
||||
Odds_TotalsQ1::grap($odds, $offer);
|
||||
break;
|
||||
|
||||
case 5242880:
|
||||
Odds_Dc::grap($odds, $offer);
|
||||
break;
|
||||
case 6291457:
|
||||
Odds_Dnb::grap($odds, $offer);
|
||||
break;
|
||||
case 11534337:
|
||||
Odds_Ggng::grap($odds, $offer);
|
||||
break;
|
||||
case 7340033:
|
||||
Odds_Tq::grap($odds, $offer);
|
||||
break;
|
||||
|
||||
default:
|
||||
Notice::note('switch bettype ID not found: '.$bettypeid, 'r');
|
||||
break;
|
||||
}
|
||||
}
|
||||
ActiveSpread::set($event_id, $bookmaker_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DONE - EVENTS: '.$counter, 'g');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2way;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_2Way
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['h2w'] = (float) $value->o1;
|
||||
$odds['a2w'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
|
||||
|
||||
$res = Odds2way::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2way::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->h2w = $odds['h2w'];
|
||||
$res->a2w = $odds['a2w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2wayS1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_2WayS1
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['h2w'] = (float) $value->o1;
|
||||
$odds['a2w'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['h2w'], $odds['a2w']], 1);
|
||||
|
||||
$res = Odds2wayS1::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds2wayS1::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->h2w = $odds['h2w'];
|
||||
$res->a2w = $odds['a2w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_3Way
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['h3w'] = (float) $value->o1;
|
||||
$odds['d3w'] = (float) $value->o2;
|
||||
$odds['a3w'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
|
||||
|
||||
$res = Odds3way::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->a3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3wayHt;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_3WayHt
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['h3w'] = (float) $value->o1;
|
||||
$odds['d3w'] = (float) $value->o2;
|
||||
$odds['a3w'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
|
||||
|
||||
$res = Odds3wayHt::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3wayHt::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->a3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsDc;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_Dc
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['dc1x'] = (float) $value->o1;
|
||||
$odds['dc12'] = (float) $value->o2;
|
||||
$odds['dcx2'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['dc1x'], $odds['dc12'], $odds['dcx2']], 1);
|
||||
|
||||
$res = OddsDc::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDc::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->dc1x = $odds['dc1x'];
|
||||
$res->dc12 = $odds['dc12'];
|
||||
$res->dcx2 = $odds['dcx2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsDnb;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_Dnb
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['dnb1'] = (float) $value->o1;
|
||||
$odds['dnb2'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['dnb1'], $odds['dnb2']], 1);
|
||||
|
||||
$res = OddsDnb::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsDnb::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->dnb1 = $odds['dnb1'];
|
||||
$res->dnb2 = $odds['dnb2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsGgng;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_Ggng
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['gg'] = (float) $value->o1;
|
||||
$odds['ng'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['gg'], $odds['ng']], 1);
|
||||
|
||||
$res = OddsGgng::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsGgng::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->gg = $odds['gg'];
|
||||
$res->ng = $odds['ng'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsPoint;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_Points
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['home'] = (float) $value->o1;
|
||||
$odds['away'] = (float) $value->o2;
|
||||
$odds['handicap'] = (float) $value->o3;
|
||||
}
|
||||
|
||||
if (fmod((float) $odds['handicap'], 1) != 0.5) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($odds['home'] >= 1 && $odds['away'] >= 1) {
|
||||
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
|
||||
|
||||
$res = OddsPoint::where('event_id', $odds['event_id'])
|
||||
->where('bookmaker_id', $odds['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPoint::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->home = $odds['home'];
|
||||
$res->away = $odds['away'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_points');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsPointHt;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_PointsHt
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['home'] = (float) $value->o1;
|
||||
$odds['away'] = (float) $value->o2;
|
||||
$odds['handicap'] = (float) $value->o3;
|
||||
}
|
||||
|
||||
if (fmod((float) $odds['handicap'], 1) != 0.5) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($odds['home'] >= 1 && $odds['away'] >= 1) {
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
|
||||
|
||||
$res = OddsPointHt::where('event_id', $odds['event_id'])
|
||||
->where('bookmaker_id', $odds['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPointHt::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->home = $odds['home'];
|
||||
$res->away = $odds['away'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_points_ht');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsPointQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_PointsQ1
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['home'] = (float) $value->o1;
|
||||
$odds['away'] = (float) $value->o2;
|
||||
$odds['handicap'] = (float) $value->o3;
|
||||
}
|
||||
|
||||
if (fmod((float) $odds['handicap'], 1) != 0.5) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($odds['home'] >= 1 && $odds['away'] >= 1) {
|
||||
$odds['difference'] = abs(1 / $odds['home'] - 1 / $odds['away']);
|
||||
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['home'], $odds['away']], 1);
|
||||
|
||||
$res = OddsPointQ1::where('event_id', $odds['event_id'])
|
||||
->where('bookmaker_id', $odds['bookmaker_id'])
|
||||
->where('handicap', $odds['handicap'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsPointQ1::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->home = $odds['home'];
|
||||
$res->away = $odds['away'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_points_q1');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_Totals
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['over'] = (float) $value->o1;
|
||||
$odds['under'] = (float) $value->o2;
|
||||
$odds['total'] = (float) $value->o3;
|
||||
}
|
||||
|
||||
if ($odds['sport_id'] == 1) {
|
||||
if ((float) $odds['total'] != 2.5) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (fmod((float) $odds['total'], 1) != 0.5) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($odds['over'] >= 1 && $odds['under'] >= 1) {
|
||||
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
|
||||
|
||||
$res = OddsTotal::where('event_id', $odds['event_id'])
|
||||
->where('bookmaker_id', $odds['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotal::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->over = $odds['over'];
|
||||
$res->under = $odds['under'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_totals');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTotalHt;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_TotalsHt
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['over'] = (float) $value->o1;
|
||||
$odds['under'] = (float) $value->o2;
|
||||
$odds['total'] = (float) $value->o3;
|
||||
}
|
||||
|
||||
if ($odds['sport_id'] == 1) {
|
||||
if ((float) $odds['total'] != 2.5) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (fmod((float) $odds['total'], 1) != 0.5) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($odds['over'] >= 1 && $odds['under'] >= 1) {
|
||||
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
|
||||
|
||||
$res = OddsTotalHt::where('event_id', $odds['event_id'])
|
||||
->where('bookmaker_id', $odds['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotalHt::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->over = $odds['over'];
|
||||
$res->under = $odds['under'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_totals_ht');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTotalQ1;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_TotalsQ1
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['over'] = (float) $value->o1;
|
||||
$odds['under'] = (float) $value->o2;
|
||||
$odds['total'] = (float) $value->o3;
|
||||
}
|
||||
|
||||
if ($odds['sport_id'] == 1) {
|
||||
if ((float) $odds['total'] != 2.5) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (fmod((float) $odds['total'], 1) != 0.5) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($odds['over'] >= 1 && $odds['under'] >= 1) {
|
||||
|
||||
$odds['difference'] = abs(1 / $odds['over'] - 1 / $odds['under']);
|
||||
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['over'], $odds['under']], 1);
|
||||
|
||||
$res = OddsTotalQ1::where('event_id', $odds['event_id'])
|
||||
->where('bookmaker_id', $odds['bookmaker_id'])
|
||||
->where('total', $odds['total'])
|
||||
->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTotalQ1::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->over = $odds['over'];
|
||||
$res->under = $odds['under'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_totals_q1');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTq;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_Tq
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['htq'] = (float) $value->o1;
|
||||
$odds['atq'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['htq'], $odds['atq']], 1);
|
||||
|
||||
$res = OddsTq::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
OddsTq::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
$res->htq = $odds['htq'];
|
||||
$res->atq = $odds['atq'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds\Tools;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ActiveSpread
|
||||
{
|
||||
public static $collector = [];
|
||||
|
||||
public static function start()
|
||||
{
|
||||
self::$collector = [];
|
||||
}
|
||||
|
||||
public static function collect($odds, $table)
|
||||
{
|
||||
|
||||
if (! isset(self::$collector[$table])) {
|
||||
self::$collector[$table]['difference'] = $odds['difference'];
|
||||
if (isset($odds['handicap'])) {
|
||||
self::$collector[$table]['active_spread'] = $odds['handicap'];
|
||||
} else {
|
||||
self::$collector[$table]['active_spread'] = $odds['total'];
|
||||
}
|
||||
} elseif ($odds['difference'] < self::$collector[$table]['difference']) {
|
||||
self::$collector[$table]['difference'] = $odds['difference'];
|
||||
if (isset($odds['handicap'])) {
|
||||
self::$collector[$table]['active_spread'] = $odds['handicap'];
|
||||
} else {
|
||||
self::$collector[$table]['active_spread'] = $odds['total'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function set($event_id, $bookmaker_id)
|
||||
{
|
||||
foreach (self::$collector as $table => $value) {
|
||||
|
||||
DB::transaction(function () use ($table, $event_id, $bookmaker_id) {
|
||||
DB::table($table)->where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->update(['active_spread' => 0]);
|
||||
|
||||
}, 5);
|
||||
|
||||
if (in_array($table, ['odds_points', 'odds_points_ht', 'odds_points_q1'])) {
|
||||
|
||||
DB::transaction(function () use ($table, $event_id, $bookmaker_id, $value) {
|
||||
DB::table($table)
|
||||
->where('event_id', $event_id)
|
||||
->where('bookmaker_id', $bookmaker_id)
|
||||
->where('handicap', (float) $value['active_spread'])
|
||||
->update(['active_spread' => 1]);
|
||||
}, 5);
|
||||
|
||||
} else {
|
||||
|
||||
DB::transaction(function () use ($table, $event_id, $bookmaker_id, $value) {
|
||||
DB::table($table)
|
||||
->where('event_id', $event_id)
|
||||
->where('bookmaker_id', $bookmaker_id)
|
||||
->where('total', (float) $value['active_spread'])
|
||||
->update(['active_spread' => 1]);
|
||||
}, 5);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*************************************************
|
||||
* https://xml2.txodds.com/feed/odds_types.php
|
||||
|
||||
* BETTYPE IDS
|
||||
0 3-WAY
|
||||
1 2-WAY
|
||||
3 POINTS
|
||||
4 TOTALS
|
||||
|
||||
131073 MONEY LINE - Q1
|
||||
|
||||
65536 3-WAY HALF TIME
|
||||
65540 TOTALS HALF TIME
|
||||
65539 POINTS HALF TIME
|
||||
|
||||
131075 POINTS QUARTER TIME
|
||||
131076 TOTALS QUARTER TIME
|
||||
|
||||
5242880 DOUBLE CHANCE
|
||||
6291457 DRAW NO BET
|
||||
11534337 GG/NG (both teams to score)
|
||||
7340033 TO PROGRESS (to qualify)
|
||||
|
||||
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
|
||||
|
||||
*************************************************/
|
||||
|
||||
switch (Nuh::$options['sport_id']) {
|
||||
case 1:
|
||||
/**
|
||||
* 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:
|
||||
/**
|
||||
* 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:
|
||||
/**
|
||||
* 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:
|
||||
/**
|
||||
* 1 2-WAY
|
||||
* 131073 MONEY LINE - Q1
|
||||
* 3 POINTS
|
||||
* 4 TOTALS
|
||||
*/
|
||||
$markets = '1,3,4,131073';
|
||||
break;
|
||||
default:
|
||||
Notice::note('sport not defined', 'r', 1);
|
||||
break;
|
||||
}
|
||||
Reference in new issue
Block a user