From a077bc536b02f3125525af438612bd3efe2fe081 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 24 Nov 2023 10:33:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/lib/pinyin/PinyinNumber.php | 10 +++++++--- app/model/RechargeRecords.php | 2 +- app/model/ZoneGoods.php | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/common/lib/pinyin/PinyinNumber.php b/app/common/lib/pinyin/PinyinNumber.php index 6e20853..a152c0f 100644 --- a/app/common/lib/pinyin/PinyinNumber.php +++ b/app/common/lib/pinyin/PinyinNumber.php @@ -13,8 +13,12 @@ class PinyinNumber protected static $zh_pinyin = [0 => '零', 1 => '一', 2 => '二', 3 => '三', 4 => '四', 5 => '五', 6 => '六', 7 => '七', 8 => '八', 9 => '九']; + protected static $num_pinyin = [0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9']; + protected static $zh_unit = ['', '十', '百', '千', '万', '十万', '百万', '千万', '亿']; + protected static $num_unit = ['', '0', '00', '千', '万', '0万', '00万', '000万', '亿']; + /** * 获取数字的拼音 * @param $number @@ -71,18 +75,18 @@ class PinyinNumber if ($digit != 0) { // 处理万以上的位数 if ($length - $i > 4) { - $chineseStr .= self::$zh_pinyin[$digit] . self::$zh_unit[$length - $i - 1]; + $chineseStr .= self::$num_pinyin[$digit] . self::$num_unit[$length - $i - 1]; // 处理万位之间的零 if ($digit == 0 && $number[$i + 1] != 0) { $chineseStr .= '零'; } } else { - $chineseStr .= self::$zh_pinyin[$digit] . self::$zh_unit[$length - $i - 1]; + $chineseStr .= self::$num_pinyin[$digit] . self::$num_unit[$length - $i - 1]; } } else { // 处理连续的0 if ($i == 0 || $number[$i] != 0) { - $chineseStr .= self::$zh_pinyin[$digit]; + $chineseStr .= self::$num_pinyin[$digit]; } } } diff --git a/app/model/RechargeRecords.php b/app/model/RechargeRecords.php index 686b6ce..226d7bc 100644 --- a/app/model/RechargeRecords.php +++ b/app/model/RechargeRecords.php @@ -101,7 +101,7 @@ class RechargeRecords extends Model // 超出此次充值记录使用金额 if ($target_usage_amount > $recharge_amount) { - $incr_usage_amount = $target_usage_amount - $recharge_amount; + $incr_usage_amount = $recharge_amount - $usage_amount; // 剩余-增加-使用金额 $incr_next_usage_amount = $usageAmount - $incr_usage_amount; diff --git a/app/model/ZoneGoods.php b/app/model/ZoneGoods.php index 6f38b21..2cbbddc 100644 --- a/app/model/ZoneGoods.php +++ b/app/model/ZoneGoods.php @@ -22,8 +22,8 @@ class ZoneGoods extends \think\Model $item['image_url'] = $imageData['image_url']; } $item['price'] = round($item['price']); - #$item['max_awards_amount'] = PinyinNumber::getChinese($item['max_awards_amount'],'元'); - $item['max_awards_amount'] = round($item['max_awards_amount']); + $item['max_awards_amount'] = PinyinNumber::getChinese($item['max_awards_amount'],'元'); + #$item['max_awards_amount'] = round($item['max_awards_amount']); if ($is_manage) { unset($item['status']); }