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

+19 -15
View File
@@ -27,6 +27,7 @@ use App\Models\EventBookmaker;
use App\Models\Group;
use App\Models\Supervisor;
use App\Models\TxoddsMarket;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
@@ -316,12 +317,13 @@ class Odds
case 0:
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
switch ($attributeName) {
case 'starting_time':
EventBookmaker::updateOrInsert([
'event_id' => $event_id,
'sport_id' => $sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $attributeValue]);
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
if ($res->starttime != $attributeValue) {
$res->starttime = $attributeValue;
DatabaseFunctions::save_update($res);
}
break;
}
}
@@ -332,11 +334,12 @@ class Odds
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
switch ($attributeName) {
case 'starting_time':
EventBookmaker::updateOrInsert([
'event_id' => $event_id,
'sport_id' => $sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $attributeValue]);
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
if ($res->starttime != $attributeValue) {
$res->starttime = $attributeValue;
DatabaseFunctions::save_update($res);
}
break;
}
}
@@ -347,11 +350,12 @@ class Odds
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
switch ($attributeName) {
case 'starting_time':
EventBookmaker::updateOrInsert([
'event_id' => $event_id,
'sport_id' => $sport_id,
'bookmaker_id' => $bookmaker_id,
], ['starttime' => $attributeValue]);
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
if ($res->starttime != $attributeValue) {
$res->starttime = $attributeValue;
DatabaseFunctions::save_update($res);
}
break;
}
}
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds2way;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _2Way
{
@@ -29,24 +29,8 @@ class _2Way
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds2wayS1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _2WayS1
{
@@ -29,23 +29,8 @@ class _2WayS1
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
$res->save();
DatabaseFunctions::save_update($res);
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds3way;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _3Way
{
@@ -32,23 +32,7 @@ class _3Way
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
DatabaseFunctions::save_update($res);
}
}
}
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\Odds3wayHt;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _3WayHt
{
@@ -31,24 +31,8 @@ class _3WayHt
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsDc;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _Dc
{
@@ -31,24 +31,8 @@ class _Dc
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsDnb;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _Dnb
{
@@ -29,24 +29,8 @@ class _Dnb
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsGgng;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _Ggng
{
@@ -29,24 +29,8 @@ class _Ggng
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}
@@ -5,8 +5,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsPoint;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _Points
{
@@ -40,25 +40,9 @@ class _Points
$res->away = $odds['away'];
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
ActiveSpread::collect($odds, 'odds_points');
@@ -5,8 +5,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsPointHt;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _PointsHt
{
@@ -41,24 +41,8 @@ class _PointsHt
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
ActiveSpread::collect($odds, 'odds_points_ht');
@@ -5,8 +5,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsPointQ1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _PointsQ1
{
@@ -41,24 +41,8 @@ class _PointsQ1
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
ActiveSpread::collect($odds, 'odds_points_q1');
@@ -5,8 +5,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsTotal;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _Totals
{
@@ -47,24 +47,8 @@ class _Totals
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
ActiveSpread::collect($odds, 'odds_totals');
@@ -5,8 +5,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsTotalHt;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _TotalsHt
{
@@ -47,24 +47,8 @@ class _TotalsHt
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
ActiveSpread::collect($odds, 'odds_totals_ht');
@@ -5,8 +5,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
use App\Console\Commands\Nuh;
use App\Models\OddsTotalQ1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _TotalsQ1
{
@@ -47,24 +47,8 @@ class _TotalsQ1
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
ActiveSpread::collect($odds, 'odds_totals_q1');
@@ -4,8 +4,8 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
use App\Console\Commands\Nuh;
use App\Models\OddsTq;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use PDOException;
class _Tq
{
@@ -29,24 +29,8 @@ class _Tq
$res->flags = 1;
$res->margin = $odds['margin'];
$max_tries = 5;
$tries = 0;
do {
$retry = false;
try {
DatabaseFunctions::save_update($res);
$res->save();
return $res;
} catch (PDOException $exc) {
if ($tries < $max_tries && $exc->errorInfo[0] == 40001 && $exc->errorInfo[1] == 1213) {
$retry = true;
sleep(1);
} else {
throw $exc;
}
}
} while ($retry);
}
}
}