fix(settings): honor last-price switch and overlay only SuperAdmin access flags

Stored DB prices were treated as live quotes, and SuperAdmin overlay overwrote tenant keys like trading hours. Keep overlay to the 14 access flags and hide fallback prices when the panel says so.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-25 03:01:07 +03:30
co-authored by Cursor
parent 8984899042
commit b21b136711
9 changed files with 327 additions and 97 deletions
+12 -6
View File
@@ -115,6 +115,7 @@ class LivePriceCacheService
'zaarbox' => 0,
'closed' => false,
'status' => 'no_quote',
'price_source' => '',
'time' => now(),
];
} else {
@@ -151,20 +152,25 @@ class LivePriceCacheService
'zaarbox' => $zaarboxSource,
'closed' => false,
'status' => 'open',
'price_source' => $priceSource,
'time' => now(),
];
}
$payload['up'] = $config->resolvedDailyBaseExtremes()['up'] > 0
? [
'sell' => max(0, (int) ceil($config->resolvedDailyBaseExtremes()['down'] - $config->displaySellPriceDiffRial())),
'buy' => (int) ceil($config->resolvedDailyBaseExtremes()['up'] + $config->displayBuyPriceDiffRial()),
]
: ['sell' => $payload['sell'] ?? 0, 'buy' => $payload['buy'] ?? 0];
$payload['last_historical'] = $display->resolveHistoricalBasePrice();
$payload = $config->applyGlobalTradingHoursToPayload($payload);
$extremes = $config->resolvedDailyBaseExtremes();
$payload['up'] = ($payload['status'] ?? 'open') !== 'open'
? ['sell' => 0, 'buy' => 0]
: ($extremes['up'] > 0
? [
'sell' => max(0, (int) ceil($extremes['down'] - $config->displaySellPriceDiffRial())),
'buy' => (int) ceil($extremes['up'] + $config->displayBuyPriceDiffRial()),
]
: ['sell' => $payload['sell'] ?? 0, 'buy' => $payload['buy'] ?? 0]);
return app(ZaarboxPriceService::class)->attachGoldOunceToPayload($payload);
}
}