grapper betsapi
This commit is contained in:
1 parent
406fd26864
commit
a3c9f16550
127 files changed
+158128
-650
No files matched your search
@@ -0,0 +1,49 @@
|
||||
<?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\Odds3way;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Willhill
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
/**
|
||||
* williamhill
|
||||
*/
|
||||
$bookmaker_id = 42;
|
||||
|
||||
$res = Odds3way::join('events', 'odds_3ways.event_id', 'events.id')
|
||||
->where('odds_3ways.bookmaker_id', $bookmaker_id)
|
||||
->where('events.betsapi_id', 0)
|
||||
->where('odds_3ways.bmoid', '>', 0)->pluck('odds_3ways.event_id', 'odds_3ways.bmoid');
|
||||
|
||||
foreach ($res as $willhill_id => $txodds_id) {
|
||||
|
||||
$url = 'https://api.b365api.com/v1/williamhill/result?token='.config('env.betsapi_token').'&event_id='.$willhill_id;
|
||||
|
||||
$data = Curl::load($url);
|
||||
|
||||
$betsapi_id = $data['results'][0]['id'] ?? 0;
|
||||
|
||||
$bet365_id = $data['results'][0]['bet365_id'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note(["TXdds ID : $txodds_id", "Betsapi ID : $betsapi_id", "Bet365 ID : $bet365_id", "Willhill ID : $willhill_id"], 'b');
|
||||
}
|
||||
|
||||
if ($betsapi_id) {
|
||||
Event::where('id', (int) $txodds_id)->update(['betsapi_id' => $betsapi_id, 'bet365_id' => $bet365_id]);
|
||||
|
||||
Mapper::where('event_id', $betsapi_id)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user