NASER fix some issues
This commit is contained in:
Executable → Regular
+17
-2
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\SuperController;
|
||||
use App\Models\Cnt;
|
||||
use App\Models\Product;
|
||||
use App\DB\Te\TableEngine;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -116,8 +117,8 @@ class ProductController extends SuperController
|
||||
|
||||
public function listProduct()
|
||||
{
|
||||
$this->getPrice();
|
||||
$this->auto_close_open();
|
||||
// $this->getPrice();
|
||||
// $this->auto_close_open();
|
||||
$product = Product::with([])->where('active', 1)->get();
|
||||
return response()->json($product);
|
||||
}
|
||||
@@ -126,8 +127,17 @@ class ProductController extends SuperController
|
||||
{
|
||||
// $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->json();
|
||||
// $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->json();
|
||||
|
||||
$RPrices =Http::timeout(40)->get('http://212.23.201.173:8381/price_list', [])->json();
|
||||
|
||||
try{
|
||||
$cooper =Http::timeout(40)->get('https://www.livedata.ir/main/static/p.json', [])->json();
|
||||
if(isset($cooper['s_301006']) && isset($cooper['s_200103'])){
|
||||
$CP = (($cooper['s_301006']/1000000)*$cooper['s_200103'])*10;
|
||||
// Cnt::where('key', 'cu_price')
|
||||
}
|
||||
}catch (\Exception $e){}
|
||||
|
||||
$products = Product::with([])->whereNotNull('reading_method')->get();
|
||||
foreach ($products as $product) {
|
||||
foreach ($RPrices as $RPrice) {
|
||||
@@ -146,6 +156,11 @@ class ProductController extends SuperController
|
||||
|
||||
}
|
||||
}
|
||||
if($product->reading_method == 'مس' && $CP){
|
||||
$p = Product::where('id', $product->id)->update([
|
||||
'price' => $CP,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return response()->json(true);
|
||||
|
||||
Reference in New Issue
Block a user