<!--拼接查询条件--> <?php //关联 其他栏目 用的 查询 $catid = 0; if(empty($provid)){ $provid = 0; } if(empty($cityid)){ $cityid = 0; } //只调用省级 城市为空 if((int)$provid === 0 && (int)$catid === 0){ //所有省份的数据 //不限制 and province_id='0' and city_id='0' $where = "typeid=".$tid." and is_del=0"; }else if((int)$provid > 0 && (int)$catid === 0 && (int)$cityid === 0){ //只选择省 不选择职称 //不限制市 and city_id='0' $where = "typeid=".$tid." and province_id='$provid' and is_del=0"; }else{ //存在城市 //and stypeid='$catid' $where = "typeid=".$tid." and province_id='$provid' and city_id='$cityid' and is_del=0"; } if($tagid > 0){ //加入筛选 $where = $where.' and product_tag_id='.$tagid; } //var_dump($where); ?> <?php //计算limit属性 $pagesize = 12; if(!empty($route_param['page'])){ $curpage = $route_param['page']; $start_li = $pagesize*($curpage-1); //开始位置 $end_li = $pagesize*$curpage; $limit_cat_value = $start_li.','.$pagesize; }else{ $curpage = 1; $limit_cat_value = '0,'.$pagesize; } ?> {eyou:assign name='limit_cat' value="$limit_cat_value" /} <?php /*<!--add_time desc,province_id,city_id-->*/ //$sql = "select GROUP_CONCAT(aid SEPARATOR ',') AS ids from ey_archives where $where order by update_time desc limit $limit_cat"; $sql = "select aid from ey_archives where $where order by update_time desc limit $limit_cat"; //echo $sql;die; $ids = ''; ?> {eyou:sql sql="$sql" cachetime='3600' empty='没有数据' id="res"} <?php //var_dump($provid); //var_dump($res); $ids = $res['aid'].','.$ids; ?> {/eyou:sql} <?php $ids = preg_replace("/.$/", "", $ids); ?> <!--开始查询--> {eyou:empty name='$ids' /} ----------------------(暂无相关文档)----------------------- {eyou:else /} {eyou:artlist idlist="$ids" titlelen='30' limit='0,12' infolen='160' orderby='update_time desc' addfields='handle_time,province_id'} <li> <!-- <img src="{$field.litpic}" width='160' height='140'/>--> <a href="{:get_tid_url_2($field['arcurl'],$field['typeid'],$field['stypeid'],'0','',0,$field['province_id'],$field['city_id'])}">{$field.title|msubstr=###,0,30,true}</a> <span>{$field.add_time|MyDate='Y-m-d',###}</span> </li> {/eyou:artlist} {/eyou:empty}