NASER fix price issues & close trade when tahesab is unavailable

This commit is contained in:
gholak tala
2026-03-16 10:04:14 +00:00
parent 69dec434d7
commit df4972eceb
3 changed files with 26 additions and 6 deletions
@@ -152,9 +152,9 @@ class ReportController extends Controller
$buy = $lp['sub_agent']['rate_buy_gram_price'];
$sell = $lp['sub_agent']['rate_sell_gram_price'];
$customPrice['price'] = ($buy + $sell) / 2;
$customPrice['price'] = (ceil($buy) + ceil($sell)) / 2;
Cnt::where('key', 'goldir_price')->update(['value' => (float)$customPrice['price']]);//was float
$customPrice['diff'] = ($buy - $sell) / 2;
$customPrice['diff'] = (ceil($buy) - ceil($sell)) / 2;
Cnt::where('key', 'goldir_diff')->update(['value' => (float)$customPrice['diff']]);//was float
Cnt::where('key', 'goldir_mazaneh')->update(['value' => ((float)$customPrice['price'] * 4.331802)]);
@@ -239,10 +239,14 @@ class ReportController extends Controller
}
$price = Price::orderBy('id', 'desc')->first();
if ($price) {
if($this->Config('goldir_price') == 'true' && $goldir_price !==0){
$goldir_profit = Cnt::where('key', 'goldir_diff')->first()['value'];
$difference = $goldir_profit;
}
return [
'sell' => $price->price - $difference,
'buy' => $price->price + $difference,
'price_last' => $price->price + $difference,
'sell' => ceil($price->price - $difference),
'buy' => ceil($price->price + $difference),
'price_last' => ceil($price->price + $difference),
'price' => $priceValue,
'main_product' => $pr_product['price'] + $pr_product['price_profit'],
'taban_gohar' => $tgn ?? 0,