From 95be6961fa2949a75b8b84cd4504f56b0e9cbcdd Mon Sep 17 00:00:00 2001 From: gholak tala Date: Mon, 16 Feb 2026 12:16:11 +0000 Subject: [PATCH] Naser remove refpricer from last api --- app/Http/Controllers/Site/ReportController.php | 14 +++++++------- routes/admin.php | 3 --- routes/web.php | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Site/ReportController.php b/app/Http/Controllers/Site/ReportController.php index 6fd46e1..b8adfb6 100644 --- a/app/Http/Controllers/Site/ReportController.php +++ b/app/Http/Controllers/Site/ReportController.php @@ -133,11 +133,11 @@ class ReportController extends Controller $main_product_id = Cnt::where('key', 'main_product')->first()['value']; $refpricer = new ProductController(); - if ($refpricer->getPrice()) { - $ref = true; - } else { - $ref = false; - } +// if ($refpricer->getPrice()) { +// $ref = true; +// } else { +// $ref = false; +// } $pr_product = Product::find($main_product_id); try { @@ -145,7 +145,7 @@ class ReportController extends Controller $tgn = (int)$taban_gohar['c']*10; }catch (\Exception $e){$tgn = 0;} - $priceValue = $tgn !== 0 ? $tgn : $pr_product['price'] + $pr_product['price_profit'];//$tala_ir;//4000 + $priceValue = /*$tgn !== 0 ? $tgn : */$pr_product['price'] + $pr_product['price_profit'];//$tala_ir;//4000 $lastPrice = Price::latest()->first(); if (!$lastPrice || $lastPrice->price != $priceValue and $priceValue > 30000000) { $price = new Price(); @@ -185,7 +185,7 @@ class ReportController extends Controller // 'milli' => $milli, 'main_product' => $pr_product['price'] + $pr_product['price_profit'], 'taban_gohar' => $tgn, - 'refpricer' => $ref +// 'refpricer' => $ref ]; } else { return []; diff --git a/routes/admin.php b/routes/admin.php index d29095a..41e0348 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -15,13 +15,10 @@ use App\Http\Controllers\Customer\PriceTriggerController; use App\Http\Controllers\Finance\FinanceController; use App\Http\Controllers\Admin\ProductController; use App\Http\Controllers\Admin\TahesabController; -<<<<<<< HEAD use App\Http\Controllers\Admin\FileController; use App\Http\Controllers\Site\OfferCodesController; -======= use App\Http\Controllers\Admin\SettingsController; ->>>>>>> a0a788ce53f1b3dff84bd16f3b7db585071bc159 Route::middleware('auth:user')->group(function (){ Route::middleware('validation')->group(function (){ diff --git a/routes/web.php b/routes/web.php index 558e62b..92dcfa3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -13,11 +13,22 @@ use Ramsey\Uuid\Uuid; use App\Http\Controllers\pay\PaymanController; Route::get('/refPricer', function () { - $RPrices =Http::timeout(40)->get('http://212.23.201.173:8381/price_list', [])->json(); - + $RPrices = Http::get('https://pricing.liman.gold/pricingApi', [])->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 ($product->reading_method == $RPrice['name']) { $p = Product::where('id', $product->id)->update([ 'price' => $RPrice['price'],