fix title

This commit is contained in:
2026-08-03 11:51:16 +03:30
parent ec0fd28efc
commit d360539208
14 changed files with 286 additions and 53 deletions
+64
View File
@@ -345,6 +345,70 @@ class Controller extends BaseController
return 'برداشت ریالی';
}
/** شرح سند حسابداری برای واریز کیف (ریال/طلا) — پرگار، ته‌حساب، زرین */
public static function accountingDepositDesc(?string $note = null): string
{
return self::normalizeAccountingWalletNote($note, true);
}
/** شرح سند حسابداری برای برداشت کیف (ریال/طلا) — پرگار، ته‌حساب، زرین */
public static function accountingWithdrawDesc(?string $note = null): string
{
return self::normalizeAccountingWalletNote($note, false);
}
public static function accountingWalletDesc(bool $isDeposit, ?string $note = null): string
{
return $isDeposit
? self::accountingDepositDesc($note)
: self::accountingWithdrawDesc($note);
}
/**
* شرح سند کیف: پیش‌فرض «واریز»/«برداشت»؛
* note خاص (مثل پاداش معرفی یا توضیح ادمین) حفظ می‌شود؛
* عناوین عمومی واریز/برداشت/شارژ به همان دو کلمه نرمال می‌شوند.
*/
public static function normalizeAccountingWalletNote(?string $note, bool $isDeposit): string
{
$note = trim((string) $note);
if ($note === '') {
return $isDeposit ? 'واریز' : 'برداشت';
}
if (in_array($note, self::accountingReferralRewardDescAliases(), true)) {
return self::accountingReferralRewardDesc();
}
$generic = [
'واریز', 'برداشت',
'واریز ریالی', 'برداشت ریالی',
'واریز طلایی', 'برداشت طلایی',
'واریز درگاه', 'واریز آنلاین',
'واریز به کیف پول', 'برداشت از کیف پول',
'شارژ حساب', 'برداشت از حساب',
'شارژ', 'دشارژ',
'شارژ طلای کیف اصلی', 'برداشت طلای کیف اصلی',
];
if (in_array($note, $generic, true)) {
return $isDeposit ? 'واریز' : 'برداشت';
}
return $note;
}
/** شرح سند پاداش معرف — باید عین همین متن در همهٔ حسابداری‌ها برود */
public static function accountingReferralRewardDesc(): string
{
return 'پاداش معرفی';
}
/** عناوین قدیمی پاداش معرف برای idempotency / تشخیص دادهٔ قبلی */
public static function accountingReferralRewardDescAliases(): array
{
return ['پاداش معرفی', 'پاداش بابت معرفی'];
}
/**
* type و title تراکنش ریالی — بر اساس علامت cash (داده‌های قدیمی گاهی type=4 با cash مثبت دارند).
*/