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

+2 -1
View File
@@ -213,7 +213,8 @@ class Betica
}
}
}
sleep(10);
usleep(rand(10000, 20000));
}
}
}
@@ -13,6 +13,7 @@ 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;
@@ -118,7 +119,9 @@ class Bet365
$res->d3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -152,7 +155,9 @@ class Bet365
$res->dcx2 = $odds['dcx2'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -193,7 +198,9 @@ class Bet365
$res->difference = abs(1 / $odds['over'] - 1 / $odds['under']);
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -226,7 +233,9 @@ class Bet365
$res->ng = $odds['ng'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -258,7 +267,9 @@ class Bet365
$res->dnb2 = $odds['dnb2'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -292,7 +303,9 @@ class Bet365
$res->d3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -7,6 +7,7 @@ use App\Console\Commands\Nuh;
use App\Models\Event;
use App\Models\Odds3way;
use App\Models\Supervisor;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
@@ -98,7 +99,9 @@ class Odds
$res->d3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
break;
case '1_3':
@@ -123,7 +126,9 @@ class Odds
$res->d3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
break;
}
+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) {
@@ -8,6 +8,7 @@ use App\Models\OddsDc;
use App\Models\OddsGgng;
use App\Models\OddsTotal;
use App\Models\OddsTq;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class Soccer
@@ -93,7 +94,9 @@ class Soccer
$res->a3w = number_format($_3way['a3w'], 2);
$res->flags = 1;
$res->margin = $_3way['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
// OU
@@ -117,7 +120,9 @@ class Soccer
$res->under = number_format($_total['under'], 2);
$res->flags = 1;
$res->margin = $_total['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
// GG NG
@@ -136,7 +141,8 @@ class Soccer
$res->ng = number_format($_ggng['ng'], 2);
$res->flags = 1;
$res->margin = $_ggng['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
@@ -157,7 +163,8 @@ class Soccer
$res->dcx2 = number_format($_dc['dcx2'], 2);
$res->flags = 1;
$res->margin = $_dc['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
@@ -177,7 +184,9 @@ class Soccer
$res->atq = number_format($_tq['atq'], 2);
$res->flags = 1;
$res->margin = $_tq['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -8,6 +8,7 @@ use App\Console\Commands\Grapper\Logifuture\Tools\LogifutureStoreTotals;
use App\Console\Commands\Nuh;
use App\Models\Odds2way;
use App\Models\Odds2wayS1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class Tennis
@@ -84,7 +85,9 @@ class Tennis
$res->a2w = number_format($ml['a2w'], 2);
$res->flags = 1;
$res->margin = $ml['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
@@ -103,7 +106,9 @@ class Tennis
$res->a2w = number_format($ml['a2w'], 2);
$res->flags = 1;
$res->margin = $mls1['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Logifuture\Tools;
use App\Models\OddsPoint;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class LogifutureStorePoints
@@ -39,7 +40,9 @@ class LogifutureStorePoints
$res->difference = $odds['difference'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Logifuture\Tools;
use App\Models\OddsPointQ1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class LogifutureStorePointsQ1
@@ -39,7 +40,9 @@ class LogifutureStorePointsQ1
$res->difference = $odds['difference'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Logifuture\Tools;
use App\Models\OddsTotal;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class LogifutureStoreTotals
@@ -39,7 +40,9 @@ class LogifutureStoreTotals
$res->difference = $odds['difference'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Logifuture\Tools;
use App\Models\OddsTotalQ1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class LogifutureStoreTotalsQ1
@@ -39,7 +40,9 @@ class LogifutureStoreTotalsQ1
$res->difference = $odds['difference'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -9,6 +9,7 @@ use App\Models\EventBookmaker;
use App\Models\Sport;
use App\Utilities\Notice;
use Illuminate\Support\Carbon;
use PDOException;
class Fixtures
{
@@ -104,11 +105,28 @@ class Fixtures
$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'], 'starttime' => $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'], 'starttime' => $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);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\Odds3way;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStore1x2
@@ -26,7 +27,9 @@ class MaglooStore1x2
$res->d3w = $odds['a3w'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsDc;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStoreDc
@@ -27,7 +28,9 @@ class MaglooStoreDc
$res->dcx2 = $odds['dcx2'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsGgng;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStoreGgng
@@ -25,7 +26,9 @@ class MaglooStoreGgng
$res->ng = $odds['ng'];
$res->flags = 1;
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsPoint;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStorePoints
@@ -36,7 +37,9 @@ class MaglooStorePoints
$res->active_spread = $odds['active_spread'];
$res->difference = $odds['difference'];
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsPointQ1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStorePointsQ1
@@ -36,7 +37,9 @@ class MaglooStorePointsQ1
$res->active_spread = $odds['active_spread'];
$res->difference = $odds['difference'];
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsTotal;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStoreTotals
@@ -36,7 +37,9 @@ class MaglooStoreTotals
$res->active_spread = $odds['active_spread'];
$res->difference = $odds['difference'];
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsTotalQ1;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStoreTotalsQ1
@@ -36,7 +37,9 @@ class MaglooStoreTotalsQ1
$res->active_spread = $odds['active_spread'];
$res->difference = $odds['difference'];
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
@@ -3,6 +3,7 @@
namespace App\Console\Commands\Grapper\Magloo\Odds;
use App\Models\OddsTq;
use App\Utilities\DatabaseFunctions;
use App\Utilities\Margin;
class MaglooStoreTq
@@ -25,7 +26,9 @@ class MaglooStoreTq
$res->htq = $odds['htq'];
$res->atq = $odds['atq'];
$res->margin = $odds['margin'];
$res->save();
DatabaseFunctions::save_update($res);
}
}
}
+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);
}
}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Console\Commands\Services\Tasks;
use App\Console\Commands\Nuh;
use App\Utilities\Notice;
use Illuminate\Support\Facades\DB;
class DBConsistencyChecker
{
public static function checkEvents()
{
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('DB Consistency Checker', 'b');
}
$res = DB::raw('select * from event_bookmakers where not exists (select * from events where events.id = event_bookmakers.event_id)');
dd($res);
}
}