fix all error

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