fixtures new wip
This commit is contained in:
1 parent
a1057d55a7
commit
69619802ce
27 files changed
+156
-187
No files matched your search
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class Authentication
|
||||
{
|
||||
public static function authenticate()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$url = Logifuture::$base_url.'/v1/authentication/token';
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH with PROXY'.PHP_EOL.$url, 'p');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_auth.php');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, ['url' => $url, 'password' => config('env.logifuture_token')]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('AUTH direct'.PHP_EOL.$url, 'b');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
|
||||
'username' => 'nuhodds',
|
||||
'password' => config('env.logifuture_token'),
|
||||
]));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'accept: application/json',
|
||||
'content-type: application/json',
|
||||
]);
|
||||
}
|
||||
|
||||
$file = curl_exec($ch);
|
||||
|
||||
$data = json_decode($file, true);
|
||||
|
||||
$header = [];
|
||||
$header[] = 'Authorization: Bearer '.$data['token'];
|
||||
$header[] = 'accept: application/json';
|
||||
$header[] = 'content-type: application/json';
|
||||
|
||||
Logifuture::$auth_header = $header;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class LogifutureData
|
||||
{
|
||||
public static function load($logifuture_sport_id)
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
$url = Logifuture::$base_url.'/v1/matches?sportId='.$logifuture_sport_id;
|
||||
|
||||
if (config('env.app_env') == 'local') {
|
||||
|
||||
/*************************************************
|
||||
* PROXY
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DATA with PROXY'.PHP_EOL.$url, 'p');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://prox1.nuhodds.com/proxy_logi_data.php');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
||||
'url' => $url,
|
||||
'header' => json_encode(Logifuture::$auth_header),
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Proxy-Auth: AIkcoRnipSgMK88WMQhOQQN3LKDrNDCIebNfPnEayJdmDeTigx',
|
||||
]);
|
||||
} else {
|
||||
|
||||
/*************************************************
|
||||
* DIRECT
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('DATA direct'.PHP_EOL.$url, 'b');
|
||||
}
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, Logifuture::$auth_header);
|
||||
}
|
||||
|
||||
$file = curl_exec($ch);
|
||||
|
||||
if (curl_errno($ch)) {
|
||||
echo curl_error($ch);
|
||||
}
|
||||
|
||||
return json_decode($file, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture\Tools;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class MapEvent
|
||||
{
|
||||
public static function filter($sport_id, $match)
|
||||
{
|
||||
|
||||
$event = [];
|
||||
$event['event_id'] = (int) $match['id'];
|
||||
$event['bookmaker_id'] = Nuh::$options['bookmaker_id'];
|
||||
$event['betradar_id'] = (int) preg_replace('"\D"', '', $match['externalId']);
|
||||
$event['sport_id'] = $sport_id;
|
||||
$event['provider_id'] = Nuh::$options['provider_id'];
|
||||
$event['starttime'] = Carbon::parse($match['startDate'])->toDateTimeString();
|
||||
$event['country'] = $match['sportCategory'];
|
||||
$event['group_id'] = (int) $match['tournamentId'];
|
||||
$event['group'] = addslashes($match['tournamentName']);
|
||||
|
||||
$str = str_replace('||', '|', $match['description']);
|
||||
$str = trim(str_replace('|', ' ', $str));
|
||||
if (Nuh::$options['bookmaker_id'] == 36) {
|
||||
$teams = explode(' v ', $str);
|
||||
} else {
|
||||
$teams = explode(' - ', $str);
|
||||
}
|
||||
$event['home'] = addslashes($teams[0]);
|
||||
$event['away'] = addslashes($teams[1]);
|
||||
|
||||
return $event;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\Logifuture;
|
||||
|
||||
class PrinzipalHandicap
|
||||
{
|
||||
public static function filter(&$_spreads, $filter, $data, $oddnames)
|
||||
{
|
||||
$_tmp = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$key = str_replace($filter, '', $key);
|
||||
|
||||
if (strpos($key, '_O') !== false) {
|
||||
$hcap = str_replace('_O', '', $key);
|
||||
$_tmp[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_1H') !== false) {
|
||||
$hcap = str_replace('_1H', '', $key);
|
||||
$_tmp[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_1') !== false) {
|
||||
$hcap = str_replace('_1', '', $key);
|
||||
$_tmp[$hcap]['ele1'] = $value;
|
||||
} elseif (strpos($key, '_U') !== false) {
|
||||
$hcap = str_replace('_U', '', $key);
|
||||
$_tmp[$hcap]['ele2'] = $value;
|
||||
} elseif (strpos($key, '_2H') !== false) {
|
||||
$hcap = str_replace('_2H', '', $key);
|
||||
$_tmp[$hcap]['ele2'] = $value;
|
||||
} elseif (strpos($key, '_2') !== false) {
|
||||
$hcap = str_replace('_2', '', $key);
|
||||
$_tmp[$hcap]['ele2'] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$tmp = 10000;
|
||||
$hcap = false;
|
||||
foreach ($_tmp as $key => $value) {
|
||||
$x = 0;
|
||||
foreach ($value as $k => $v) {
|
||||
if ($x == 0) {
|
||||
$x = $v;
|
||||
} else {
|
||||
$x -= $v;
|
||||
}
|
||||
}
|
||||
$x = abs($x);
|
||||
if ($x < $tmp) {
|
||||
$hcap = $key;
|
||||
$tmp = $x;
|
||||
}
|
||||
}
|
||||
|
||||
if ($hcap) {
|
||||
$_spreads[$oddnames[0]] = $_tmp[$hcap]['ele1'];
|
||||
$_spreads[$oddnames[1]] = $_tmp[$hcap]['ele2'];
|
||||
$_spreads[$oddnames[2]] = $hcap;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user