fix all error
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user