示例#1
0
 /**
  * 获得省份信息
  */
 public static function getProvince()
 {
     $data = API_Item_Pro_Area::getProvinceInfo(array('areaId' => 1));
     if ($data) {
         $data[28] = '香港';
         $data[29] = '澳门';
         $data[9] = '内蒙古';
         unset($data[150]);
         //去掉其他
     }
     return $data;
 }
示例#2
0
 /**
  * 获得省份信息,封装成select层的形式
  */
 public static function getCitySelect($paramArr)
 {
     $options = array('provinceId' => 0, 'type' => 1, 'sel' => false);
     if (is_array($paramArr)) {
         $options = array_merge($options, $paramArr);
     }
     extract($options);
     #获得城市信息
     if ($provinceId) {
         $data = API_Item_Pro_Area::getCityInfo(array('provinceId' => $provinceId));
     }
     if (!$provinceId || !$data) {
         $data = array(0 => '请选择');
     }
     #封装返回
     return self::transFirstLetterArr(array('data' => $data, 'type' => $type, 'sel' => $sel));
 }
示例#3
0
文件: Url.php 项目: dalinhuang/andyou
 /**
  * 获取列表页链接
  * @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;
 }