NASER & LOTFI dynamic connect to hamkar app
This commit is contained in:
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user