fix some issu

This commit is contained in:
2026-08-26 21:47:09 +03:30
parent 74cc50149f
commit 40b185187c
14 changed files with 179 additions and 72 deletions
@@ -52,7 +52,12 @@ class PriceStreamController extends Controller
}
$cache = app(LivePriceCacheService::class);
$last = $cache->get() ?? $cache->buildFromDatabase();
$config = app(\App\Services\ConfigService::class);
$last = $cache->get();
// کش ممکن است no_quote صفرِ کوتاه‌عمر داشته باشد؛ با build از montzar_live_price جبران کن
if (! is_array($last) || ! $config->payloadHasDisplayablePrice($last)) {
$last = $cache->buildFromDatabase();
}
if (is_array($last) && $last !== []) {
if ($customerId > 0) {
$last = app(\App\Services\CustomerSpecialPricingService::class)
+8 -11
View File
@@ -327,19 +327,19 @@ class ReportController extends Controller
$config->UpdateConfig('montzar_closed', 'false');
} catch (\Throwable $e) {
$montzarLivePrice = 0;
\Log::error('MONZAR PRICE ERROR', [
'message' => $e->getMessage(),
'montzar_product_id' => $montzarProductId ?? null,
'montzar_response' => $montzar ?? null,
]);
// قطع لحظه‌ای همکار → قیمت ذخیره‌شده را نگه دار و دوباره در تیک بعدی تلاش کن
$config->applyMontzarSyncFailure();
if (!$config->getBool('montzar_closed', true)) {
$stale = $config->getInt('montzar_live_price', 0);
$montzarLivePrice = $config->isPlausibleQuotePrice((float) $stale) ? $stale : 0;
}
$stale = $config->getInt('montzar_live_price', 0);
$montzarLivePrice = $config->isPlausibleQuotePrice((float) $stale) ? $stale : 0;
$montzarFlags = $config->montzarOpenFlags();
$montzar_open_buy = $montzarFlags['open_buy'];
$montzar_open_sell = $montzarFlags['open_sell'];
}
}
@@ -584,12 +584,9 @@ class ReportController extends Controller
$config->UpdateConfig('montzar_closed', 'false');
} catch (\Throwable $e) {
$montzar = 0;
$config->applyMontzarSyncFailure();
if (!$config->getBool('montzar_closed', true)) {
$stale = $config->getInt('montzar_live_price', 0);
$montzar = $config->isPlausibleQuotePrice((float) $stale) ? $stale : 0;
}
$stale = $config->getInt('montzar_live_price', 0);
$montzar = $config->isPlausibleQuotePrice((float) $stale) ? $stale : 0;
\Log::error('STORE MONZAR PRICE ERROR', ['message' => $e->getMessage()]);
}
}