49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Grapper\Betsapi;
|
|
|
|
use App\Console\Commands\Curl;
|
|
use App\Console\Commands\Nuh;
|
|
use App\Models\Event;
|
|
use App\Utilities\Notice;
|
|
|
|
class Betfair
|
|
{
|
|
public static function grap()
|
|
{
|
|
$debug = Nuh::$options['d'] ?? 0;
|
|
|
|
/**
|
|
* Betfair
|
|
*/
|
|
exit;
|
|
$bookmaker_id = 126;
|
|
|
|
$res = Event::where('bet365_id', '>', 0)->pluck('id', 'bet365_id');
|
|
|
|
foreach ($res as $bet365_id => $txodds_id) {
|
|
|
|
/**
|
|
* BETFAIR SP (per page)
|
|
* https://api.b365api.com/v1/bwin/prematch?token=36152-aeTRNnZxSPUwGe
|
|
*/
|
|
$url = 'https://api.b365api.com/v4/bet365/prematch?token='.config('env.betsapi_token').'&FI='.$bet365_id;
|
|
|
|
$data = Curl::load($url);
|
|
|
|
dd($data);
|
|
|
|
$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]);
|
|
}
|
|
}
|
|
}
|
|
}
|