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:
2026-08-25 02:29:00 +03:30
co-authored by Cursor
parent 4562d00bd3
commit 8984899042
10 changed files with 300 additions and 44 deletions
+27 -6
View File
@@ -45,12 +45,7 @@ class LivePriceCacheService
return $cachedBody;
}
Cache::put(self::FULL_RESPONSE_KEY, [
'body' => $body,
'stored_at' => now(),
], now()->addSeconds(self::TTL_SECONDS + 5));
app(ProductDisplayPriceService::class)->cacheLivePricePayload($body);
$this->storeBody($body);
app(PriceBroadcastService::class)->broadcastLastIfChanged($body);
@@ -59,6 +54,32 @@ class LivePriceCacheService
return $body;
}
/**
* بازنویسی کش last بدون گیت هویت — برای اعمال فوری ساعت کاری.
*
* @param array<string, mixed> $body
* @return array<string, mixed>
*/
public function replaceBody(array $body): array
{
$this->storeBody($body);
return $body;
}
/**
* @param array<string, mixed> $body
*/
private function storeBody(array $body): void
{
Cache::put(self::FULL_RESPONSE_KEY, [
'body' => $body,
'stored_at' => now(),
], now()->addSeconds(self::TTL_SECONDS + 5));
app(ProductDisplayPriceService::class)->cacheLivePricePayload($body);
}
public function markTick(): void
{
Cache::put(self::LAST_TICK_KEY, now(), now()->addMinutes(10));