Commit e65ce33c authored by clone's avatar clone

楼盘删选

parent 2d599ab7
......@@ -15,6 +15,7 @@ use app\model\GLabels;
use app\model\HouseImgs;
use app\model\HouseInfos;
use app\model\Labels;
use app\model\Regions;
class Shop extends Basic
{
......@@ -211,32 +212,26 @@ class Shop extends Basic
*/
public function filtrateCondition()
{
$field = "city,disc";
$param['id'] = array( '<>', 16 );
$param['room_num_left'] = array( '<>', 0 );
$group_ = "disc";
$cityList = $this->db->getCityList($field, $param, $group_);
foreach ($cityList as $k => $v) {
if (!empty($v["city"])) {
$cityArr[] = $v["city"];
}
}
$cityArr = array_unique($cityArr);
$regions = new Regions();
$cityList = $regions->getRegionsCitySH();
$i = 0;
$result["area"][$i]["city"] = "全部";
$result["area"][$i]["disc"][] = "全部";
foreach ($cityArr as $key => $val) {
$i++;
$result["area"][$i]["city"] = $val;
$result["area"][$i]["disc"][] = "全" . $val;
foreach ($cityList as $k => $v) {
if ($val == $v["city"]) {
$result["area"][$i]["disc"][] = $v["disc"];
$i++;
if (!empty($v["name"])) {
$result["area"][$i]["city"] = $v["name"];
$result["area"][$i]["disc"][] = "全" . $v["name"];
}
foreach ($v["city"] as $item) {
if (!empty($item)) {
$result["area"][$i]["disc"][] = $item;
}
}
}
$result['yetai'] = array( '全部', '餐饮美食', '百货零售', '休闲娱乐', '其他' );
//租金租金(0:租金-大于三万; 1:租金一万到三万之间; 2:租金-小于一万)
......
......@@ -83,6 +83,23 @@ class Regions extends Model
return $data;
}
/**
* 获取沪城市和区
*
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getRegionsCitySH() {
$data = [];
$city_data = $this->field('code,fullName')->where('parentCode in ( 310000)')->select();
foreach ($city_data as $k=>$v) {
$data[$k]['name'] = $v['fullName'];
$data[$k]['city'] = $this->where('parentCode',$v['code'])->column('fullName');
}
return $data;
}
/**
* 根据区code获取省市区中文
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment