Authored by whb

冲突问题

@@ -189,8 +189,8 @@ class Helpers @@ -189,8 +189,8 @@ class Helpers
189 * @return float|string 转换之后的价格 189 * @return float|string 转换之后的价格
190 */ 190 */
191 public static function transPrice($price) 191 public static function transPrice($price)
192 - {  
193 - return number_format($price, 2, '.', ''); 192 + {
  193 + return !empty($price) ? number_format($price, 2, '.', '') : 0;
194 } 194 }
195 195
196 /** 196 /**
@@ -806,13 +806,13 @@ class Helpers @@ -806,13 +806,13 @@ class Helpers
806 * @return string 806 * @return string
807 */ 807 */
808 public static function getClientIp() 808 public static function getClientIp()
809 - {  
810 - $ip = '0.0.0.0';  
811 - if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != '')  
812 - $ip = $_SERVER['HTTP_CLIENT_IP'];  
813 - elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '')  
814 - $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];  
815 - elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '') 809 + {
  810 + $ip = '0.0.0.0';
  811 + if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != '')
  812 + $ip = $_SERVER['HTTP_CLIENT_IP'];
  813 + elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '')
  814 + $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
  815 + elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '')
816 $ip = $_SERVER['REMOTE_ADDR']; 816 $ip = $_SERVER['REMOTE_ADDR'];
817 return $ip; 817 return $ip;
818 } 818 }