wip grapper

This commit is contained in:
salam committed 2025-12-06 10:18:04 +01:00
1 parent 90bba45c0a
commit ce46e5d107
34 files changed
+565 -2729

No files matched your search

@@ -2,31 +2,48 @@
namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\NuhBash;
use App\Models\Odds3way;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
class _3Way
{
public static function grap($bkmid, $offer)
public static function grap($odds, $offer)
{
echo $bkmid;
dd($offer);
// Odds3way::updateOrCreate(
// [
// 'event_id' => $event->id,
// 'bookmaker_id' => $bkmid,
// 'sport_id' => NuhBash::$options['sport_id'],
// ],
// [
// 'h3w' => (float) $od['o1'],
// 'd3w' => (float) $od['o2'],
// 'a3w' => (float) $od['o3'],
// 'margin' => (float) Helper::margin([$od['o1'], $od['o2'], $od['o3']], 1),
// 'flag' => 1,
// 'nuh_check' => 0,
// 'source_updated_at' => $od['@attributes']['time'],
// 'last_check_at' => Carbon::now()->toDateTimeString(),
// ]
// );
$debug = NuhBash::$options['d'] ?? 0;
if ($debug) {
Notice::note('Odds 3 Way', 'b');
}
$update_array = [];
foreach ($offer as $value) {
$update_array['h3w'] = (float) $value->o1;
$update_array['d3w'] = (float) $value->o2;
$update_array['a3w'] = (float) $value->o3;
$update_array['margin'] = (float) Margin::calculate($update_array, 1);
$bkm_starttime = (string) $value['starting_time'];
}
NuhBash::$_event_bookmaker[] =
[
'bmoid' => $odds['bmoid'],
'starttime' => $bkm_starttime,
];
$update_array['bmoid'] = $odds['bmoid'];
$update_array['offer_id'] = $odds['offer_id'];
$update_array['flag'] = 1;
$update_array['nuh_check'] = 0;
$update_array['last_check_at'] = Carbon::now()->toDateTimeString();
$update_array['source_updated_at'] = $odds['source_updated_at'];
Odds3way::updateOrCreate([
'event_id' => NuhBash::$_event->id,
'bookmaker_id' => $odds['bookmaker_id'],
], $update_array);
}
}