NASER & LOTFI dynamic connect to hamkar app

This commit is contained in:
gholak tala
2026-05-17 16:27:50 +00:00
parent 0ce2f9854a
commit 5bb4a36f87
2 changed files with 11 additions and 5 deletions
@@ -156,7 +156,9 @@ class ReportController extends Controller
$open_buy = true;
$open_sell = true;
if($gold_ir_price == 'true' && !$closed){
$goldir_price = 0;
$goldir_base_url=$this->Config('goldir_base_url')??'https://gold.ir';
try{
$goldir = Http::timeout(7)->withOptions([
'curl' => [
@@ -166,16 +168,16 @@ class ReportController extends Controller
])
->withoutVerifying() // غیرفعال کردن بررسی SSL (برای تست سرعت)
->withToken(Cnt::where('key', 'goldir')->first()['value'])
->get('https://gold.ir/server/customer/product/list')->json();
->get($goldir_base_url.'/server/customer/product/list')->json();
if((isset($goldir['message']) && $goldir['message'] == 'no authorised') || $goldir == null){
$cnt = new Cnt();
$goldir = Http::timeout(2)->withToken($cnt->goldir_login())
->get('https://gold.ir/server/customer/product/list')->json();
->get($goldir_base_url.'/server/customer/product/list')->json();
}
$customPrice= [];
$collection = collect($goldir);
$lp = $collection->firstWhere('id', 40);
$lp = $collection->firstWhere('id', $this->Config('hamkar_product_id'));
// foreach ($goldir as $lp) {
// if ($lp['id'] == 40) {
@@ -208,7 +210,9 @@ class ReportController extends Controller
}else{
Cnt::where('key', 'goldir_closed')->update(['value' => "false"]);
}
} catch (\Exception $e) {$goldir_price = 0;}
} catch (\Exception $e) {
echo $e->getMessage();
$goldir_price = 0;}
}
if($main_product_price == 'true' && !$closed){