price changes

This commit is contained in:
2026-06-08 11:40:30 +03:30
parent d0798f4285
commit cda6f13308
+15 -5
View File
@@ -146,6 +146,12 @@ class ReportController extends Controller
return $payload;
}
/** حداقل fallback zaarbox: ۱M تومن = ۱۰M ریال */
private const ZAARBOX_MIN_PLAUSIBLE = 10_000_000;
/** حداکثر fallback zaarbox/مس: ۱۰M تومن = ۱۰۰M ریال */
private const ZAARBOX_MAX_PLAUSIBLE = 100_000_000;
/**
* جلوگیری از fallback به قیمت ذخیره‌شدهٔ نامعتبر (مثلاً طلا ~785M روی پروژه مس).
*/
@@ -162,15 +168,19 @@ class ReportController extends Controller
$min = min($up, $down);
$max = max($up, $down);
if ($storedPrice < $min * 0.25 || $storedPrice > $max * 4) {
return false;
}
// up/down آلوده (مثلاً up=784M و down=23M روی مس) → بازه گشاد اعمال نشود
if ($max <= $min * 10) {
if ($storedPrice < $min * 0.25 || $storedPrice > $max * 4) {
return false;
}
return true;
return true;
}
}
if (in_array($priceProvider, ['zaarbox', 'main_product'], true)) {
return $storedPrice < 100_000_000;
return $storedPrice >= self::ZAARBOX_MIN_PLAUSIBLE
&& $storedPrice <= self::ZAARBOX_MAX_PLAUSIBLE;
}
if ($priceProvider === 'montzar') {