add DB::transaction to catch looked query

This commit is contained in:
salam committed 2026-02-16 10:02:07 +01:00
1 parent f1b0f43ded
commit 65dc70e681
38 files changed
+218 -266

No files matched your search

+25 -20
View File
@@ -13,7 +13,6 @@ use App\Models\OddsDnb;
use App\Models\OddsGgng;
use App\Models\OddsTotal;
use App\Models\Sport;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
@@ -74,11 +73,13 @@ class Bet365
if (isset($data['results'][0]['main'])) {
EventBookmaker::updateOrCreate([
'event_id' => $event->id,
'sport_id' => $event->sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $event->starttime, 'in_feed' => 1, 'bmoid' => $event->bet365_id]);
DB::transaction(function () use ($event) {
EventBookmaker::updateOrCreate([
'event_id' => $event->id,
'sport_id' => $event->sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $event->starttime, 'in_feed' => 1, 'bmoid' => $event->bet365_id]);
}, 5);
$offer = $data['results'][0]['main']['sp'];
@@ -119,9 +120,9 @@ class Bet365
$res->d3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
DatabaseFunctions::save_update($res);
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -155,8 +156,9 @@ class Bet365
$res->dcx2 = $odds['dcx2'];
$res->flags = 1;
$res->margin = $odds['margin'];
DatabaseFunctions::save_update($res);
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
@@ -198,8 +200,9 @@ class Bet365
$res->difference = abs(1 / $odds['over'] - 1 / $odds['under']);
$res->flags = 1;
$res->margin = $odds['margin'];
DatabaseFunctions::save_update($res);
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
@@ -233,9 +236,9 @@ class Bet365
$res->ng = $odds['ng'];
$res->flags = 1;
$res->margin = $odds['margin'];
DatabaseFunctions::save_update($res);
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
}
@@ -267,8 +270,9 @@ class Bet365
$res->dnb2 = $odds['dnb2'];
$res->flags = 1;
$res->margin = $odds['margin'];
DatabaseFunctions::save_update($res);
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}
@@ -303,8 +307,9 @@ class Bet365
$res->a3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
DatabaseFunctions::save_update($res);
DB::transaction(function () use ($res) {
$res->save();
}, 5);
}
}