FindFixture wip
This commit is contained in:
1 parent
8aaac561f8
commit
bc1ca5bdea
8 files changed
+428
-258
No files matched your search
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Betica
|
||||
{
|
||||
public static function switch()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(Nuh::$options['provider']['name'], '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) {
|
||||
|
||||
print_r($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,
|
||||
];
|
||||
|
||||
dd($event);
|
||||
|
||||
FindFixture::search($event, self::$groups[$sport_id], self::$elements[$sport_id]);
|
||||
}
|
||||
|
||||
// $bmoid = (int) $value['match_id'];
|
||||
|
||||
// $event = [];
|
||||
// $event['status'] = 1;
|
||||
// $event['bkmid'] = PARSER::$_config['bookmaker_id'];
|
||||
// $event['bmoid'] = (int) $bmoid;
|
||||
// $event['sportid'] = 1;
|
||||
// $event['brmatchid'] = (int) $value['parent_match_id'];
|
||||
// $event['starttime'] = strtotime($value['start_time']);
|
||||
// $event['starttime'] -= 10800;
|
||||
// $event['event'] = $value['home_team'].' v '.$value['away_team'];
|
||||
// $event['groupname'] = $value['competition_name'];
|
||||
// $event['groupid'] = $value['competition_id'];
|
||||
// $event['country'] = $value['category'];
|
||||
// $event['home'] = $value['home_team'];
|
||||
// $event['away'] = $value['away_team'];
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Console\Commands\Grapper\Betsapi;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\FindFixture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Mapper\FindFixture;
|
||||
use App\Mapper\LoadElements;
|
||||
use App\Mapper\LoadGroups;
|
||||
use App\Models\Country;
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper;
|
||||
|
||||
use App\Models\CompetitionGroupProvider;
|
||||
use App\Models\ElementProvider;
|
||||
use App\Models\Event;
|
||||
use App\Models\Mapper;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class FindFixture
|
||||
{
|
||||
public static $elements = [];
|
||||
|
||||
public static $groups = [];
|
||||
|
||||
public static function search(&$event)
|
||||
{
|
||||
$match_id = false;
|
||||
|
||||
$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
|
||||
*************************************************/
|
||||
|
||||
dd($event);
|
||||
|
||||
// DEFAULT BETRADAR
|
||||
if ($betradar_id) {
|
||||
$match_id = Event::where('betradar_id', $betradar_id)->value('id');
|
||||
} else {
|
||||
switch ($event['provider_id']) {
|
||||
case 2:
|
||||
// BETSAPI
|
||||
$match_id = Event::where('betsapi_id', '=', $event_id)->value('id');
|
||||
break;
|
||||
case 3:
|
||||
// MAGLOO KENIA
|
||||
$match_id = Event::where('magken_id', $event_id)->value('id');
|
||||
break;
|
||||
case 4:
|
||||
// MAGLOO NIGERIA
|
||||
$match_id = Event::where('magnig_id', $event_id)->value('id');
|
||||
break;
|
||||
case 5:
|
||||
// LOGIFUTUR NIGERA
|
||||
$match_id = Event::where('lognig_id', $event_id)->value('id');
|
||||
break;
|
||||
case 6:
|
||||
// LOGIFUTUR COLOMBIA
|
||||
$match_id = Event::where('logcol_id', $event_id)->value('id');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($match_id) {
|
||||
Mapper::where('event_id', $event_id)->delete();
|
||||
|
||||
$event['id'] = $match_id;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* USE DB
|
||||
*************************************************/
|
||||
|
||||
$home_id = $elements[$event['home_id']] ?? 0;
|
||||
|
||||
$away_id = $elements[$event['away_id']] ?? 0;
|
||||
|
||||
$competition_group_id = $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;
|
||||
$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;
|
||||
$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;
|
||||
$group['name'] = $event['group'];
|
||||
CompetitionGroupProvider::updateOrCreate(['provider_group_id' => (int) $event['group_id']], $group);
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
// event_id
|
||||
switch ($event['provider_id']) {
|
||||
case 3:
|
||||
// MAGLOO KENIA
|
||||
if (! $match->magken_id) {
|
||||
$update_array['magken_id'] = $event_id;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// MAGLOO NIGERIA
|
||||
if (! $match->magnig_id) {
|
||||
$update_array['magnig_id'] = $event_id;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// LOGIFUTUR NIGERA
|
||||
if (! $match->lognig_id) {
|
||||
$update_array['lognig_id'] = $event_id;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
// LOGIFUTUR COLOMBIA
|
||||
if (! $match->logcol_id) {
|
||||
$update_array['logcol_id'] = $event_id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($update_array) {
|
||||
Event::where('id', $match_id)->update($update_array);
|
||||
}
|
||||
|
||||
$startime = $event['starttime'];
|
||||
|
||||
$from = Carbon::createFromDate($startime)->subDay();
|
||||
|
||||
$to = Carbon::createFromDate($startime)->addDay();
|
||||
|
||||
if ($find_by_name) {
|
||||
$home_id = ElementProvider::where(['sport_id' => (int) $event['sport_id']])
|
||||
->where('provider_id', $event['provider_id'])
|
||||
->where('name', $home)
|
||||
->value('element_id');
|
||||
$away_id = ElementProvider::where(['sport_id' => (int) $event['sport_id']])
|
||||
->where('provider_id', $event['provider_id'])
|
||||
->where('name', $away)
|
||||
->value('element_id');
|
||||
$competition_group_id = CompetitionGroupProvider::where(['sport_id' => (int) $event['sport_id']])
|
||||
->where('provider_id', $event['provider_id'])
|
||||
->where('name', $groupname)
|
||||
->value('competition_group_id');
|
||||
}
|
||||
|
||||
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->toDateTimeString())
|
||||
->where('starttime', '<', $to->toDateTimeString())
|
||||
->value('id');
|
||||
|
||||
if ($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);
|
||||
}
|
||||
|
||||
switch ($event['provider_id']) {
|
||||
case 2:
|
||||
// BETSAPI
|
||||
Event::where('id', $match_id)->update(['betsapi_id' => $event_id]);
|
||||
break;
|
||||
case 3:
|
||||
// MAGLOO KENIA
|
||||
Event::where('id', $match_id)->update(['magken_id' => $event_id]);
|
||||
break;
|
||||
case 4:
|
||||
// MAGLOO NIGERIA
|
||||
Event::where('id', $match_id)->update(['magnig_id' => $event_id]);
|
||||
break;
|
||||
case 5:
|
||||
// LOGIFUTUR NIGERA
|
||||
Event::where('id', $match_id)->update(['lognig_id' => $event_id]);
|
||||
break;
|
||||
case 6:
|
||||
// LOGIFUTUR COLOMBIA
|
||||
Event::where('id', $match_id)->update(['logcol_id' => $event_id]);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
Mapper::updateOrCreate(['event_id' => $event_id], $event);
|
||||
}
|
||||
} else {
|
||||
Mapper::updateOrCreate(['event_id' => $event_id], $event);
|
||||
}
|
||||
|
||||
$event['id'] = $match_id;
|
||||
}
|
||||
}
|
||||
@@ -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 Goldbet
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ use App\Console\Commands\Grapper\Logifuture\MapEvent;
|
||||
use App\Console\Commands\Grapper\Logifuture\Soccer;
|
||||
use App\Console\Commands\Grapper\Logifuture\Tennis;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Mapper\FindFixture;
|
||||
use App\Mapper\LoadElements;
|
||||
use App\Mapper\LoadGroups;
|
||||
use App\Models\EventBookmaker;
|
||||
@@ -38,9 +37,9 @@ class Logifuture
|
||||
break;
|
||||
}
|
||||
|
||||
$_elements = LoadElements::load(Nuh::$options['provider_id'], true);
|
||||
FindFixture::$_elements = LoadElements::load(Nuh::$options['provider_id'], true);
|
||||
|
||||
$_groups = LoadGroups::load(Nuh::$options['provider_id'], true);
|
||||
FindFixture::$_groups = LoadGroups::load(Nuh::$options['provider_id'], true);
|
||||
|
||||
$sportmap = Sport::map('logi', 1, [1, 2, 3, 5]);
|
||||
|
||||
@@ -64,7 +63,7 @@ class Logifuture
|
||||
|
||||
$event = MapEvent::filter($sport_id, $match);
|
||||
|
||||
FindFixture::search($event, $_groups[$sport_id], $_elements[$sport_id], true);
|
||||
FindFixture::search($event);
|
||||
|
||||
if ($event['id']) {
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace App\Console\Commands\Grapper\Magloo;
|
||||
|
||||
use App\Console\Commands\Curl;
|
||||
use App\Console\Commands\Grapper\FindFixture;
|
||||
use App\Console\Commands\Grapper\Magloo\Odds\BaseUrl;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Mapper\FindFixture;
|
||||
use App\Mapper\LoadElements;
|
||||
use App\Mapper\LoadGroups;
|
||||
use App\Models\Sport;
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Console\Commands\Grapper\Betica;
|
||||
use App\Console\Commands\Grapper\Betsapi;
|
||||
use App\Console\Commands\Grapper\Goldbet;
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Grapper\Magloo;
|
||||
use App\Console\Commands\Grapper\TxOdds;
|
||||
@@ -77,7 +79,7 @@ class Nuh extends Command
|
||||
|
||||
switch (self::$options['provider_id']) {
|
||||
case 1:
|
||||
case 8:
|
||||
// TXODDS FICTURES AND ODDS
|
||||
TxOdds::switch();
|
||||
break;
|
||||
case 2:
|
||||
@@ -103,6 +105,18 @@ class Nuh extends Command
|
||||
// SERVICE
|
||||
Services::switch();
|
||||
break;
|
||||
case 8:
|
||||
// TXODDS MARKET WITH LAST CALL
|
||||
TxOdds::switch();
|
||||
break;
|
||||
case 9:
|
||||
// BETICA
|
||||
Betica::switch();
|
||||
break;
|
||||
case 10:
|
||||
// GOLDBET
|
||||
Goldbet::switch();
|
||||
break;
|
||||
default:
|
||||
Notice::note('Provider not defined', 'r', 1);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user