fix register 3
This commit is contained in:
@@ -75,20 +75,36 @@ class ReportController extends Controller
|
||||
|
||||
public function upDownPrice()
|
||||
{
|
||||
$upSetting = Setting::where('key', 'up_price')->first();
|
||||
$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;
|
||||
|
||||
if ($updatedToday) {
|
||||
$down = (float) $downSetting->value;
|
||||
$up = (float) $upSetting->value;
|
||||
|
||||
if ($down > 0 && $up > 0) {
|
||||
return ['sell' => $down, 'buy' => $up];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$difference = Setting::where('key', 'fee_single')->first()->value;
|
||||
$today = Carbon::now()->format("Y-m-d");
|
||||
$prises = Price::where('date_at', $today)->get("price");
|
||||
|
||||
$minP = 0; // Initialize to the highest possible value
|
||||
$maxP = 0; // Initialize to the lowest possible value
|
||||
$minP = 0;
|
||||
$maxP = 0;
|
||||
|
||||
foreach ($prises as $p) {
|
||||
// Initialize $minP to the first price if it's null
|
||||
if ($minP == 0 || $p->price < $minP) {
|
||||
$minP = $p->price;
|
||||
}
|
||||
|
||||
// Initialize $maxP to the first price if it's null
|
||||
if ($maxP == 0 || $p->price > $maxP) {
|
||||
$maxP = $p->price;
|
||||
}
|
||||
@@ -98,15 +114,9 @@ class ReportController extends Controller
|
||||
$priceValue = $price->price;
|
||||
|
||||
return ['sell' => $priceValue - $difference, 'buy' => $priceValue + $difference];
|
||||
} else {
|
||||
|
||||
// Assuming $minP and $maxP are defined elsewhere in your code
|
||||
return ['sell' => $minP - $difference, 'buy' => $maxP + $difference];
|
||||
}
|
||||
// return $prises;
|
||||
// $add_sell_price = config('add_sell_price.major');
|
||||
// $price = PriceCandle::whereDate('date_at',)->first();
|
||||
// $price_price = Price::orderBy('id','desc')->first();
|
||||
|
||||
return ['sell' => $minP - $difference, 'buy' => $maxP + $difference];
|
||||
}
|
||||
|
||||
public function lastPrice()
|
||||
@@ -452,6 +462,10 @@ class ReportController extends Controller
|
||||
$priceLast = ceil($priceValue + $difference);
|
||||
}
|
||||
|
||||
if (!$closed && $priceValue > 0) {
|
||||
$config->trackDailyPriceExtreme((float) $priceValue);
|
||||
}
|
||||
|
||||
return [
|
||||
'sell' => $sell,
|
||||
'buy' => $buy,
|
||||
|
||||
Reference in New Issue
Block a user