Authored by 梁志锋

日志处理优化

... ... @@ -109,7 +109,7 @@ class HelperSearch
/**
* 将接口返回的数据($data)组合成模板需要的格式
*
*
* @param array $data array(
* 'product' => array (接口得到的商品数据)
* 'sort' => array (接口返回的分类数据)
... ... @@ -131,11 +131,11 @@ class HelperSearch
self::$options = $options;
$result = array();
self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
//当前页
$result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
self::$page = $result['page'];
//产品列表
$result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options) : array();
//总页数
... ... @@ -184,7 +184,7 @@ class HelperSearch
if (empty($shopSort)) {
continue;
}
$result['shopEntry'][] = $shopSort;
$result['shopEntry'][] = $shopSort;
}
}
//分页
... ... @@ -319,7 +319,7 @@ class HelperSearch
$isNew = false;
$isSale = false;
}
if (isset($options['isNew']) && $options['isNew']) {
$isNew = true;
}
... ... @@ -1457,7 +1457,7 @@ class HelperSearch
if (self::$total == 0) {
return $shopEntry;
}
if (empty($shopSort)) {
$shopSort = array();
}
... ... @@ -1744,14 +1744,17 @@ class HelperSearch
*/
public static function pinYin($zh){
$ret = "";
if(mb_detect_encoding($zh, array('GB2312','GBK','UTF-8'))!='UTF-8'){
$zh = '';
}
@$s1 = iconv("UTF-8","gbk//ignore", $zh);
@$s2 = iconv("gbk//ignore","UTF-8", $s1);
if($s2 == $zh){$zh = $s1;}
for($i = 0; $i < strlen($zh); $i++){
$s1 = substr($zh,$i,1);
$s1 = mb_substr($zh,$i,1);
$p = ord($s1);
if($p > 160){
$s2 = substr($zh,$i++,2);
$s2 = mb_substr($zh,$i++,2);
$ret .= self::getfirstchar($s2);
}else{
$ret .= $s1;
... ... @@ -1771,6 +1774,10 @@ class HelperSearch
if ($fchar >= ord("A") and $fchar <= ord("z") ) {
return strtoupper($s0{0});
}
if(mb_detect_encoding($s0, array('GB2312','GBK','UTF-8'))!='UTF-8') {
return '';
}
$s1 = @iconv("UTF-8","gbk//ignore", $s0);
$s2 = @iconv("gbk//ignore","UTF-8", $s1);
if ($s2 == $s0) {
... ...