Browse Source

优化显示

master
wanghongjun 2 years ago
parent
commit
a077bc536b
  1. 10
      app/common/lib/pinyin/PinyinNumber.php
  2. 2
      app/model/RechargeRecords.php
  3. 4
      app/model/ZoneGoods.php

10
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 $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 $zh_unit = ['', '十', '百', '千', '万', '十万', '百万', '千万', '亿'];
protected static $num_unit = ['', '0', '00', '千', '万', '0万', '00万', '000万', '亿'];
/** /**
* 获取数字的拼音 * 获取数字的拼音
* @param $number * @param $number
@ -71,18 +75,18 @@ class PinyinNumber
if ($digit != 0) { if ($digit != 0) {
// 处理万以上的位数 // 处理万以上的位数
if ($length - $i > 4) { 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) { if ($digit == 0 && $number[$i + 1] != 0) {
$chineseStr .= '零'; $chineseStr .= '零';
} }
} else { } else {
$chineseStr .= self::$zh_pinyin[$digit] . self::$zh_unit[$length - $i - 1]; $chineseStr .= self::$num_pinyin[$digit] . self::$num_unit[$length - $i - 1];
} }
} else { } else {
// 处理连续的0 // 处理连续的0
if ($i == 0 || $number[$i] != 0) { if ($i == 0 || $number[$i] != 0) {
$chineseStr .= self::$zh_pinyin[$digit]; $chineseStr .= self::$num_pinyin[$digit];
} }
} }
} }

2
app/model/RechargeRecords.php

@ -101,7 +101,7 @@ class RechargeRecords extends Model
// 超出此次充值记录使用金额 // 超出此次充值记录使用金额
if ($target_usage_amount > $recharge_amount) { 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; $incr_next_usage_amount = $usageAmount - $incr_usage_amount;

4
app/model/ZoneGoods.php

@ -22,8 +22,8 @@ class ZoneGoods extends \think\Model
$item['image_url'] = $imageData['image_url']; $item['image_url'] = $imageData['image_url'];
} }
$item['price'] = round($item['price']); $item['price'] = round($item['price']);
#$item['max_awards_amount'] = PinyinNumber::getChinese($item['max_awards_amount'],'元'); $item['max_awards_amount'] = PinyinNumber::getChinese($item['max_awards_amount'],'元');
$item['max_awards_amount'] = round($item['max_awards_amount']); #$item['max_awards_amount'] = round($item['max_awards_amount']);
if ($is_manage) { if ($is_manage) {
unset($item['status']); unset($item['status']);
} }

Loading…
Cancel
Save