wip
This commit is contained in:
1 parent
b004742d47
commit
96334bb1e4
33 files changed
+1650
-2
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds;
|
||||
|
||||
use App\Console\Commands\Grapper\Grapper;
|
||||
use App\Models\Event;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Events
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
|
||||
Notice::note('txodd fixture sport: '.Grapper::$options['sport_id'], 'b');
|
||||
|
||||
$debug = Grapper::$options['d'] ?? 0;
|
||||
|
||||
$now = Carbon::tomorrow();
|
||||
for ($i = 0; $i < 60; $i++) {
|
||||
|
||||
$from = $now->toDateString();
|
||||
$to = $now->addDays(1)->toDateString();
|
||||
$url = Grapper::$domain.'feed/result/xml.php?'.Grapper::$auth."&date=$from,$to";
|
||||
if ($debug) {
|
||||
Notice::note($url, 'y');
|
||||
}
|
||||
$xml = simplexml_load_file($url, null, LIBXML_NOCDATA);
|
||||
foreach ($xml->match as $_match) {
|
||||
|
||||
Event::updateOrCreate([
|
||||
'txid' => (int) $_match['id'],
|
||||
'spid' => Grapper::$options['sport_id'],
|
||||
'prid' => Grapper::$options['provider_id'],
|
||||
|
||||
'cnid' => (int) $_match->group['cnid'], // country_id
|
||||
'grid' => (int) $_match->group['id'], // group_id
|
||||
'cgid' => (int) $_match->group['cgid'], // competition_group_id
|
||||
|
||||
'hoid' => (int) $_match->hteam['id'],
|
||||
'awid' => (int) $_match->ateam['id'],
|
||||
'home' => (string) $_match->hteam,
|
||||
'away' => (string) $_match->ateam,
|
||||
'liga' => (string) $_match->group['cname'],
|
||||
], [
|
||||
'time' => Carbon::parse($_match->time)->toDateTimeString(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user