NASER fix conflicts

This commit is contained in:
gholak tala
2026-02-16 10:24:21 +00:00
12 changed files with 238 additions and 71 deletions
+24 -6
View File
@@ -6,6 +6,7 @@ use App\Http\Controllers\Admin\PriceController;
use App\Http\Controllers\Controller;
use App\Mail\YourMailableClass;
use App\Models\Cnt;
use App\Models\Setting;
use App\Models\ConfigStatic;
use App\Models\Customer;
use App\Models\Price;
@@ -18,6 +19,7 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Mail;
use Morilog\Jalali\Jalalian;
use App\Http\Controllers\Admin\ProductController;
class ReportController extends Controller
{
@@ -43,7 +45,8 @@ class ReportController extends Controller
public function updatePrise()
{
$difference = config('fee.single');
// $difference = config('fee.single');
$difference = Setting::where('key', 'fee_single')->first()->value;
$lastPrice = Price::latest()->first();
$PriceTriggers = PriceTrigger::where("is_active", true)->get();
foreach ($PriceTriggers as $PriceTrigger) {
@@ -71,7 +74,8 @@ class ReportController extends Controller
public function upDownPrice()
{
$difference = config('fee.single');
// $difference = config('fee.single');
$difference = Setting::where('key', 'fee_single')->first()->value;
$today = Carbon::now()->format("Y-m-d");
$prises = Price::where('date_at', $today)->get("price");
@@ -119,7 +123,8 @@ class ReportController extends Controller
public function lastPrice()
{
$difference = config('fee.single');
// $difference = config('fee.single');
$difference = Setting::where('key', 'fee_single')->first()->value;
// try {
@@ -127,9 +132,20 @@ class ReportController extends Controller
// } catch (\Exception $e) {$tala_ir = 0;}
$main_product_id = Cnt::where('key', 'main_product')->first()['value'];
$refpricer = new ProductController();
if ($refpricer->getPrice()) {
$ref = true;
} else {
$ref = false;
}
$pr_product = Product::find($main_product_id);
$priceValue = $pr_product['price'] + $pr_product['price_profit'];//$tala_ir;//4000
try {
$taban_gohar = Http::timeout(2)->get('https://tabangohar.com/GheymatKhan/prices_in_table.html')->json();
$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
$lastPrice = Price::latest()->first();
if (!$lastPrice || $lastPrice->price != $priceValue and $priceValue > 30000000) {
$price = new Price();
@@ -167,7 +183,9 @@ class ReportController extends Controller
// 'henzagold' => $henzagold_18,
// 'Ounce' => $henzagold_ons_gold,
// 'milli' => $milli,
'main_product' => $pr_product['price'] + $pr_product['price_profit']
'main_product' => $pr_product['price'] + $pr_product['price_profit'],
'taban_gohar' => $tgn,
'refpricer' => $ref
];
} else {
return [];