khanegi setting and prices records

This commit is contained in:
2026-06-13 17:35:40 +03:30
parent c70cda0b6b
commit 91a82c06e4
15 changed files with 509 additions and 73 deletions
@@ -175,15 +175,12 @@ class ProductController extends SuperController
return response()->json($products);
}
// آبشده خانگی — ادمین: sync از کش؛ کاربر: enrich بدون UPDATE
if (! str_contains(request()->path(), '/customer/')) {
app(ProductPriceSyncService::class)->syncAll(false);
}
// آبشده خانگی — کران قیمت را آپدیت می‌کند؛ list فقط از DB می‌خواند
$products = Product::with(['file'])->where('active', 1)->get();
if (str_contains(request()->path(), '/customer/')) {
$displayPriceService = app(ProductDisplayPriceService::class);
$displayPriceService->warmLivePriceCache();
$displayPriceService->enrichForApi($products);
$products->each(function (Product $product) use ($displayPriceService) {
if (! $displayPriceService->hasCustomerDisplayPrice($product)) {