add PDOException on updated odds
This commit is contained in:
1 parent
b35c8c48e3
commit
980b716271
15 files changed
+284
-21
No files matched your search
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2way;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _2Way
|
||||
{
|
||||
@@ -27,7 +28,25 @@ class _2Way
|
||||
$res->a2w = $odds['a2w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds2wayS1;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _2WayS1
|
||||
{
|
||||
@@ -27,7 +28,24 @@ class _2WayS1
|
||||
$res->a2w = $odds['a2w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3way;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _3Way
|
||||
{
|
||||
@@ -24,12 +25,30 @@ class _3Way
|
||||
if (! $res) {
|
||||
Odds3way::create($odds);
|
||||
} elseif (! $block_update) {
|
||||
|
||||
$res->h3w = $odds['h3w'];
|
||||
$res->a3w = $odds['d3w'];
|
||||
$res->d3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\Odds3wayHt;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _3WayHt
|
||||
{
|
||||
@@ -29,7 +30,25 @@ class _3WayHt
|
||||
$res->d3w = $odds['a3w'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsDc;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _Dc
|
||||
{
|
||||
@@ -29,7 +30,25 @@ class _Dc
|
||||
$res->dcx2 = $odds['dcx2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsDnb;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _Dnb
|
||||
{
|
||||
@@ -27,7 +28,25 @@ class _Dnb
|
||||
$res->dnb2 = $odds['dnb2'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsGgng;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _Ggng
|
||||
{
|
||||
@@ -27,7 +28,25 @@ class _Ggng
|
||||
$res->ng = $odds['ng'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsPoint;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _Points
|
||||
{
|
||||
@@ -39,7 +40,25 @@ class _Points
|
||||
$res->away = $odds['away'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
$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);
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_points');
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsPointHt;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _PointsHt
|
||||
{
|
||||
@@ -39,7 +40,25 @@ class _PointsHt
|
||||
$res->away = $odds['away'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_points_ht');
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsPointQ1;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _PointsQ1
|
||||
{
|
||||
@@ -39,7 +40,25 @@ class _PointsQ1
|
||||
$res->away = $odds['away'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_points_q1');
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTotal;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _Totals
|
||||
{
|
||||
@@ -45,7 +46,25 @@ class _Totals
|
||||
$res->under = $odds['under'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_totals');
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTotalHt;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _TotalsHt
|
||||
{
|
||||
@@ -45,7 +46,25 @@ class _TotalsHt
|
||||
$res->under = $odds['under'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_totals_ht');
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Console\Commands\Grapper\TxOdds\Odds\Tools\ActiveSpread;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTotalQ1;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _TotalsQ1
|
||||
{
|
||||
@@ -45,7 +46,25 @@ class _TotalsQ1
|
||||
$res->under = $odds['under'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
ActiveSpread::collect($odds, 'odds_totals_q1');
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Grapper\TxOdds\Odds;
|
||||
use App\Console\Commands\Nuh;
|
||||
use App\Models\OddsTq;
|
||||
use App\Utilities\Margin;
|
||||
use PDOException;
|
||||
|
||||
class _Tq
|
||||
{
|
||||
@@ -27,7 +28,25 @@ class _Tq
|
||||
$res->atq = $odds['atq'];
|
||||
$res->flags = 1;
|
||||
$res->margin = $odds['margin'];
|
||||
$res->save();
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,16 +19,14 @@ class TxoddsFlags
|
||||
Notice::note('Txodds Markets Status', 'b');
|
||||
}
|
||||
|
||||
if (Nuh::$options['lastcall'] >= strtotime('-1 hour')) {
|
||||
Nuh::$options['lastcall'] = 0;
|
||||
}
|
||||
$lastcall = Nuh::$options['lastcall'] > time() - 600 ? '&last='.Nuh::$options['lastcall'] : '&last='.time() - 600;
|
||||
|
||||
/**
|
||||
* SOCCER
|
||||
*/
|
||||
$tables = OddsTable::where('soccer', 1)->pluck('name');
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/boid_states.php?ident=betaid1&passwd=Dy59vpRC&last='.Nuh::$options['lastcall'];
|
||||
$url = 'https://xml2.txodds.com/feed/boid_states.php?ident=betaid1&passwd=Dy59vpRC'.$lastcall;
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
@@ -43,16 +41,16 @@ class TxoddsFlags
|
||||
*/
|
||||
$tables = OddsTable::where('other', 1)->pluck('name');
|
||||
|
||||
$url = 'https://xml2.txodds.com/feed/boid_states.php?ident=betaid2&passwd=Dy59vpRC&last='.Nuh::$options['lastcall'];
|
||||
$url = 'https://xml2.txodds.com/feed/boid_states.php?ident=betaid2&passwd=Dy59vpRC'.$lastcall;
|
||||
|
||||
$data = Xml::load($url);
|
||||
|
||||
Supervisor::where('id', Nuh::$options['supervisor_id'])->update(['lastcall' => (int) $data['timestamp']]);
|
||||
|
||||
foreach ($data as $row) {
|
||||
foreach ($tables as $table) {
|
||||
DB::table($table)->where('offer_id', (int) $row['id'])->update(['last_updated' => $row['last_updated'], 'flags' => $row['flags']]);
|
||||
}
|
||||
}
|
||||
|
||||
Supervisor::where('id', Nuh::$options['supervisor_id'])->update(['lastcall' => time()]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user