Beispiel #1
0
 /**
  * 获取列表页链接
  * @param array 数组参数
  */
 public static function getListShortUrl($paramArr)
 {
     $options = array('subcateId' => 0, 'subcateEnName' => 0, 'enManu' => '', 'priceId' => 'noPrice', 'paramVal' => '', 'enQuery' => '', 'enStyle' => '', 'enLocation' => '', 'keyword' => '', 'page' => 1, 'rewrite' => 1, 'isHistory' => 0, 'appendParam' => 0);
     if (is_array($paramArr)) {
         $options = array_merge($options, $paramArr);
     }
     extract($options);
     if ($appendParam && is_array($appendParam)) {
         #兼容旧代码参数处理,相关文件较多怕有遗漏所以程序处理
         extract($appendParam);
         $paramVal = is_array($paramVal) ? implode('-', $paramVal) : $paramVal;
     }
     $subcateEnName = strtolower($subcateEnName);
     $enManu = str_replace(chr(32), '', $enManu);
     if (!$enManu && isset($paramArr['manuId']) && $manuId) {
         #查询顺序 $enManuArr > helper > 数据库
         static $enManuArr = array();
         if (!$enManuArr) {
             $enManuArr = API_Item_Pro_List::getManuArr(array('subcateId' => $subcateId));
         }
         if (!isset($enManuArr[$manuId])) {
             $Db_Product = API_Db_Product::instance();
             $sql = "select en_name from manufacturer where id={$manuId}";
             $enManuArr[$manuId]['enManu'] = $Db_Product->getOne($sql);
         }
         $enManu = str_replace(chr(32), '', $enManuArr[$manuId]['enManu']);
     }
     if (!$enLocation && isset($paramArr['locationId']) && $locationId) {
         #查询顺序 $enLocationArr > helper > 数据库
         static $enLocationArr = array();
         if (!isset($enLocationArr[$locationId])) {
             $arr = API_Item_Pro_Area::getLocationInfo(array('locationId' => $locationId));
             if (isset($arr['enName']) && $arr['enName']) {
                 $enLocationArr[$locationId] = $arr['enName'];
             } else {
                 $Db_Product = API_Db_Product::instance();
                 $sql = "select en_name from merchant_recommend_channel where base_url={$locationId}";
                 $enLocationArr[$locationId] = $Db_Product->getOne($sql);
             }
         }
         $enLocation = $enLocationArr[$locationId];
     }
     $subEnName = $isHistory ? $subcateEnName . '/history/' : $subcateEnName . '/';
     if (!$rewrite) {
         #未改
         $url = '/index.php?c=List&subcateId=' . $subcateId;
         $url .= $manuId ? '&manuId=' . $manuId : '';
         if (is_array($appendParam)) {
             $url .= '&' . http_build_query($appendParam);
         } else {
             if ($appendParam) {
                 $url .= '&' . $appendParam;
             }
         }
         return $url;
     } else {
         $urlManu = $enManu ? strtolower($enManu) . '/' : '';
         #品牌
         $urlPrice = 'noPrice' !== $priceId ? $paramVal ? $priceId . '_' : $priceId . '/' : '';
         #价格
         $urlParam = $paramVal ? str_replace('-', '_', $paramVal) . '/' : '';
         #复合参数
         $urlQuery = $enQuery ? $enQuery : '';
         #排序
         $urlStyle = $enStyle ? $enQuery ? '_' . $enStyle : $enStyle : '';
         #列表显示形式
         $urlLocation = $enLocation ? $enLocation . '/' : '';
         #地区
         $urlPage = $page != 1 ? $enQuery || $enStyle ? '_' . $page : $page : '';
         #页码
         $urlkword = '{keyword}' != $keyword ? str_replace('%', '@', ZOL_String::escape($keyword)) : $keyword;
         #关键字
         $url = '/' . $subEnName . $urlManu . $urlPrice . $urlParam . $urlLocation . $urlQuery . $urlStyle . $urlPage;
         if ($urlQuery || $urlStyle || $urlPage) {
             $url .= '.html';
         }
         if ($urlkword) {
             $url .= "?k={$urlkword}";
         }
     }
     return $url;
 }
Beispiel #2
0
 /**
  * 获取有帮助的相关用户数据
  */
 public static function getHelpUserInfo($reviewId)
 {
     $dbProduct = API_Db_Product::instance();
     $haveHelpSql = "select user_id from review_vote where rev_id=" . $reviewId . " order by user_id desc limit 40";
     $haveHelpArr = $dbProduct->getAll($haveHelpSql);
     $haveHelpAllUserInfo = array();
     if ($haveHelpArr) {
         #批量获得用户的信息
         $haveHelpUserIdArr = array();
         #存储用户的ID
         $haveHelpUserIdArr_ = array();
         #存储用户的ID
         $haveHelpUserIdArr_t = array();
         #存储用户的ID
         foreach ($haveHelpArr as $d) {
             if ($d['user_id']) {
                 $haveHelpUserIdArr[] = $d['user_id'];
             }
         }
         $haveHelpAllUserInfo = API_Libs_Global_User::getMulUserInfo($haveHelpUserIdArr);
     }
     if (!$haveHelpAllUserInfo) {
         return FALSE;
     }
     foreach ($haveHelpAllUserInfo as $id => $vals) {
         if ($vals['face'] != "http://icon.zol-img.com.cn/photo/zoler_50.jpg") {
             $haveHelpUserIdArr_[$id]['face'] = $vals['face'];
             $haveHelpUserIdArr_[$id]['url'] = Libs_Global_Url::getMyUrl(array('userId' => $vals['userid']));
             $haveHelpUserIdArr_[$id]['userId'] = $vals['userid'];
         } else {
             $haveHelpUserIdArr_t[$id]['face'] = "http://icon.zol-img.com.cn/photo/zoler_50.jpg";
             $haveHelpUserIdArr_t[$id]['url'] = Libs_Global_Url::getMyUrl(array('userId' => $vals['userid']));
             $haveHelpUserIdArr_t[$id]['userId'] = $vals['userid'];
         }
     }
     return $haveHelpUserIdArr_ + $haveHelpUserIdArr_t;
 }