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
+12 -1
View File
@@ -67,7 +67,17 @@ class Controller extends BaseController
return number_format(abs((float) $value), 0, '.', ',');
}
/** وزن طلا در پیامک — تا ۳ رقم اعشار، بدون گرد کردن به صفر برای زیر ۱ گرم */
/** اصلاح عبارت «گرم» به «کیلوگرم» در متن تمامی پیامک‌های پروژه */
public static function normalizeSmsWeightUnit(string $message): string
{
return preg_replace(
'/(?<![\p{L}\p{N}]|کیلو|کیلو\x{200c})گرم(?=[ی\s\n\r:،.,!؟\(\)\[\]\/\-–—]|$)/u',
'کیلو$0',
$message
) ?? $message;
}
/** وزن طلا در پیامک — تا ۳ رقم اعشار، بدون گرد کردن به صفر برای زیر ۱ کیلوگرم */
public static function formatSmsGoldWeight(float|int|string $value): string
{
$formatted = rtrim(rtrim(number_format(abs((float) $value), 3, '.', ''), '0'), '.');
@@ -141,6 +151,7 @@ class Controller extends BaseController
public static function SendMessage($to, $msg ,$is_send = false,$force_method ='null')
{
$msg = self::normalizeSmsWeightUnit((string) $msg);
$credentials = [
"telegram" => [
"token" => self::Config('telegram_bot_token')