fix(settings): push trading-hours changes to live user prices immediately
Recompute home price display on save, broadcast settings over SSE, and keep last-price status in sync without a user refresh. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -61,6 +61,11 @@ class PriceStreamController extends Controller
|
||||
$send('last', app(ZaarboxPriceService::class)->attachGoldOunceToPayload($last));
|
||||
}
|
||||
|
||||
$hoursSettings = app(\App\Services\ConfigService::class)->clientTradingHoursSettings();
|
||||
if ($hoursSettings !== []) {
|
||||
$send('settings', $hoursSettings);
|
||||
}
|
||||
|
||||
$list = app(PriceBroadcastService::class)->buildListPayload(false);
|
||||
if (is_array($list) && $list !== []) {
|
||||
$send('list', $list);
|
||||
|
||||
@@ -98,15 +98,8 @@ class ReportController extends Controller
|
||||
protected function appendUpPrices(array $payload, bool $saveFullCache = false): array
|
||||
{
|
||||
// status: open | closed (خارج از ساعت کاری) | no_quote (مظنه در دسترس نیست)
|
||||
if (!isset($payload['status'])) {
|
||||
if (!empty($payload['closed'])) {
|
||||
$payload['status'] = 'closed';
|
||||
} elseif ((int) ($payload['price'] ?? 0) <= 0 && (int) ($payload['buy'] ?? 0) <= 0) {
|
||||
$payload['status'] = 'no_quote';
|
||||
} else {
|
||||
$payload['status'] = 'open';
|
||||
}
|
||||
}
|
||||
$payload = app(ConfigService::class)->applyHomePriceDisplayState($payload);
|
||||
$payload = app(ConfigService::class)->attachTradingHoursSettingsPatch($payload);
|
||||
|
||||
$payload['up'] = $this->buildUpDownPrices();
|
||||
$payload['last_historical'] = app(ProductDisplayPriceService::class)->resolveHistoricalBasePrice();
|
||||
|
||||
Reference in New Issue
Block a user