133 lines
4.8 KiB
PHP
133 lines
4.8 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Grapper;
|
|
|
|
use App\Console\Commands\Grapper\Logifuture\ActiveEvent;
|
|
use App\Console\Commands\Grapper\Logifuture\Auth;
|
|
use App\Console\Commands\Grapper\Logifuture\BaseUrl;
|
|
use App\Console\Commands\Nuh;
|
|
use App\Models\Sport;
|
|
use App\Utilities\Notice;
|
|
|
|
class Logifuture
|
|
{
|
|
public static function switch()
|
|
{
|
|
$debug = Nuh::$options['d'] ?? 0;
|
|
|
|
$sportmap = Sport::map('logi', 1, [1, 2, 3, 5]);
|
|
|
|
if ($debug) {
|
|
Notice::note(Nuh::$options['provider']['name'].' '.Nuh::$options['sport']['name'], 'g');
|
|
}
|
|
|
|
switch (Nuh::$options['provider_id']) {
|
|
case 5:
|
|
Nuh::$options['bookmaker_id'] = 35;
|
|
break;
|
|
case 6:
|
|
Nuh::$options['bookmaker_id'] = 36;
|
|
break;
|
|
}
|
|
|
|
$data = Auth::exe();
|
|
|
|
foreach ($sportmap as $client_sportid => $sportid) {
|
|
|
|
$post_fields = [
|
|
'url' => BaseUrl::get().'/v1/matches?sportId='.$client_sportid,
|
|
'header' => json_encode(['Authorization: Bearer '.$data['token'], 'accept: application/json', 'content-type: application/json']),
|
|
];
|
|
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, 'https://proxydb1.nuhodds.com/logifuture.php');
|
|
curl_setopt($ch, CURLOPT_HEADER, false);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
|
]);
|
|
|
|
$file = curl_exec($ch);
|
|
$matches = json_decode($file, 1);
|
|
|
|
if (! isset($matches['error'])) {
|
|
|
|
foreach ($matches as $match) {
|
|
|
|
if (strpos($match['sportCategory'], 'Simulated Reality') === false) {
|
|
|
|
$event = ActiveEvent::filter($sportid, $match);
|
|
|
|
dd($event);
|
|
|
|
$_spreads = [];
|
|
switch ($sportid) {
|
|
case 1:
|
|
Soccer::get($event, $match);
|
|
break;
|
|
case 2:
|
|
Icehockey::get($event, $_spreads, $match);
|
|
break;
|
|
case 3:
|
|
Basket::get($event, $_spreads, $match);
|
|
break;
|
|
case 5:
|
|
Tennis::get($event, $_spreads, $match);
|
|
break;
|
|
|
|
default:
|
|
Notice::note('SPORT NOT IMPLEMENTED', 'r', 1);
|
|
break;
|
|
}
|
|
|
|
Parser::$_matches_array = [];
|
|
Parser::$_matches_array[] = $event;
|
|
|
|
$matchid = Parser::processData(1);
|
|
|
|
if ($matchid) {
|
|
|
|
$event['matchid'] = $matchid;
|
|
|
|
if (isset($_spreads['point'])) {
|
|
$tmp = $event + $_spreads['point'];
|
|
DB_Parser::addPointOdds('bai_points', $matchid, $tmp);
|
|
}
|
|
|
|
if (isset($_spreads['point_qt'])) {
|
|
$tmp = $event + $_spreads['point_qt'];
|
|
DB_Parser::addPointOdds('bai_points_qt', $matchid, $tmp);
|
|
}
|
|
|
|
if (isset($_spreads['total'])) {
|
|
$tmp = $event + $_spreads['total'];
|
|
DB_Parser::addTotalOdds('bai_totals', $matchid, $tmp);
|
|
}
|
|
|
|
if (isset($_spreads['total_qt'])) {
|
|
$tmp = $event + $_spreads['total_qt'];
|
|
DB_Parser::addTotalOdds('bai_totals_qt', $matchid, $tmp);
|
|
}
|
|
|
|
if (isset($_spreads['mlset1'])) {
|
|
$tmp = $event + $_spreads['mlset1'];
|
|
DB_Parser::addTotalOdds('bai_2way_set1', $matchid, $tmp);
|
|
}
|
|
|
|
if (Database::$debug) {
|
|
Notice::note($event, 'y');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
Parser::flagStatus($sportid);
|
|
}
|
|
}
|
|
}
|
|
}
|