This commit is contained in:
salam committed 2026-01-16 12:28:33 +01:00
1 parent 5273f0a3b4
commit 0e21bbe5f0
4 files changed
+123 -37

No files matched your search

+105 -24
View File
@@ -3,7 +3,13 @@
namespace App\Console\Commands\Grapper;
use App\Console\Commands\Curl;
use App\Console\Commands\Grapper\Fixtures\FindFixture;
use App\Console\Commands\Nuh;
use App\Models\Odds3way;
use App\Models\OddsDc;
use App\Models\OddsGgng;
use App\Models\OddsTotal;
use App\Utilities\Margin;
use App\Utilities\Notice;
class Betica
@@ -13,7 +19,7 @@ class Betica
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note(Nuh::$options['provider']['name'], 'g');
Notice::note(Nuh::$options['provider'], 'g');
}
/**
@@ -92,8 +98,6 @@ class Betica
foreach ($data['data'] as $row) {
print_r($row);
if (isset($row['parent_match_id']) && ! $row['is_esport']) {
$event = [
@@ -109,31 +113,108 @@ class Betica
'group_id' => (int) $row['competition_id'] ?? 0,
];
dd($event);
FindFixture::find($event);
FindFixture::search($event, self::$groups[$sport_id], self::$elements[$sport_id]);
if (isset($event['id'])) {
$base = [];
$base['sport_id'] = (int) Nuh::$options['sport_id'];
$base['provider_id'] = Nuh::$options['provider_id'];
$base['bmoid'] = (int) $row['match_id'];
$base['flag'] = 1;
foreach ($row['odds'] as $bettypes) {
switch ($bettypes['sub_type_id']) {
case 1:
// 1x2
$odds = [];
foreach ($bettypes['odds'] as $bettype) {
if ($bettype['outcome_id'] == 1) {
$odds['h3w'] = $bettype['odd_value'];
} elseif ($bettype['outcome_id'] == 2) {
$odds['d3w'] = $bettype['odd_value'];
} elseif ($bettype['outcome_id'] == 3) {
$odds['a3w'] = $bettype['odd_value'];
}
}
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['starttime'] = (string) $row['start_time'];
Odds3way::updateOrCreate([
'event_id' => $event['id'],
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], $base + $odds);
break;
case 10:
// DOUBLE CHANCE
$odds = [];
foreach ($bettypes['odds'] as $bettype) {
if ($bettype['outcome_id'] == 9) {
$odds['dc1x'] = $bettype['odd_value'];
} elseif ($bettype['outcome_id'] == 10) {
$odds['dc12'] = $bettype['odd_value'];
} elseif ($bettype['outcome_id'] == 11) {
$odds['dcx2'] = $bettype['odd_value'];
}
}
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsDc::updateOrCreate([
'event_id' => $event['id'],
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], $base + $odds);
break;
case 18:
// TOTALS
$odds = [];
foreach ($bettypes['odds'] as $bettype) {
if ($bettype['outcome_id'] == 12 && $bettype['odd_key'] == 'over 2.5') {
$odds['over'] = $bettype['odd_value'];
} elseif ($bettype['outcome_id'] == 13 && $bettype['odd_key'] == 'over 2.5') {
$odds['under'] = $bettype['odd_value'];
}
}
$odds['margin'] = (float) Margin::calculate($odds, 1);
$odds['total'] = 2.5;
OddsTotal::updateOrCreate([
'event_id' => $event['id'],
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], $base + $odds);
break;
case 29:
// BOTH TEAMS TO SCORE (GG/NG)
$odds = [];
foreach ($bettypes['odds'] as $bettype) {
if ($bettype['outcome_id'] == 74) {
$odds['gg'] = $bettype['odd_value'];
} elseif ($bettype['outcome_id'] == 76) {
$odds['ng'] = $bettype['odd_value'];
}
}
$odds['margin'] = (float) Margin::calculate($odds, 1);
OddsGgng::updateOrCreate([
'event_id' => $event['id'],
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], $base + $odds);
break;
default:
dd($bettypes);
break;
}
}
}
}
// $bmoid = (int) $value['match_id'];
// $event = [];
// $event['status'] = 1;
// $event['bkmid'] = PARSER::$_config['bookmaker_id'];
// $event['bmoid'] = (int) $bmoid;
// $event['sportid'] = 1;
// $event['brmatchid'] = (int) $value['parent_match_id'];
// $event['starttime'] = strtotime($value['start_time']);
// $event['starttime'] -= 10800;
// $event['event'] = $value['home_team'].' v '.$value['away_team'];
// $event['groupname'] = $value['competition_name'];
// $event['groupid'] = $value['competition_id'];
// $event['country'] = $value['category'];
// $event['home'] = $value['home_team'];
// $event['away'] = $value['away_team'];
}
sleep(10);
}
}
}
}
@@ -90,7 +90,7 @@ class FindFixture
Event::where('id', $match->id)->update($update_array);
}
if (! in_array(Nuh::$options['provider_id'], [5, 6])) {
if (! in_array(Nuh::$options['provider_id'], [5, 6, 9])) {
StoreData::store($event, $match);
}
@@ -101,7 +101,7 @@ class FindFixture
return;
}
if (in_array(Nuh::$options['provider_id'], [5, 6])) {
if (in_array(Nuh::$options['provider_id'], [5, 6, 9])) {
Mapper::updateOrCreate(['event_id' => $event_id], $event);
return;