Browse Source

优化最高金额返回

master
wanghongjun 2 years ago
parent
commit
82e364ec47
  1. 8
      app/common/lib/pinyin/PinyinNumber.php

8
app/common/lib/pinyin/PinyinNumber.php

@ -71,11 +71,15 @@ class PinyinNumber
for ($i = 0; $i < $length; $i++) {
$digit = intval($number[$i]);
$lastDigit = $number[$i+1] ?? 0;
if ($digit != 0) {
// 处理万以上的位数
if ($length - $i > 4) {
$chineseStr .= self::$num_pinyin[$digit] . self::$num_unit[$length - $i - 1];
if ($lastDigit > 0) {
$chineseStr .= self::$num_pinyin[$digit];
} else {
$chineseStr .= self::$num_pinyin[$digit] . self::$num_unit[$length - $i - 1];
}
// 处理万位之间的零
if ($digit == 0 && $number[$i + 1] != 0) {
$chineseStr .= '零';

Loading…
Cancel
Save