fix price
This commit is contained in:
@@ -129,7 +129,10 @@ class ReportController extends Controller
|
||||
app(ProductDisplayPriceService::class)->cacheLivePricePayload($payload);
|
||||
|
||||
if ($saveFullCache || request()->boolean('force_refresh')) {
|
||||
return app(LivePriceCacheService::class)->put($payload);
|
||||
$cache = app(LivePriceCacheService::class);
|
||||
$cache->markTick();
|
||||
|
||||
return $cache->put($payload);
|
||||
}
|
||||
|
||||
return $payload;
|
||||
@@ -147,9 +150,12 @@ class ReportController extends Controller
|
||||
return $cached;
|
||||
}
|
||||
|
||||
$dbBuilt = $cache->buildFromDatabase();
|
||||
if (($dbBuilt['price'] ?? 0) > 0) {
|
||||
return $cache->put($dbBuilt);
|
||||
// فقط وقتی کران اخیراً tick زده — وگرنه API زنده (جلوگیری از قفل قیمت)
|
||||
if ($cache->hasRecentTick()) {
|
||||
$dbBuilt = $cache->buildFromDatabase();
|
||||
if (($dbBuilt['price'] ?? 0) > 0) {
|
||||
return $cache->put($dbBuilt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user