wip
This commit is contained in:
1 parent
60379bcab8
commit
5c9745b1da
19 files changed
+167
-105
No files matched your search
@@ -8,7 +8,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\_Dnb;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\_Ggng;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\_Totals;
|
||||
use App\Console\Commands\Grapper\TxOdds\Odds\_Tq;
|
||||
use App\Console\Commands\NuhBash;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\CompetitionGroup;
|
||||
use App\Models\Element;
|
||||
@@ -23,10 +23,10 @@ class Odds
|
||||
public static function grap()
|
||||
{
|
||||
|
||||
$debug = NuhBash::$options['d'] ?? 0;
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('txodd odd sport: '.NuhBash::$options['sport_id'], 'b');
|
||||
Notice::note('txodd odd sport: '.Nuh::$options['sport_id'], 'b');
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
@@ -79,9 +79,10 @@ class Odds
|
||||
|
||||
*************************************************/
|
||||
|
||||
$debug = NuhBash::$options['d'] ?? 0;
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
$echo = Nuh::$options['e'] ?? 0;
|
||||
|
||||
switch (NuhBash::$options['sport_id']) {
|
||||
switch (Nuh::$options['sport_id']) {
|
||||
case 1:
|
||||
$markets = '0,4,11534337,5242880,7340033,6291457';
|
||||
break;
|
||||
@@ -107,22 +108,22 @@ class Odds
|
||||
/*************************************************
|
||||
* URL
|
||||
*************************************************/
|
||||
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.NuhBash::$AUTHTOKEN.'&all_odds=2&spid='.NuhBash::$options['sport_id'];
|
||||
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&spid='.Nuh::$options['sport_id'];
|
||||
$_calls = [];
|
||||
if (NuhBash::$options['event_id']) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".NuhBash::$options['event_id'];
|
||||
} elseif (NuhBash::$options['a']) {
|
||||
if (Nuh::$options['event_id']) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".Nuh::$options['event_id'];
|
||||
} elseif (Nuh::$options['a']) {
|
||||
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('tx_id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} elseif (NuhBash::$options['w']) {
|
||||
} elseif (Nuh::$options['w']) {
|
||||
$res = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('tx_id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} else {
|
||||
$_calls[] = $url.'&last='.NuhBash::$options['lastcall'];
|
||||
$_calls[] = $url.'&last='.Nuh::$options['lastcall'];
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
@@ -132,6 +133,10 @@ class Odds
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
if ($echo) {
|
||||
dd($data);
|
||||
}
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$event = [];
|
||||
@@ -177,19 +182,18 @@ class Odds
|
||||
'sport_id' => $event['sport_id'],
|
||||
]);
|
||||
|
||||
NuhBash::$_event = Event::firstOrCreate($event, ['starttime' => $event['starttime']]);
|
||||
Nuh::$_event = Event::firstOrCreate($event, ['starttime' => $event['starttime']]);
|
||||
|
||||
foreach ($row->bookmaker as $book) {
|
||||
|
||||
NuhBash::$bookmaker_id = (int) $book['bid'];
|
||||
Nuh::$bookmaker_id = (int) $book['bid'];
|
||||
|
||||
NuhBash::$bookmaker_id = (int) $book['bid'];
|
||||
Nuh::$bookmaker_id = (int) $book['bid'];
|
||||
|
||||
$odds = [];
|
||||
$odds['sport_id'] = (int) $event['sport_id'];
|
||||
$odds['provider_id'] = 2;
|
||||
|
||||
NuhBash::$_event_bookmaker = [];
|
||||
Nuh::$_event_bookmaker = [];
|
||||
|
||||
foreach ($book->offer as $offer) {
|
||||
|
||||
@@ -238,15 +242,15 @@ class Odds
|
||||
}
|
||||
}
|
||||
|
||||
foreach (NuhBash::$_event_bookmaker as $value) {
|
||||
foreach (Nuh::$_event_bookmaker as $value) {
|
||||
|
||||
EventBookmaker::updateOrCreate([
|
||||
'event_id' => NuhBash::$_event->id,
|
||||
'bookmaker_id' => NuhBash::$bookmaker_id,
|
||||
'bookmaker_id' => NuhBash::$bookmaker_id,
|
||||
'event_id' => Nuh::$_event->id,
|
||||
'bookmaker_id' => Nuh::$bookmaker_id,
|
||||
'bookmaker_id' => Nuh::$bookmaker_id,
|
||||
], [
|
||||
'bmoid' => $value['bmoid'],
|
||||
'provider_id' => 2,
|
||||
'provider_id' => Nuh::$options['provider_id'],
|
||||
'bkm_starttime' => Carbon::createFromDate($value['starttime'])->toDateTimeString(),
|
||||
'last_check_at' => Carbon::now()->toDateTimeString(),
|
||||
]);
|
||||
@@ -255,7 +259,7 @@ class Odds
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('END '.NuhBash::$_event->id, 'g');
|
||||
Notice::note('END '.Nuh::$_event->id, 'g');
|
||||
Notice::note('END', 'g');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user