save updates

This commit is contained in:
salam committed 2026-02-07 07:08:58 +01:00
1 parent 3671902fe7
commit 046407df18
36 files changed
+261 -305

No files matched your search

+41 -6
View File
@@ -15,6 +15,7 @@ use App\Models\EventBookmaker;
use App\Models\Sport;
use App\Utilities\Notice;
use Illuminate\Support\Facades\DB;
use PDOException;
class Logifuture
{
@@ -58,11 +59,28 @@ class Logifuture
$event_id_collector[] = $event['id'];
EventBookmaker::updateOrCreate([
'event_id' => $event['id'],
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'startime' => $event['starttime']]);
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
$handle = EventBookmaker::updateOrCreate([
'event_id' => $event['id'],
'sport_id' => $sport_id,
'bookmaker_id' => Nuh::$options['bookmaker_id'],
], ['in_feed' => 1, 'bmoid' => $event['event_id'], 'startime' => $event['starttime']]);
return $handle;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
switch ($sport_id) {
case 1:
@@ -90,7 +108,24 @@ class Logifuture
}
}
if ($event_id_collector) {
EventBookmaker::whereNotIn('event_id', $event_id_collector)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->update(['in_feed' => 0]);
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
$handle = EventBookmaker::whereNotIn('event_id', $event_id_collector)->where('bookmaker_id', Nuh::$options['bookmaker_id'])->update(['in_feed' => 0]);
return $handle;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
$tables = ['odds_2ways', 'odds_2ways_s1', 'odds_3ways', 'odds_totals', 'odds_points', 'odds_ggng', 'odds_dc', 'odds_tq', 'odds_points_q1', 'odds_totals_q1'];
foreach ($tables as $table) {