From 323ff1a2f7a66c7d7e81bf1270fb0c326951c897 Mon Sep 17 00:00:00 2001 From: Naser moghbel Date: Sat, 21 Feb 2026 13:35:27 +0330 Subject: [PATCH] NASER fix upload file and create a row in const table for banner --- routes/admin.php | 3 +++ routes/web.php | 27 ++++++++++++++------------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/routes/admin.php b/routes/admin.php index bcf1061..56313fb 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -26,6 +26,9 @@ Route::middleware('auth:user')->group(function (){ return Http::get('https://pricing.liman.gold/pricingApi', [])->json(); }); + //upload file + Route::post('/file',[FileController::class, 'store']); + //settigs Route::get('get_settings',[SettingsController::class, 'index']); Route::post('get_settings',[SettingsController::class, 'edit']); diff --git a/routes/web.php b/routes/web.php index ee992df..fdcf8b1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -15,31 +15,32 @@ use App\Http\Controllers\pay\PaymanController; Route::get('/refPricer', function () { // $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->json(); $RPrices = Http::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) { - if($product->reading_method == 'مس' && $CP){ - $p = Product::where('id', $product->id)->update([ - 'price' => $CP, - ]); + if($RPrice['name'] == 'TGJU فلز مس'){ + $copper = $RPrice['price'] + $RPrice['profit']; + } + if($RPrice['name'] == 'TGJU دلار'){ + $dollar = $RPrice['price'] + $RPrice['profit']; } if ($product->reading_method == $RPrice['name']) { $p = Product::where('id', $product->id)->update([ 'price' => $RPrice['price'], 'price_profit' => $RPrice['profit'], ]); - - } } } + if(isset($copper)&& isset($dollar)){ + $cp = ($copper/1000000)*$dollar; + $p = Product::where('id', 33)->update([ + 'price' => $cp, + 'price_profit' => 0, + ]); + } + return response()->json(true); });