public function indexRecomHouse($area){
$where = array();
$where['a.isDel'] = '0';
$where['a.status'] = '2';
$where['a.auditstatus'] = '1';//已审核
$where['a.salestatus'] = '0';//在售
$where['a.isRecom'] = 'Y';
$order = "a.verifyTime desc";
$field = "a.esfId,c.shi,c.ting,c.chu,c.wei,a.price,a.buildingArea,b.fangAreaId,a.villageId,b.villageName";
$data = $this->table($this->tablePrefix."house as a")->join("left join ".$this->tablePrefix."village as b on a.villageId=b.villageId")->join("left join ".$this->tablePrefix."village_pic_hsize as c on a.hsizeId=c.picId")->where($where)->field($field)->order($order)->limit(15)->select();
if($data){
$areaDb = D("FangArea");
$housePicDb = D("HousePic");
$num=0;
foreach($data as $key => $val){
$data[$key]['detailUrl'] = "http://esf.$area.qq.com/House1/detail?esfId=".$val['esfId'];
$data[$key]['thumbUrl'] = $housePicDb->getThumb($val['esfId']);
$data[$key]['areaName'] = $areaDb->getName($val['fangAreaId']);
$data[$key]['zuhe'] = $val['shi']."室".($val['ting'] ? $val['ting']."厅" : "").($val['wei'] ? $val['wei']."卫" : "");
$a= explode('.', $val['buildingArea']);
if($a[1]>0){
$data[$key]['buildingArea'] = $a[0].'.'.$a[1];
}else {
$data[$key]['buildingArea'] = $a[0];
}
$b= explode('.', $val['price']);
if($b[1]>0){
$data[$key]['price'] = $b[0].'.'.$b[1];
}else {
$data[$key]['price'] = $b[0];
}
//处理3层数据结构,每组下面5条数据
if($key%5 !=0){
$arr[$num][]=$data[$key];
}else {
$arr[$num+1][]=$data[$key];
$num +=1;
}
}
}
return $arr;
}
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
创新互联-专业网站定制、快速模板网站建设、高性价比乡宁网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式乡宁网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖乡宁地区。费用合理售后完善,十年实体公司更值得信赖。
分享题目:php数组取模-创新互联
文章链接:
http://mswzjz.cn/article/coegjh.html