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
@@ -45,7 +45,7 @@ class PriceStreamController extends Controller
$send('last', $last);
}
$list = app(PriceBroadcastService::class)->buildListPayload(true);
$list = app(PriceBroadcastService::class)->buildListPayload(false);
if (is_array($list) && $list !== []) {
$send('list', $list);
}
+1
View File
@@ -169,6 +169,7 @@ class PriceBroadcastService
'price_profit' => (int) ($product['price_profit'] ?? 0),
'show' => (bool) ($product['show'] ?? true),
'active' => (bool) ($product['active'] ?? true),
'reference_provider_active' => (bool) ($product['reference_provider_active'] ?? false),
];
}
+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;
}