fixed provider price 2

This commit is contained in:
2026-06-27 11:29:09 +03:30
parent 6e9a5b5baa
commit 37a54e0764
4 changed files with 168 additions and 5 deletions
+8 -4
View File
@@ -9,10 +9,10 @@ use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
/**
* قیمت نمایشی محصولات برای API — فقط از کش/تنظیمات (بدون HTTP روی list).
* قیمت نمایشی محصولات برای API.
*
* • آبشده با «قیمت اپ» → montzar_live_price / کش /api/price/last
* • محصول با reading_method → ردیف فید zaarbox از کش کران (۳۰ث)
* • محصول با reading_method → فید zaarbox (کش ۱۵ث + fetch روی cache miss)
*/
class ProductDisplayPriceService
{
@@ -51,12 +51,16 @@ class ProductDisplayPriceService
/**
* پر کردن price روی مدل‌ها برای پاسخ JSON — بدون UPDATE دیتابیس
*/
/** پر کردن کش مظنه اگر خالی باشد (قبل از enrich لیست مشتری) */
/** پر کردن کش مظنه و فید zaarbox اگر خالی باشند (قبل از enrich لیست مشتری) */
public function warmLivePriceCache(): void
{
if (! is_array(Cache::get(self::LIVE_PRICE_CACHE_KEY))) {
$this->resolveFallbackPayload();
}
if (! app(ConfigService::class)->isStore()) {
app(ZaarboxPriceService::class)->cachedPriceList(false);
}
}
public function enrichForApi(Collection|iterable $products): void
@@ -438,7 +442,7 @@ class ProductDisplayPriceService
return 0;
}
$feed = app(ZaarboxPriceService::class)->getCachedPriceListOnly();
$feed = app(ZaarboxPriceService::class)->cachedPriceList(false);
if (!is_array($feed)) {
return 0;
}