wip
This commit is contained in:
1 parent
b004742d47
commit
96334bb1e4
33 files changed
+1650
-2
No files matched your search
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds;
|
||||
|
||||
use App\Console\Commands\Grapper\Grapper;
|
||||
use App\Console\Commands\Grapper\Helper;
|
||||
use App\Models\Event;
|
||||
use App\Models\EventBookmaker;
|
||||
use App\Utilities\Notice;
|
||||
use App\Utilities\Supervisorctl;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Odds
|
||||
{
|
||||
public static function grap()
|
||||
{
|
||||
|
||||
Notice::note('txodd odd sport: '.Grapper::$options['sport_id'], 'b');
|
||||
|
||||
/*************************************************
|
||||
* SINGLE SOCCER
|
||||
* https://xml2.txodds.com/feed/odds/xml.php?ident=betaid1&passwd=Dy59vpRC&peid=3118930
|
||||
|
||||
* SINGLE OTHER
|
||||
*************************************************
|
||||
* https://xml2.txodds.com/feed/odds/xml.php?ident=betaid2&passwd=Dy59vpRC&peid=3118930
|
||||
|
||||
*************************************************
|
||||
* https://xml2.txodds.com/feed/odds_types.php
|
||||
|
||||
* BETTYPE IDS
|
||||
0 3-WAY
|
||||
1 2-WAY
|
||||
3 POINTS
|
||||
4 TOTALS
|
||||
5 Asian
|
||||
65536 3-WAY HALF TIME
|
||||
131072 3 WAY QUARTER TIME
|
||||
65539 POINTS HALF TIME
|
||||
131075 POINTS QUARTER TIME
|
||||
262147 POINTS OVER TIME
|
||||
65540 TOTALS HALF TIME
|
||||
131076 TOTALS QUARTER TIME
|
||||
262148 TOTALS OVER TIME
|
||||
11534337 GG/NG (both teams to score)
|
||||
5242880 DOUBLE CHANCE
|
||||
7340033 TO PROGRESS (to_qualify)
|
||||
|
||||
Not used:
|
||||
|
||||
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
|
||||
6291457 DRAW NO BET
|
||||
8388608 1X2 EURO HANDCIAP
|
||||
9437188 TOTAL CORNERS
|
||||
9502724 TOTAL CORNERS 1ST HALF
|
||||
20971520 3-WAY CORNERS
|
||||
28311555 HANDICAP SETS
|
||||
28311556 TOTAL SETS
|
||||
|
||||
*************************************************/
|
||||
|
||||
$debug = Grapper::$options['d'] ?? 0;
|
||||
|
||||
switch (Grapper::$options['sport_id']) {
|
||||
case 1:
|
||||
$markets = '0,4,11534337,5242880,7340033';
|
||||
break;
|
||||
case 2:
|
||||
// needs check
|
||||
$markets = '0,1,3,4,262148,131072,131076';
|
||||
break;
|
||||
case 3:
|
||||
// needs check
|
||||
$markets = '0,1,3,4,262147,262148,65539,65540,131075,131076';
|
||||
break;
|
||||
case 5:
|
||||
$markets = '1,3,4';
|
||||
break;
|
||||
case 8:
|
||||
$markets = '0,3,4';
|
||||
break;
|
||||
default:
|
||||
Notice::note('sport not defined', 'r', 1);
|
||||
break;
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* URL
|
||||
*************************************************/
|
||||
|
||||
$url = Grapper::$domain.'feed/odds/xml.php?'.Grapper::$auth.'&all_odds=2&spid='.Grapper::$options['sport_id'];
|
||||
$_calls = [];
|
||||
if (Grapper::$options['event_id']) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".Grapper::$options['event_id'];
|
||||
} elseif (Grapper::$options['a']) {
|
||||
$res = Event::where('time', '>', Carbon::now()->toDateTimeString())->pluck('txid');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} elseif (Grapper::$options['w']) {
|
||||
$res = Event::where('time', '>', Carbon::now()->toDateTimeString())->where('time', '<', Carbon::now()->addDays(7)->toDateTimeString())->pluck('txid');
|
||||
foreach ($res as $id) {
|
||||
$_calls[] = $url."&ot=$markets&peid=".$id;
|
||||
}
|
||||
} else {
|
||||
$_calls[] = $url.'&last='.Grapper::$options['lastcall'];
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* CALL
|
||||
*************************************************/
|
||||
foreach ($_calls as $url) {
|
||||
Notice::note($url, 'r');
|
||||
|
||||
$xml = simplexml_load_file($url, null, LIBXML_NOCDATA);
|
||||
|
||||
if (Grapper::$options['p']) {
|
||||
Notice::note($url);
|
||||
foreach ($xml->match as $match) {
|
||||
print_r($match);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
Supervisorctl::set_lastcall($xml['timestamp']);
|
||||
|
||||
foreach ($xml->match as $m) {
|
||||
|
||||
if (Grapper::$options['d']) {
|
||||
Notice::note((int) $m['id'].' : '.$m->hteam.' - '.$m->ateam);
|
||||
}
|
||||
|
||||
$evid = Event::where('txid', (int) $m['id'])->pluck('id')->first();
|
||||
|
||||
if ($evid) {
|
||||
$fixed_array = [];
|
||||
$fixed_array['event_id'] = $evid;
|
||||
|
||||
Event::where('id', $evid)->update(['cnt_bkm_tx' => count($m->bookmaker)]);
|
||||
|
||||
foreach ($m->bookmaker as $bookmaker) {
|
||||
|
||||
$fixed_array['bkid'] = (int) $bookmaker['bid'];
|
||||
|
||||
$value_array = [];
|
||||
|
||||
foreach ($bookmaker->offer as $offer) {
|
||||
switch ($offer['ot']) {
|
||||
case '0':
|
||||
|
||||
$value_array['f3w'] = (int) $offer['flags'] ?? 0;
|
||||
$value_array['boid'] = (string) $offer['bmoid'] ?? 0;
|
||||
$value_array['time'] = Carbon::parse($offer->odds['starting_time'])->toDateTimeString();
|
||||
|
||||
$tmp = [];
|
||||
$tmp['h3w'] = (float) $offer->odds->o1 ?? 1;
|
||||
$tmp['d3w'] = (float) $offer->odds->o2 ?? 1;
|
||||
$tmp['a3w'] = (float) $offer->odds->o3 ?? 1;
|
||||
$tmp['m3w'] = Helper::margin($tmp);
|
||||
$value_array += $tmp;
|
||||
break;
|
||||
|
||||
case '1':
|
||||
|
||||
$value_array['f2w'] = (int) $offer['flags'] ?? 0;
|
||||
$value_array['boid'] = (string) $offer['bmoid'] ?? 0;
|
||||
$value_array['time'] = Carbon::parse($offer->odds['starting_time'])->toDateTimeString();
|
||||
|
||||
$tmp = [];
|
||||
$tmp['h2w'] = (float) $offer->odds->o1 ?? 1;
|
||||
$tmp['a2w'] = (float) $offer->odds->o3 ?? 1;
|
||||
$tmp['m2w'] = Helper::margin($tmp);
|
||||
$value_array += $tmp;
|
||||
break;
|
||||
|
||||
case '4':
|
||||
$hc = (float) $offer->odds->o3;
|
||||
if (Grapper::$options['sport_id'] == 1 && $hc == 2.5) {
|
||||
$tmp = [];
|
||||
$tmp['ov'] = (float) $offer->odds->o1 ?? 1;
|
||||
$tmp['un'] = (float) $offer->odds->o2 ?? 1;
|
||||
$tmp['mto'] = Helper::margin($tmp);
|
||||
$tmp['fto'] = (int) $offer->odd['flags'] ?? 0;
|
||||
$tmp['hc'] = 2.5;
|
||||
$value_array += $tmp;
|
||||
}
|
||||
break;
|
||||
|
||||
case '5242880':
|
||||
// Double Chance (dc1x,dc12,dcx2)
|
||||
$value_array['fdc'] = (int) $offer['flags'] ?? 0;
|
||||
$tmp = [];
|
||||
$tmp['dc1x'] = (float) $offer->odds->o1 ?? 1;
|
||||
$tmp['dc12'] = (float) $offer->odds->o2 ?? 1;
|
||||
$tmp['dcx2'] = (float) $offer->odds->o3 ?? 1;
|
||||
$tmp['mdc'] = Helper::margin($tmp);
|
||||
$value_array += $tmp;
|
||||
break;
|
||||
|
||||
case '11534337':
|
||||
// goal/nogoal (gg,ng)
|
||||
$value_array['fgg'] = (int) $offer['flags'] ?? 0;
|
||||
$tmp = [];
|
||||
$tmp['gg'] = (float) $offer->odds->o1 ?? 1;
|
||||
$tmp['ng'] = (float) $offer->odds->o3 ?? 1;
|
||||
$tmp['mgg'] = Helper::margin($tmp);
|
||||
$value_array += $tmp;
|
||||
break;
|
||||
|
||||
case '7340033':
|
||||
// to qualify (htq,atq)
|
||||
$value_array['ftq'] = (int) $offer['flags'] ?? 0;
|
||||
$tmp = [];
|
||||
$tmp['htq'] = (float) $offer->odds->o1 ?? 1;
|
||||
$tmp['atq'] = (float) $offer->odds->o3 ?? 1;
|
||||
$tmp['mtq'] = Helper::margin($tmp);
|
||||
$value_array += $tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
EventBookmaker::updateOrCreate($fixed_array, $value_array);
|
||||
if (Grapper::$options['d']) {
|
||||
Notice::note($fixed_array + $value_array, 'b');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user