add txodds markets as a resource
This commit is contained in:
1 parent
e14404ec8b
commit
5fa1d02dbd
26 files changed
+921
-55
No files matched your search
@@ -96,8 +96,6 @@ class Odds
|
||||
|
||||
*************************************************/
|
||||
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
switch (Nuh::$options['sport_id']) {
|
||||
case 1:
|
||||
/**
|
||||
@@ -149,6 +147,13 @@ class Odds
|
||||
break;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* use_lastcall
|
||||
*************************************************/
|
||||
if (Nuh::$options['use_lastcall']) {
|
||||
$lastcall = Nuh::$options['lastcall'] ? '&last='.Nuh::$options['lastcall'] : '';
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* URL
|
||||
*************************************************/
|
||||
@@ -165,26 +170,15 @@ class Odds
|
||||
Notice::note("BY ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* by SINGLE ID
|
||||
* by specific ID
|
||||
*/
|
||||
$_calls[] = $url."&ot=$markets&peid=".Nuh::$options['id'];
|
||||
} elseif (Nuh::$options['a']) {
|
||||
if ($debug) {
|
||||
Notice::note("ALL \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* ALL by ID
|
||||
*/
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} elseif (Nuh::$options['g']) {
|
||||
if ($debug) {
|
||||
Notice::note("GROUP_ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* PER GROUP_ID
|
||||
* per group_id
|
||||
* with from-to
|
||||
*/
|
||||
$groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id');
|
||||
@@ -197,7 +191,7 @@ class Odds
|
||||
}
|
||||
|
||||
/**
|
||||
* TODAY
|
||||
* today
|
||||
*/
|
||||
$from = Carbon::now()->toDateTimeString();
|
||||
$to = Carbon::now()->addDays(1)->toDateTimeString();
|
||||
@@ -211,13 +205,23 @@ class Odds
|
||||
Notice::note("WEEK \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* ONE WEEK
|
||||
* week from now
|
||||
*/
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->where('starttime', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} else {
|
||||
if ($debug) {
|
||||
Notice::note("ALL \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* ALL by ID
|
||||
*/
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('id');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
if ($debug) {
|
||||
Notice::note("LASTCALL \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
@@ -226,7 +230,7 @@ class Odds
|
||||
|
||||
* with from-to days
|
||||
*/
|
||||
$_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&days=".Nuh::$options['days_from'].','.Nuh::$options['days_to'].'&last='.Nuh::$options['lastcall'];
|
||||
$_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&days=".Nuh::$options['days_from'].','.Nuh::$options['days_to'].$lastcall;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Maintenance;
|
||||
|
||||
use App\Console\Commands\Maintenance\Tasks\CallTxoddsMarkets;
|
||||
use App\Console\Commands\Nuh;
|
||||
|
||||
class Services
|
||||
{
|
||||
public static function switch()
|
||||
{
|
||||
switch (Nuh::$options['name']) {
|
||||
case 'Txodds Markets':
|
||||
CallTxoddsMarkets::call();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Maintenance\Tasks;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Console\Commands\Xml;
|
||||
use App\Models\TxoddsMarket;
|
||||
use App\Utilities\Notice;
|
||||
|
||||
class CallTxoddsMarkets
|
||||
{
|
||||
public static function call()
|
||||
{
|
||||
$debug = Nuh::$options['d'] ?? 0;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('TxoddsMarkets', 'b');
|
||||
}
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/odds_types.php';
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
foreach ($data as $row) {
|
||||
|
||||
$market = [
|
||||
'shortname' => $row->sname,
|
||||
'name' => (string) $row->name,
|
||||
];
|
||||
|
||||
TxoddsMarket::updateOrCreate(['market_id' => (int) $row->ot], $market);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ use App\Console\Commands\Grapper\Betsapi;
|
||||
use App\Console\Commands\Grapper\Logifuture;
|
||||
use App\Console\Commands\Grapper\Magloo;
|
||||
use App\Console\Commands\Grapper\TxOdds;
|
||||
use App\Console\Commands\Maintenance\Services;
|
||||
use App\Console\Services\Service;
|
||||
use App\Models\Supervisor;
|
||||
use App\Utilities\Notice;
|
||||
use App\Utilities\Supervisorctl;
|
||||
@@ -24,7 +26,7 @@ class Nuh extends Command
|
||||
|
||||
public static $BETSAPI_TOKEN = '36152-aeTRNnZxSPUwGe';
|
||||
|
||||
protected $signature = 'nuh {process=help} {--id=0} {--f=} {--a} {--p} {--d} {--x} {--t} {--w} {--g} {--r} {--s} {--t} {--q}';
|
||||
protected $signature = 'nuh {process=help} {--id=0} {--f=} {--p} {--d} {--x} {--t} {--w} {--g} {--r} {--s} {--t} {--q}';
|
||||
|
||||
protected $description = 'Nuh';
|
||||
|
||||
@@ -41,11 +43,10 @@ class Nuh extends Command
|
||||
$txt .= '----------------------------------------------'.PHP_EOL;
|
||||
$txt .= 'process [id] (required)'.PHP_EOL;
|
||||
$txt .= '--id=matchid (optional) calling spezific id'.PHP_EOL;
|
||||
$txt .= '--f=name (optional) [bookmaker_sport]'.PHP_EOL;
|
||||
$txt .= '--f=name (optional) [bkms, markets]'.PHP_EOL;
|
||||
$txt .= '----------------------------------------------'.PHP_EOL.PHP_EOL;
|
||||
$txt .= 'Options'.PHP_EOL;
|
||||
$txt .= '----------------------------------------------'.PHP_EOL;
|
||||
$txt .= '--a reload all'.PHP_EOL;
|
||||
$txt .= '--p use proxy'.PHP_EOL;
|
||||
$txt .= '--d debug'.PHP_EOL;
|
||||
$txt .= '--x generate supervisors'.PHP_EOL;
|
||||
@@ -100,6 +101,10 @@ class Nuh extends Command
|
||||
// LOGIFUTUR COLOMBIA
|
||||
Logifuture::switch();
|
||||
break;
|
||||
case 7:
|
||||
// SERVICE
|
||||
Services::switch();
|
||||
break;
|
||||
default:
|
||||
Notice::note('Provider not defined', 'r', 1);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user