fix up down price

This commit is contained in:
2026-06-02 11:18:05 +03:30
parent cf466c616c
commit 3e6c4b588d
3 changed files with 28 additions and 18 deletions
+7 -13
View File
@@ -85,20 +85,14 @@ class ReportController extends Controller
$downSetting = Setting::where('key', 'down_price')->first();
if ($upSetting && $downSetting) {
$today = Carbon::now()->format('Y-m-d');
$updatedToday = $upSetting->updated_at
&& $upSetting->updated_at->format('Y-m-d') === $today;
$down = (float) ($downSetting->value ?: 0);
$up = (float) ($upSetting->value ?: 0);
if ($updatedToday) {
$down = (float) $downSetting->value;
$up = (float) $upSetting->value;
if ($down > 0 && $up > 0) {
return [
'sell' => $down - $diffSell,
'buy' => $up + $diffBuy,
];
}
if ($down > 0 && $up > 0) {
return [
'sell' => $down - $diffSell,
'buy' => $up + $diffBuy,
];
}
}