add DB::transaction to catch looked query
This commit is contained in:
1 parent
f1b0f43ded
commit
65dc70e681
38 files changed
+218
-266
No files matched your search
@@ -27,9 +27,9 @@ 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;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Odds
|
||||
{
|
||||
@@ -238,10 +238,10 @@ class Odds
|
||||
'competition_group_id' => (int) $row->group['cgid'],
|
||||
];
|
||||
|
||||
$res = Event::updateOrCreate(['id' => (int) $row['id']], $event);
|
||||
if ($res) {
|
||||
$event_id = $res->id;
|
||||
}
|
||||
$res = DB::transaction(function () use ($row, $event) {
|
||||
return Event::updateOrCreate(['id' => (int) $row['id']], $event);
|
||||
}, 5);
|
||||
$event_id = $res->id;
|
||||
|
||||
$group = [
|
||||
'competition_group_id' => (string) $row->group['cgid'],
|
||||
@@ -326,7 +326,10 @@ class Odds
|
||||
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
if ($res && $res->starttime != $attributeValue) {
|
||||
$res->starttime = $attributeValue;
|
||||
DatabaseFunctions::save_update($res);
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -342,13 +345,16 @@ class Odds
|
||||
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
if ($res && $res->starttime != $attributeValue) {
|
||||
$res->starttime = $attributeValue;
|
||||
DatabaseFunctions::save_update($res);
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_2Way::grap($odds, $offer);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
foreach ($offer->odds->attributes() as $attributeName => $attributeValue) {
|
||||
@@ -358,7 +364,9 @@ class Odds
|
||||
$res = EventBookmaker::where('event_id', $event_id)->where('bookmaker_id', $bookmaker_id)->first();
|
||||
if ($res && $res->starttime != $attributeValue) {
|
||||
$res->starttime = $attributeValue;
|
||||
DatabaseFunctions::save_update($res);
|
||||
DB::transaction(function () use ($res) {
|
||||
$res->save();
|
||||
}, 5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user