feat: update sms units to kilogram transactions notes price source label and trading closed message

This commit is contained in:
2026-11-18 18:25:34 +03:30
parent 0004192cbc
commit 3ce2c48438
19 changed files with 382 additions and 49 deletions
+54
View File
@@ -162,6 +162,60 @@ class ZaarboxPriceService
));
}
/**
* عنوان نمایشی منبع قیمت زنده — استخراج پویا از ردیف مرجع در فید تابلو
*/
public function priceSourceTitle(): string
{
$feed = $this->cachedPriceList(false);
if (is_array($feed)) {
// ۱. بررسی ردیف تنظیم‌شده به عنوان مرجع قیمت (zaarbox_price_key)
$identifier = $this->priceIdentifier();
if ($identifier !== '') {
$row = $this->findFeedRow($feed, $identifier);
if (!empty($row['name'])) {
return $this->formatFeedRowSourceName((string) $row['name']);
}
}
// ۲. بررسی reading_method محصول اصلی کیف یا کاتد مس
$mainProduct = $this->config->mainProduct();
if ($mainProduct && !empty($mainProduct->reading_method)) {
$row = $this->findFeedRow($feed, (string) $mainProduct->reading_method);
if (!empty($row['name'])) {
return $this->formatFeedRowSourceName((string) $row['name']);
}
}
// ۳. جستجوی کلیدهای شناخته‌شده گواهی کاتد مس در فید
foreach (['ime_copper_cthd', '8c19e06a-446e-3d56-9cc0-750f7c6cd767'] as $key) {
$row = $this->findFeedRow($feed, $key);
if (!empty($row['name'])) {
return $this->formatFeedRowSourceName((string) $row['name']);
}
}
}
// ۴. انطباق با نوع فلز سیستم
$metalLabel = \App\Http\Controllers\Controller::mainWalletProductLabel();
if ($metalLabel && !in_array($metalLabel, ['طلا', 'آبشده'], true)) {
return 'گواهی سپرده ' . $metalLabel;
}
return 'گواهی سپرده کاتد';
}
private function formatFeedRowSourceName(string $rawName): string
{
$name = trim($rawName);
if (str_contains($name, 'گواهی سپرده') && str_contains($name, 'کاتد')) {
return 'گواهی سپرده کاتد';
}
return $name;
}
/**
* UUID سری نمودار: settings.chart_id؛ وگرنه پیش‌فرض گلد علی.
* GET https://price.zaarbox.ir/api/history/{id}