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); $pr_product = Product::find($main_product_id);
// try { try {
// $taban_gohar = Http::timeout(2)->get('https://tabangohar.com/GheymatKhan/prices_in_table.html')->json(); $taban_gohar = Http::withOptions([
// $tgn = (int)$taban_gohar['c']*10; 'curl' => [
// }catch (\Exception $e){$tgn = 0;} // اجبار به استفاده از 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) { if($this->Config('goldir_price') == 'true' && $goldir_price !== 0) {
$priceValue = (int)$goldir_price; $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{ }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(); $lastPrice = Price::latest()->first();
if (!$lastPrice || $lastPrice->price != $priceValue and $priceValue > 30000000) { if (!$lastPrice || $lastPrice->price != $priceValue and $priceValue > 30000000) {