NASER dynamic get price

This commit is contained in:
2026-03-12 14:33:08 +03:30
parent a7a2dad906
commit 67cb335a95
+14 -5
View File
@@ -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) {