fix up down price
This commit is contained in:
@@ -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,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user