wip del err
This commit is contained in:
1 parent
812736ca9a
commit
9bcd4432c6
1210 files changed
-220941
No files matched your search
@@ -1,125 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user