fix channel price bug

This commit is contained in:
2026-07-07 18:34:03 +03:30
parent 32c21ed951
commit fcc2181679
@@ -24,7 +24,7 @@ class PriceChannelBroadcastService
private const SUPPORTED_MESSENGERS = ['bale', 'telegram', 'rubika']; private const SUPPORTED_MESSENGERS = ['bale', 'telegram', 'rubika'];
/** مثقال بازار آبشده (گرم) — وقتی تنظیم change_mesghal خالی باشد */ /** وزن هر مثقال به گرم — ضریب تبدیل قیمت هر گرم به هر مثقال (مثقال = گرم × این عدد) */
private const DEFAULT_CHANGE_MESGHAL = 4.3318; private const DEFAULT_CHANGE_MESGHAL = 4.3318;
public function __construct(private readonly ConfigService $config) public function __construct(private readonly ConfigService $config)
@@ -256,8 +256,9 @@ class PriceChannelBroadcastService
$lines[] = '🔴 خرید ' . $this->formatPrice($low) . ' 🟢 فروش ' . $this->formatPrice($high); $lines[] = '🔴 خرید ' . $this->formatPrice($low) . ' 🟢 فروش ' . $this->formatPrice($high);
if ($this->isGramUnit($product) && $mesghal > 0) { if ($this->isGramUnit($product) && $mesghal > 0) {
$lines[] = '💰 هر گرم: ' . $this->formatPrice($low / $mesghal) // قیمت پایه «هر گرم» است؛ مثقال = گرم × ضریب (کنوانسیون اپ: مثقال = گرم × 4.3318)
. ' / ' . $this->formatPrice($high / $mesghal); $lines[] = '💰 هر مثقال: ' . $this->formatPrice($low * $mesghal)
. ' / ' . $this->formatPrice($high * $mesghal);
} }
$lines[] = ''; $lines[] = '';