From 67cb335a95ba11d0bd632bb914571c7d107cd1fb Mon Sep 17 00:00:00 2001 From: Naser moghbel Date: Thu, 12 Mar 2026 14:33:08 +0330 Subject: [PATCH] NASER dynamic get price --- .../Controllers/Site/ReportController.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Site/ReportController.php b/app/Http/Controllers/Site/ReportController.php index fbfd3d9..f0b2ffb 100644 --- a/app/Http/Controllers/Site/ReportController.php +++ b/app/Http/Controllers/Site/ReportController.php @@ -192,15 +192,24 @@ class ReportController extends Controller // } $pr_product = Product::find($main_product_id); -// try { -// $taban_gohar = Http::timeout(2)->get('https://tabangohar.com/GheymatKhan/prices_in_table.html')->json(); -// $tgn = (int)$taban_gohar['c']*10; -// }catch (\Exception $e){$tgn = 0;} + try { + $taban_gohar = Http::withOptions([ + 'curl' => [ + // اجبار به استفاده از IPv4 و جلوگیری از تاخیر IPv6 + CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, + // افزایش سرعت برقراری ارتباط TCP + CURLOPT_TCP_FASTOPEN => 1, + ] + ])->withoutVerifying()->timeout(2)->get('https://tabangohar.com/GheymatKhan/prices_in_table.html')->json(); + $tgn = (int)$taban_gohar['c']*10; + }catch (\Exception $e){$tgn = 0;} if($this->Config('goldir_price') == 'true' && $goldir_price !== 0) { $priceValue = (int)$goldir_price; + }elseif($this->Config('tabanGohar_price') == 'true' && $tgn !== 0){ + $priceValue = $tgn !== 0 ? $tgn : $pr_product['price'] + $pr_product['price_profit'];//$tala_ir;//4000 }else{ - $priceValue = /*$tgn !== 0 ? $tgn : */$pr_product['price'] + $pr_product['price_profit'];//$tala_ir;//4000 + $priceValue = $pr_product['price'] + $pr_product['price_profit'];//$tala_ir;//4000 } $lastPrice = Price::latest()->first(); if (!$lastPrice || $lastPrice->price != $priceValue and $priceValue > 30000000) {