fix bugs
This commit is contained in:
@@ -512,29 +512,6 @@ class ProductController extends SuperController
|
||||
|
||||
}
|
||||
|
||||
/** فروشگاه — نمایش در اپ کاربر: فعال + ساعات + قیمت ذخیرهشده یا محصول وزنی */
|
||||
private function storeProductShowForCustomer(Product $product): bool
|
||||
{
|
||||
if (! $product->active) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! app(ConfigService::class)->isProductWithinTradingHours($product)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$storedPrice = (int) ($product->price ?? 0) + (int) ($product->price_profit ?? 0);
|
||||
if ($storedPrice > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((int) ($product->direct_price ?? 0) === 0 && (float) ($product->amount ?? 0) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function isCustomerApiRequest(): bool
|
||||
{
|
||||
$path = trim((string) request()->path(), '/');
|
||||
@@ -569,14 +546,7 @@ class ProductController extends SuperController
|
||||
return;
|
||||
}
|
||||
|
||||
if (app(ConfigService::class)->isStore()) {
|
||||
$products->each(function (Product $product) {
|
||||
$product->setAttribute('show', $this->storeProductShowForCustomer($product));
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// فروشگاه و خانگی: همان enrich قیمت لحظهای (آبشده/قیمت اپ/مرجع) — بدون UPDATE دیتابیس
|
||||
$displayPriceService = app(ProductDisplayPriceService::class);
|
||||
$displayPriceService->warmLivePriceCache();
|
||||
$displayPriceService->enrichForApi($products);
|
||||
@@ -592,7 +562,7 @@ class ProductController extends SuperController
|
||||
*/
|
||||
private function enrichAdminTablePrices($rows): void
|
||||
{
|
||||
if ($rows === null || app(ConfigService::class)->isStore()) {
|
||||
if ($rows === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user