fix all error
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Services;
|
|||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Http\Client\Response;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
@@ -796,7 +797,7 @@ class ZaarboxPriceService
|
|||||||
$responses = Http::pool(function ($pool) use ($now) {
|
$responses = Http::pool(function ($pool) use ($now) {
|
||||||
foreach (self::PERIODS as $key => $config) {
|
foreach (self::PERIODS as $key => $config) {
|
||||||
$start = $now->copy()->subHours($config['hours']);
|
$start = $now->copy()->subHours($config['hours']);
|
||||||
$pool->as($key)->withHeaders([
|
$pool->as($key)->withoutVerifying()->timeout(12)->withHeaders([
|
||||||
'Referer' => 'https://tablo.montest.ir/',
|
'Referer' => 'https://tablo.montest.ir/',
|
||||||
'User-Agent' => 'Mozilla/5.0',
|
'User-Agent' => 'Mozilla/5.0',
|
||||||
])->get($this->historyUrl($start, $now));
|
])->get($this->historyUrl($start, $now));
|
||||||
@@ -809,11 +810,14 @@ class ZaarboxPriceService
|
|||||||
$response = $responses[$key] ?? null;
|
$response = $responses[$key] ?? null;
|
||||||
$start = $now->copy()->subHours($config['hours']);
|
$start = $now->copy()->subHours($config['hours']);
|
||||||
|
|
||||||
if (!$response || !$response->successful()) {
|
if (!$response instanceof Response || !$response->successful()) {
|
||||||
Log::warning('Zaarbox price history fetch failed', [
|
$logContext = ['period' => $key];
|
||||||
'period' => $key,
|
if ($response instanceof Response) {
|
||||||
'status' => $response?->status(),
|
$logContext['status'] = $response->status();
|
||||||
]);
|
} elseif ($response instanceof \Throwable) {
|
||||||
|
$logContext['message'] = $response->getMessage();
|
||||||
|
}
|
||||||
|
Log::warning('Zaarbox price history fetch failed', $logContext);
|
||||||
$prices[$key] = [];
|
$prices[$key] = [];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user