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
@@ -99,9 +99,11 @@ class ReportController extends Controller
{
// status: open | closed (خارج از ساعت کاری) | no_quote (مظنه در دسترس نیست)
$payload = app(ConfigService::class)->applyHomePriceDisplayState($payload);
$payload = app(ConfigService::class)->attachTradingHoursSettingsPatch($payload);
$payload['up'] = $this->buildUpDownPrices();
// سقف/کف روز هم وقتی قیمت نباید نمایش داده شود صفر می‌ماند
$payload['up'] = ($payload['status'] ?? 'open') === 'open'
? $this->buildUpDownPrices()
: ['sell' => 0, 'buy' => 0];
$payload['last_historical'] = app(ProductDisplayPriceService::class)->resolveHistoricalBasePrice();
$payload['gold_ounce'] = $this->resolveGoldOuncePayload();
app(ProductDisplayPriceService::class)->cacheLivePricePayload($payload);
@@ -476,6 +478,10 @@ class ReportController extends Controller
/** اختلاف پکیج ویژه — فقط روی پاسخ مشتری؛ کش مشترک را آلوده نمی‌کند */
protected function personalizeLastPriceForCustomer(array $payload): array
{
// تنظیمات ساعت کاری همیشه تازه از DB — اگر داخل کش قیمت بماند،
// پولینگ بعدی مقدار قبلی را برمی‌گرداند و تغییر پنل عقب برمی‌گردد.
$payload = app(ConfigService::class)->attachTradingHoursSettingsPatch($payload);
$customerId = (int) (auth('customer')->id() ?? 0);
if ($customerId <= 0) {
return $payload;