tx odds grapper wip
This commit is contained in:
1 parent
687e10ca9b
commit
e93b62efdf
15 files changed
+42
-42
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Margin;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds_3Way
|
||||
{
|
||||
public static function grap($odds, $offer)
|
||||
{
|
||||
$block_update = Nuh::$options['b'] ?? 0;
|
||||
|
||||
foreach ($offer as $value) {
|
||||
$odds['h3w'] = (float) $value->o1;
|
||||
$odds['d3w'] = (float) $value->o2;
|
||||
$odds['a3w'] = (float) $value->o3;
|
||||
}
|
||||
$odds['margin'] = (float) Margin::calculate([$odds['h3w'], $odds['d3w'], $odds['a3w']], 1);
|
||||
|
||||
$res = Odds3way::where('event_id', $odds['event_id'])->where('bookmaker_id', $odds['bookmaker_id'])->first();
|
||||
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->d3w = $odds['d3w'];
|
||||
$res->a3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user