fix price

This commit is contained in:
2026-06-29 02:11:36 +03:30
parent 8fa3df94ca
commit b0dacc2423
+12 -3
View File
@@ -599,8 +599,10 @@ class ConfigService
/**
* ساعت معامله یک محصول:
* - اگر سوییچ override محصول روشن باشد → فقط بازه خود محصول حاکم است (سراسری نادیده گرفته می‌شود).
* - در غیر این صورت → فیلتر سراسری close_price + startDay/endDay اعمال می‌شود.
* - اگر سوییچ override محصول روشن باشد → فقط بازه اختصاصی خود محصول حاکم است (سراسری نادیده گرفته می‌شود).
* - اگر خاموش باشد → لایهٔ بیرونیِ ساعت کاری محصول (auto_open_at/auto_close_at) همیشه اعمال می‌شود،
* مستقل از اینکه close_price روشن باشد یا نه.
* - فقط اگر محصول هیچ بازهٔ معتبری نداشته باشد → فیلتر سراسری close_price + startDay/endDay اعمال می‌شود.
*/
public function isProductWithinTradingHours(Product $product, ?Carbon $now = null): bool
{
@@ -608,6 +610,10 @@ class ConfigService
return $this->isWithinTimeWindow($product->auto_open_at, $product->auto_close_at, $now);
}
if ($this->hasProductTradingWindow($product->auto_open_at, $product->auto_close_at)) {
return $this->isWithinTimeWindow($product->auto_open_at, $product->auto_close_at, $now);
}
if ($this->isClosePriceEnabled() && $this->isOutsideTradingHours($now)) {
return false;
}
@@ -619,7 +625,10 @@ class ConfigService
{
$title = trim((string) ($product->title ?? 'محصول'));
if ($this->productOverridesTradingHours($product)) {
if (
$this->productOverridesTradingHours($product)
|| $this->hasProductTradingWindow($product->auto_open_at, $product->auto_close_at)
) {
$open = $this->formatProductTime($product->auto_open_at);
$close = $this->formatProductTime($product->auto_close_at);