txodds supervisor for markets with lastcall
This commit is contained in:
1 parent
61a6971a64
commit
6978f8095c
19 files changed
+369
-215
No files matched your search
@@ -25,6 +25,8 @@ use App\Models\Element;
|
||||
use App\Models\ElementGroup;
|
||||
use App\Models\Event;
|
||||
use App\Models\Group;
|
||||
use App\Models\Supervisor;
|
||||
use App\Models\TxoddsMarket;
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
@@ -49,110 +51,18 @@ class Odds
|
||||
Notice::note("Deleted: $info");
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* https://xml2.txodds.com/feed/odds_types.php
|
||||
|
||||
* BETTYPE IDS
|
||||
0 3-WAY
|
||||
1 2-WAY
|
||||
3 POINTS
|
||||
4 TOTALS
|
||||
|
||||
131073 MONEY LINE - Q1
|
||||
|
||||
65536 3-WAY HALF TIME
|
||||
65540 TOTALS HALF TIME
|
||||
65539 POINTS HALF TIME
|
||||
|
||||
131075 POINTS QUARTER TIME
|
||||
131076 TOTALS QUARTER TIME
|
||||
|
||||
5242880 DOUBLE CHANCE
|
||||
6291457 DRAW NO BET
|
||||
11534337 GG/NG (both teams to score)
|
||||
7340033 TO PROGRESS (to qualify)
|
||||
|
||||
Not used:
|
||||
5 Asian
|
||||
131072 3 WAY QUARTER TIME
|
||||
262148 TOTALS OVER TIME
|
||||
262147 POINTS OVER TIME
|
||||
|
||||
65537 2-WAY HALF TIME
|
||||
327680 3-WAY 2ND HALF
|
||||
327681 2-WAY 2ND HALF
|
||||
327683 POINT 2ND HALF
|
||||
327684 TOTALS 2ND HALF
|
||||
1048577 GOAL / NO GOAL
|
||||
|
||||
2097153 ODD / EVEN
|
||||
4194304 TOTAL GOALS
|
||||
8388608 1X2 EURO HANDCIAP
|
||||
9437188 TOTAL CORNERS
|
||||
9502724 TOTAL CORNERS 1ST HALF
|
||||
20971520 3-WAY CORNERS
|
||||
28311555 HANDICAP SETS
|
||||
28311556 TOTAL SETS
|
||||
|
||||
*************************************************/
|
||||
|
||||
switch (Nuh::$options['sport_id']) {
|
||||
case 1:
|
||||
/**
|
||||
* 0 3-WAY
|
||||
* 4 TOTALS
|
||||
* 65536 3-WAY HALF TIME
|
||||
* 65540 TOTALS HALF TIME
|
||||
* 11534337 GG/NG (both teams to score)
|
||||
* 5242880 DOUBLE CHANCE
|
||||
* 7340033 TO PROGRESS (to qualify)
|
||||
* 6291457 DRAW NO BET
|
||||
*/
|
||||
$markets = '0,4,65536,65540,11534337,5242880,7340033,6291457';
|
||||
break;
|
||||
case 2:
|
||||
/**
|
||||
* 0 3-WAY
|
||||
* 1 2-WAY
|
||||
* 3 POINTS
|
||||
* 4 TOTALS
|
||||
* 131075 POINTS QUARTER TIME
|
||||
* 131076 TOTALS QUARTER TIME
|
||||
*/
|
||||
$markets = '0,1,3,4,131076,131075';
|
||||
break;
|
||||
case 3:
|
||||
/**
|
||||
* 1 2-WAY
|
||||
* 3 POINTS
|
||||
* 4 TOTALS
|
||||
* 65539 POINTS HALF TIME
|
||||
* 65540 TOTALS HALF TIME
|
||||
* 131075 POINTS QUARTER TIME
|
||||
* 131076 TOTALS QUARTER TIME
|
||||
*/
|
||||
$markets = '1,3,4,65539,65540,131075,131076';
|
||||
break;
|
||||
case 5:
|
||||
/**
|
||||
* 1 2-WAY
|
||||
* 131073 MONEY LINE - Q1
|
||||
* 3 POINTS
|
||||
* 4 TOTALS
|
||||
*/
|
||||
$markets = '1,3,4,131073';
|
||||
break;
|
||||
default:
|
||||
Notice::note('sport not defined', 'r', 1);
|
||||
break;
|
||||
}
|
||||
$txodds_markets_columns = [
|
||||
1 => 'soccer',
|
||||
2 => 'ice_hockey',
|
||||
3 => 'basketball',
|
||||
5 => 'tennis',
|
||||
];
|
||||
$res = TxoddsMarket::where($txodds_markets_columns[Nuh::$options['sport_id']], 1)->pluck('market_id', 'id')->toArray();
|
||||
|
||||
/*************************************************
|
||||
* use_lastcall
|
||||
*************************************************/
|
||||
if (Nuh::$options['use_lastcall']) {
|
||||
$lastcall = Nuh::$options['lastcall'] ? '&last='.Nuh::$options['lastcall'] : '';
|
||||
}
|
||||
$markets = '&ot='.implode(',', $res);
|
||||
|
||||
/*************************************************
|
||||
* URL
|
||||
@@ -162,75 +72,113 @@ class Odds
|
||||
} else {
|
||||
$AUTHTOKEN = 'ident=betaid2&passwd=Dy59vpRC';
|
||||
}
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/odds/xml.php?'.$AUTHTOKEN.'&all_odds=2';
|
||||
|
||||
$_calls = [];
|
||||
if (Nuh::$options['id']) {
|
||||
|
||||
$sport = '&spid='.Nuh::$options['sport_id'];
|
||||
|
||||
if (Nuh::$options['provider_id'] == 8) {
|
||||
|
||||
/*************************************************
|
||||
* TXODDS MARKET LASTCALL
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('TXOdds MARKET Lastcall', 'p');
|
||||
}
|
||||
|
||||
$market = '&ot='.Nuh::$options['txodds_market_id'];
|
||||
|
||||
$lastcall = Nuh::$options['lastcall'] > time() - 600 ? '&last='.Nuh::$options['lastcall'] : '&last='.time() - 600;
|
||||
|
||||
$_calls[] = $url.$sport.$market.$lastcall;
|
||||
|
||||
} elseif (Nuh::$options['id']) {
|
||||
|
||||
/*************************************************
|
||||
* BY ID
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("BY ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* by specific ID
|
||||
*/
|
||||
$_calls[] = $url."&ot=$markets&peid=".Nuh::$options['id'];
|
||||
|
||||
$id = '&peid='.Nuh::$options['id'];
|
||||
|
||||
$_calls[] = $url.$markets.$id;
|
||||
|
||||
} elseif (Nuh::$options['g']) {
|
||||
|
||||
/*************************************************
|
||||
* BY GROUP ID
|
||||
*************************************************/
|
||||
if ($debug) {
|
||||
Notice::note("GROUP_ID \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* per group_id
|
||||
* with from-to
|
||||
*/
|
||||
|
||||
$from_to = '&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to'];
|
||||
|
||||
$groupids = Event::where('starttime', '>', Carbon::now()->toDateTimeString())->groupBy('group_id')->pluck('group_id');
|
||||
|
||||
foreach ($groupids as $groupid) {
|
||||
$_calls[] = $url = 'https://xml2.txodds.com/feed/odds/xml.php?'.Nuh::$AUTHTOKEN.'&all_odds=2&ot='.$markets.'&days='.Nuh::$options['days_from'].','.Nuh::$options['days_to'].'&pgid='.$groupid;
|
||||
$_calls[] = $url.$markets.$from_to.'&pgid='.$groupid;
|
||||
}
|
||||
|
||||
} elseif (Nuh::$options['t']) {
|
||||
|
||||
/*************************************************
|
||||
* TODAY by ID
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("TODAY \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
|
||||
/**
|
||||
* today
|
||||
*/
|
||||
$from = Carbon::now()->toDateTimeString();
|
||||
|
||||
$to = Carbon::now()->addDays(1)->toDateTimeString();
|
||||
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>=', $from)->where('starttime', '<', $to)->pluck('id');
|
||||
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&peid=".$id;
|
||||
$_calls[] = $url.$sport.$markets.'&peid='.$id;
|
||||
}
|
||||
|
||||
} elseif (Nuh::$options['w']) {
|
||||
|
||||
/*************************************************
|
||||
* ONE WEEK FROM NOW
|
||||
*************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note("WEEK \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
Notice::note("ONE WEEK FROM NOW \nsport_id: ".Nuh::$options['sport_id'], 'p');
|
||||
}
|
||||
/**
|
||||
* 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;
|
||||
$_calls[] = $url.$sport.$markets.'&peid='.$id;
|
||||
}
|
||||
} else {
|
||||
|
||||
} elseif (Nuh::$options['a']) {
|
||||
|
||||
/*************************************************
|
||||
* ALL BY ID (reload)
|
||||
*************************************************/
|
||||
|
||||
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');
|
||||
}
|
||||
/**
|
||||
* WITH LASTCALL Parameter
|
||||
|
||||
* with from-to days
|
||||
*/
|
||||
$_calls[] = $url.'&spid='.Nuh::$options['sport_id']."&ot=$markets&days=".Nuh::$options['days_from'].','.Nuh::$options['days_to'].$lastcall;
|
||||
$res = Event::where('sport_id', Nuh::$options['sport_id'])->where('starttime', '>', Carbon::now()->toDateTimeString())->pluck('id');
|
||||
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url.$sport.$markets.'&peid='.$id;
|
||||
}
|
||||
} else {
|
||||
Notice::note('BASH PARAMETER MISSING [--t, --w, --g, --a, --id=]', 'r', 1);
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
@@ -243,6 +191,10 @@ class Odds
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
if (Nuh::$options['provider_id'] == 8) {
|
||||
Supervisor::where('id', Nuh::$options['supervisor_id'])->update(['lastcall' => (int) $data['timestamp']]);
|
||||
}
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('counter: '.count($_calls).'/'.$counter, 'g');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user