public static function chooseCenter2014($array) { global $DB_Product_Read; //品牌 各频道对应手工ID $manuArr = array(180 => '15882', 195 => '932', 168 => '11761', 206 => '3854', 210 => '15380', 212 => '1045', 165 => '16260', 63 => '5318', 196 => '5745', 145 => '15302', 76 => '1188', 74 => '14962', 106 => '2117', 199 => '6260', 230 => '8206', 193 => '912', 188 => '1143', 194 => '2451', 238 => '9311', 227 => '10267', 265 => '12496', 129 => '1003', 132 => '1217', 272 => '13328', 282 => '14602', 289 => '15598', 303 => '12682'); $manuArr2 = array(74 => '1136', 168 => '946', 210 => '864', 180 => '745', 165 => '16348', 145 => '891'); //最后一参数 各频道对应手工ID $styleArr = array(74 => '12409', 257 => '12409', 210 => '6898', 145 => '4855', 212 => '12419', 272 => '13330', 230 => '12420', 206 => '5060', 195 => '4981', 164 => '6627', 168 => '974', 63 => '1742', 193 => '5590', 265 => '12494', 165 => '1215', 180 => '5262', 194 => '4976', 76 => '1195', 62 => '994', 238 => '12424', 188 => '4945', 196 => '5736', 132 => '3389', 129 => '3270'); $str = ''; $classId = $array['classId']; $subcat_id = $array['subcatid']; $relcat_id = $array['relcatid']; $sub_id_str = ''; if ($subcat_id) { $sub_id_str .= $subcat_id; if ($relcat_id) { $sub_id_str .= ',' . $relcat_id; } } if ($sub_id_str) { $sub_arr = array_unique(explode(',', $sub_id_str)); $sub_i = 1; $sub_icnt = count($sub_arr); foreach ($sub_arr as $subcatId) { if ($subcatId) { //获得产品线名称 $sql = 'select name from subcategory where id=' . $subcatId; $subName = $DB_Product_Read->get_var($sql); //获得产品线英文名 $sql = 'select brief from subcategory_extra_info where subcategory_id=' . $subcatId; $subEName = trim($DB_Product_Read->get_var($sql)); $sub_url = get_price_url($subcatId); //获得品牌 $manuStr = ""; if ($manuArr[$classId]) { //读取手工的 $limit = 17; if (132 == $classId) { $limit = 18; } //服务器频道 多读 $paramArr = array('moduleids' => $manuArr[$classId], 'orderby' => 'order by date desc', 'limit' => 'limit 0,' . $limit); $rows = PageHelper::getModuleArt($paramArr); if ($rows) { foreach ($rows as $row) { //填写的链接地址不是品牌专区 if (strpos(false === $row["url"], 'manu_')) { $manuUrl = $row["url"]; } else { $endStr = explode("_", $row["url"]); $tmpManuId = substr($endStr[1], 0, -6); $tmpSubId = is_numeric($row["digest"]) ? intval($row["digest"]) : $subcatId; if ($tmpSubId == $subcat_id) { $manuUrl = get_price_url($tmpSubId, $tmpManuId); } else { $manuUrl = $row["url"]; } } $manuStr .= '<a href="' . $manuUrl . '">' . $row["title"] . '</a>'; } } //手机频道多取一个手工,国产,手工内容链接指向品牌专区需处理指向产品库 if ($manuArr2[$classId]) { $paramArr = array('moduleids' => $manuArr2[$classId], 'orderby' => 'order by date desc', 'limit' => 'limit 0,' . ($limit - count($rows))); $rows = PageHelper::getModuleArt($paramArr); if ($rows) { foreach ($rows as $row) { //填写的链接地址不是品牌专区 if (strpos(false === $row["url"], 'manu_')) { $manuUrl = $row["url"]; } else { $endStr = explode("_", $row["url"]); $tmpManuId = substr($endStr[1], 0, -6); $tmpSubId = is_int($row["digest"]) ? intval($row["digest"]) : $subcatId; $manuUrl = get_price_url($tmpSubId, $tmpManuId); } $manuStr .= '<a href="' . $manuUrl . '">' . $row["title"] . '</a>'; } } } } else { //自动读取 $paramArr = array('sub_id' => $subcatId, 'orderby' => 3, 'limit' => 'limit 0,15'); $rows = PageHelper::getManuList($paramArr); if ($rows) { foreach ($rows as $row) { $manuStr .= '<a href="' . $row["proListUrl"] . '">' . $row["showName"] . '</a>'; } } } //获得价格区间 $priceStr = ''; $rows = PageHelper::getProductPriceRank($subcatId); if ($rows) { foreach ($rows as $row) { $priceStr .= '<a href="' . $row["url"] . '">' . $row["btwn_name_yuan"] . '</a>'; } } //获取最后一参数 $styleStr = ''; $lastStyle = ''; $rows = PageHelper::getProductParamArr($subcatId, 2, 0, 0, 0, 0, 1); if ($rows) { $i = 0; $icnt = count($rows[0]); foreach ($rows[0] as $param_id => $param_info) { $i++; if ($icnt == $i) { $class = ' lastdl'; } else { $class = ''; } $styleStr .= '<div class="param-item">'; $styleStr .= ' <strong>' . $param_info["name"] . '</strong>'; $styleStr .= '<div class="param-links">'; $j = 0; foreach ($rows[1][$param_id] as $key => $val) { $styleStr .= '<a href="' . $rows[2][$param_id][$key] . '">' . $val . '</a>'; $j++; } $styleStr .= '</div></div>'; } } else { $lastStyle = ' lastdl'; } if ($sub_icnt > 1) { if (1 == $sub_i) { $str .= '<!--#if expr="$sub_id=' . $subcatId . '" -->'; } else { if ($sub_icnt == $sub_i) { $str .= '<!--#else -->'; } else { $str .= '<!--#elif expr="$sub_id=' . $subcatId . '" -->'; } } } $fastUp = 641 != $subcatId && 702 != $subcatId ? '<a class="fast-phone" href="http://top.zol.com.cn/compositor/' . $subcatId . '/hit_wave.html">上升最快的' . $subName . '</a>' : ''; $str .= ' <div class="section-head clearfix"> <div class="links"><a class="all-phone" href="http://top.zol.com.cn/compositor/' . $subcatId . '/' . $subEName . '.html">' . $subName . '品牌大全</a> <a class="hot-phone" href="http://top.zol.com.cn/compositor/' . $subcatId . '/' . $subEName . '.html">热门' . $subName . '</a> ' . $fastUp . '</div> <h2><a href="' . $sub_url . '" class="tit_name">' . $subName . '报价</a></h2> </div> <div class="param-nav"> <div class="param-item"> <strong>品牌</strong> <div class="param-links">' . $manuStr . '</div> </div> <div class="param-item"> <strong>价格</strong> <div class="param-links">' . $priceStr . '</div> </div> ' . $styleStr . '</div>'; if ($sub_icnt > 1 && $sub_icnt == $sub_i) { $str .= '<!--#endif -->'; } $sub_i++; } } } else { $str = '<!--#if expr="$sub_id > 0 && $location_id > 0" --><!--#include virtual="/include/article_domain_choosecenter_${sub_id}_2014.html"--><!--#endif -->'; } return $str; }