Commit f058ed92 by felix

添加cache功能

parent c87b7a79
...@@ -52,6 +52,7 @@ class House extends Tospur_House{ ...@@ -52,6 +52,7 @@ class House extends Tospur_House{
}else{ }else{
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
echo "<h4>新房房源修改成功</h4>"; echo "<h4>新房房源修改成功</h4>";
w3tc_pgcache_flush_url(home_url() . '/?page=detail&hid=' . $_POST['houseId']);
} }
}else{ }else{
$insert_tospur_house_array["status"] = 0; $insert_tospur_house_array["status"] = 0;
......
...@@ -11,6 +11,8 @@ class TCSyncView { ...@@ -11,6 +11,8 @@ class TCSyncView {
TCSync::organization_sync(); TCSync::organization_sync();
break; break;
case 2: case 2:
$w3_objectcache = w3_instance('W3_ObjectCache');
$w3_objectcache->flush();
TCSync::other_sync(); TCSync::other_sync();
break; break;
} }
......
...@@ -65,8 +65,8 @@ class RentHouse extends Tospur_House{ ...@@ -65,8 +65,8 @@ class RentHouse extends Tospur_House{
}else{ }else{
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
echo "<h4>租房房源修改成功</h4>"; echo "<h4>租房房源修改成功</h4>";
w3tc_pgcache_flush_url(home_url() . '/?page=detail&hid=' . $_POST['houseId']);
} }
}else { }else {
$insert_tospur_house_array["status"] = 0; $insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1; $insert_tospur_house_array["approval"] = 1;
......
...@@ -65,8 +65,8 @@ class SecHandHouse extends Tospur_House{ ...@@ -65,8 +65,8 @@ class SecHandHouse extends Tospur_House{
}else{ }else{
$wpdb->query("COMMIT"); $wpdb->query("COMMIT");
echo "<h4>二手房房源修改成功</h4>"; echo "<h4>二手房房源修改成功</h4>";
w3tc_pgcache_flush_url(home_url() . '/?page=detail&hid=' . $_POST['houseId']);
} }
}else { }else {
$insert_tospur_house_array["status"] = 0; $insert_tospur_house_array["status"] = 0;
$insert_tospur_house_array["approval"] = 1; $insert_tospur_house_array["approval"] = 1;
...@@ -104,7 +104,6 @@ class SecHandHouse extends Tospur_House{ ...@@ -104,7 +104,6 @@ class SecHandHouse extends Tospur_House{
$context["photoType"] = SearchDao::searchPhotoType(); $context["photoType"] = SearchDao::searchPhotoType();
$context["house_type"] = 1; $context["house_type"] = 1;
Timber::render("secHandHouse.html",$context); Timber::render("secHandHouse.html",$context);
} }
public static function secHouseData_insert($params) public static function secHouseData_insert($params)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</select> </select>
</span> </span>
<span> <span>
<select id="baseAreaId" name="baseAreaId" class="form-control" style="width: 90px;"> <select id="baseAreaId" name="baseAreaId" class="form-control" style="width: 100px;">
<option value = "-1">区域</option> <option value = "-1">区域</option>
{% if district %} {% if district %}
{% for item in district %} {% for item in district %}
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
</select> </select>
</span> </span>
<span> <span>
<select id="basePlateId" name="basePlateId" class="form-control" style="width: 90px;"> <select id="basePlateId" name="basePlateId" class="form-control" style="width: 100px;">
<option value = "-1">板块</option> <option value = "-1">板块</option>
{% if district %} {% if district %}
{% for item in plate %} {% for item in plate %}
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
{% elseif house_type== 2 %} {% elseif house_type== 2 %}
<div class="col-xs-4"> <div class="col-xs-4">
<label for="rent" class="control-label">租金:</label> <label for="rent" class="control-label">租金:</label>
<p class="col-xs-7"> <p class="col-xs-6">
<input name="rent" id="rent" type="text" value="{{result.rent}}" class="form-control"> <input name="rent" id="rent" type="text" value="{{result.rent}}" class="form-control">
</p> </p>
<p class="col-xs-2" style="margin-top: 10px">&nbsp;元/月</p> <p class="col-xs-2" style="margin-top: 10px">&nbsp;元/月</p>
...@@ -378,7 +378,7 @@ ...@@ -378,7 +378,7 @@
{% if not houseId %} {% if not houseId %}
<div class="row form-group"> <div class="row form-group">
<div class="col-xs- "> <div class="col-xs-4">
<label for="owner_name" class="control-label">业主姓名:</label> <label for="owner_name" class="control-label">业主姓名:</label>
<p class="col-xs-7"> <p class="col-xs-7">
<input name="owner_name" id="owner_name" type="text" value="" class="form-control"> <input name="owner_name" id="owner_name" type="text" value="" class="form-control">
......
<div id="preview"> <div id="preview">
<div class="row"> <div class="row">
<div class="col-md-2"> <label style="float: left;margin-top: 25px;margin-left: 15px;">主力房源:</label>
<label for="traffic" style="margin-left: 30px">主力房源:</label>
</div>
<div class="col-md-10"> <div class="col-md-10">
{% set exists_ids = "" %} {% set exists_ids = "" %}
{% for item in mainImage %} {% for item in mainImage %}
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</select> </select>
</span> </span>
<span> <span>
<select id="baseAreaId" name="baseAreaId" class="form-control" style="width: 90px;"> <select id="baseAreaId" name="baseAreaId" class="form-control" style="width: 100px;">
<option value = "-1">区域</option> <option value = "-1">区域</option>
{% if district %} {% if district %}
{% for item in district %} {% for item in district %}
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</select> </select>
</span> </span>
<span> <span>
<select id="basePlateId" name="basePlateId" class="form-control" style="width: 90px;"> <select id="basePlateId" name="basePlateId" class="form-control" style="width: 100px;">
<option value = "-1">板块</option> <option value = "-1">板块</option>
{% if district %} {% if district %}
{% for item in plate %} {% for item in plate %}
......
...@@ -5,13 +5,19 @@ ...@@ -5,13 +5,19 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{title}}</title> <title>{{title}}</title>
<style> <style>
.form-horizontal label.control-label{ #adminmenuwrap {
position: fixed;
}
.form-horizontal {
width: 1500px;
}
.form-horizontal label.control-label {
text-align: left; text-align: left;
float: left; float: left;
margin-right: 10px; margin-right: 10px;
width: 65px; width: 65px;
} }
.form-horizontal span select{ .form-horizontal span select {
display: inline; display: inline;
} }
</style> </style>
...@@ -41,15 +47,13 @@ ...@@ -41,15 +47,13 @@
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="info">
<div role="tabpanel" class="tab-pane active" id="info"> {% if (house_type==1 or house_type == 2)%}
{% if (house_type==1 or house_type == 2)%} {% include 'houseInfo.html' %}
{% include 'houseInfo.html' %} {% else %}
{% else %} {% include 'newHouseInfo.html' %}
{% include 'newHouseInfo.html' %} {% endif %}
{% endif %} </div>
</div>
<div role="tabpanel" class="tab-pane" id="mainHouse"> <div role="tabpanel" class="tab-pane" id="mainHouse">
<br/> <br/>
{% include 'mainHouse.html' %} {% include 'mainHouse.html' %}
...@@ -71,8 +75,8 @@ ...@@ -71,8 +75,8 @@
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %} {% endif %}
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2" style="position: relative;height: 28px;">
<div class="row" style="position: fixed;"> <div class="row" style="position: absolute;">
{% if canEdit %} {% if canEdit %}
{% if houseId %} {% if houseId %}
{% if canApproval %} {% if canApproval %}
...@@ -95,7 +99,6 @@ ...@@ -95,7 +99,6 @@
<input type="submit" id="submit" class="button action"> <input type="submit" id="submit" class="button action">
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</form> </form>
......
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{title}}</title> <title>{{title}}</title>
<style> <style>
#adminmenuwrap {
position: fixed;
}
.form-horizontal {
width: 1500px;
}
.form-horizontal label.control-label{ .form-horizontal label.control-label{
text-align: left; text-align: left;
float: left; float: left;
...@@ -60,8 +66,8 @@ ...@@ -60,8 +66,8 @@
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %} {% endif %}
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2" style="position: relative;height: 28px;">
<div class="row" style="position: fixed;"> <div class="row" style="position: absolute;">
{% if canEdit %} {% if canEdit %}
{% if (result.status != 2 and result.status != 3) %} {% if (result.status != 2 and result.status != 3) %}
{% if houseId %} {% if houseId %}
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
<meta charset="utf-8"> <meta charset="utf-8">
<title>{{title}}</title> <title>{{title}}</title>
<style> <style>
#adminmenuwrap {
position: fixed;
}
.form-horizontal {
width: 1500px;
}
.form-horizontal label.control-label{ .form-horizontal label.control-label{
text-align: left; text-align: left;
float: left; float: left;
...@@ -64,8 +70,8 @@ ...@@ -64,8 +70,8 @@
<input type="text" name="houseId" value="{{houseId}}" hidden="hidden"> <input type="text" name="houseId" value="{{houseId}}" hidden="hidden">
{% endif %} {% endif %}
</div> </div>
<div class="col-xs-2"> <div class="col-xs-2" style="position: relative;height: 28px;">
<div class="row" style="position: fixed;"> <div class="row" style="position: absolute;">
{% if canEdit %} {% if canEdit %}
{% if (result.status != 2 and result.status != 3) %} {% if (result.status != 2 and result.status != 3) %}
{% if houseId %} {% if houseId %}
......
...@@ -5,6 +5,26 @@ require_once(PLUGIN_DIR . 'Tools/Image.php'); ...@@ -5,6 +5,26 @@ require_once(PLUGIN_DIR . 'Tools/Image.php');
class SearchDao class SearchDao
{ {
public static function get_dic_ojbectCache($id)
{
$w3_objectcache = w3_instance('W3_ObjectCache');
$get_objectcache = $w3_objectcache->get($id, 'dic');
if ($get_objectcache) {
DBManager::getLog()->info("get object cache " . $id);
return $get_objectcache;
} else {
return false;
}
}
public static function set_dic_ojbectCache($id, $result)
{
$w3_objectcache = w3_instance('W3_ObjectCache');
$w3_objectcache->set($id, $result, 'dic');
DBManager::getLog()->info("set object cache " . $id);
return $w3_objectcache->get($id, 'dic');
}
public static function ajax_searchCity() public static function ajax_searchCity()
{ {
wp_send_json(SearchDao::searchCity($_GET["cityId"], $_GET['districtId'])); wp_send_json(SearchDao::searchCity($_GET["cityId"], $_GET['districtId']));
...@@ -16,21 +36,28 @@ class SearchDao ...@@ -16,21 +36,28 @@ class SearchDao
$selectName = "cityId as id,cityName as value"; $selectName = "cityId as id,cityName as value";
$where = " where 1=1 "; $where = " where 1=1 ";
$groupBy = " group by cityId"; $groupBy = " group by cityId";
$id = "citys";
$params = array(); $params = array();
if ($cityId != NULL && $districtId == NULL) { if ($cityId != NULL && $districtId == NULL) {
$selectName = "districtId as id,districtName as value"; $selectName = "districtId as id,districtName as value";
$where .= " and cityId = %d"; $where .= " and cityId = %d";
$params[] = $cityId; $params[] = $cityId;
$groupBy = " group by districtId"; $groupBy = " group by districtId";
$id = "citys_" . $cityId;
} else if ($cityId != NULL && $districtId != NULL) { } else if ($cityId != NULL && $districtId != NULL) {
$selectName = "plateId as id,plateName as value"; $selectName = "plateId as id,plateName as value";
$where .= " and cityId = %d and districtId = %d"; $where .= " and cityId = %d and districtId = %d";
$params[] = $cityId; $params[] = $cityId;
$params[] = $districtId; $params[] = $districtId;
$groupBy = ""; $groupBy = "";
$id = "citys_" . $cityId . "_" . $districtId;
} }
$result = DBManager::get_results($wpdb->prepare('select ' . $selectName . ' from ' . Config::DIC_CITY_TABLE . $where . $groupBy, $params)); $data = SearchDao::get_dic_ojbectCache($id);
return $result; if (!$data) {
$result = DBManager::get_results($wpdb->prepare('select ' . $selectName . ' from ' . Config::DIC_CITY_TABLE . $where . $groupBy, $params));
$data = SearchDao::set_dic_ojbectCache($id, $result);
}
return $data;
} }
public static function ajax_searchArea() public static function ajax_searchArea()
...@@ -42,11 +69,17 @@ class SearchDao ...@@ -42,11 +69,17 @@ class SearchDao
{ {
global $wpdb; global $wpdb;
$where = " where 1=1"; $where = " where 1=1";
if (isset($_GET['cityId'])) { $id = "area";
if ($cityId) {
$where .= " and cityId = %d"; $where .= " and cityId = %d";
$id .= "_" . $cityId;
} }
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_AREA_TABLE . $where, $cityId)); $data = SearchDao::get_dic_ojbectCache($id);
return $result; if (!$data) {
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_AREA_TABLE . $where, $cityId));
$data = SearchDao::set_dic_ojbectCache($id, $result);
}
return $data;
} }
public static function ajax_searchBuildProperty() public static function ajax_searchBuildProperty()
...@@ -56,9 +89,13 @@ class SearchDao ...@@ -56,9 +89,13 @@ class SearchDao
public static function searchBuildProperty() public static function searchBuildProperty()
{ {
global $wpdb; $id = "buildproperty";
$result = DBManager::get_results('select value as id,literal as value from ' . Config::DIC_BUILDPROPERTY_TABLE); $data = SearchDao::get_dic_ojbectCache($id);
return $result; if (!$data) {
$result = DBManager::get_results('select value as id,literal as value from ' . Config::DIC_BUILDPROPERTY_TABLE);
$data = SearchDao::set_dic_ojbectCache($id, $result);
}
return $data;
} }
public static function ajax_searchRoom() public static function ajax_searchRoom()
...@@ -68,8 +105,13 @@ class SearchDao ...@@ -68,8 +105,13 @@ class SearchDao
public static function searchRoom() public static function searchRoom()
{ {
$result = DBManager::get_results('select value as id,literal as value from ' . Config::DIC_ROOM_TABLE); $id = "room";
return $result; $data = SearchDao::get_dic_ojbectCache($id);
if (!$data) {
$result = DBManager::get_results('select value as id,literal as value from ' . Config::DIC_ROOM_TABLE);
$data = SearchDao::set_dic_ojbectCache($id, $result);
}
return $data;
} }
public static function ajax_searchUnitPriceRange() public static function ajax_searchUnitPriceRange()
...@@ -81,11 +123,17 @@ class SearchDao ...@@ -81,11 +123,17 @@ class SearchDao
{ {
global $wpdb; global $wpdb;
$where = " where 1=1"; $where = " where 1=1";
if (isset($cityId)) { $id = "unitpricerange";
if ($cityId) {
$where .= " and cityId = %d"; $where .= " and cityId = %d";
$id .= "_" . $cityId;
} }
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_UNITPRICERANGE_TABLE . $where, $cityId)); $data = SearchDao::get_dic_ojbectCache($id);
return $result; if (!$data) {
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_UNITPRICERANGE_TABLE . $where, $cityId));
$data = SearchDao::set_dic_ojbectCache($id, $result);
}
return $data;
} }
public static function ajax_searchTotalPrice() public static function ajax_searchTotalPrice()
...@@ -97,11 +145,17 @@ class SearchDao ...@@ -97,11 +145,17 @@ class SearchDao
{ {
global $wpdb; global $wpdb;
$where = " where 1=1"; $where = " where 1=1";
$id = "totalprice";
if ($cityId) { if ($cityId) {
$where .= " and cityId = " . $cityId; $where .= " and cityId = " . $cityId;
$id .= "_" . $cityId;
} }
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_TOTALPRICE_TABLE . $where, $cityId)); $data = SearchDao::get_dic_ojbectCache($id);
return $result; if (!$data) {
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_TOTALPRICE_TABLE . $where, $cityId));
$data = SearchDao::set_dic_ojbectCache($id, $result);
}
return $data;
} }
public static function ajax_searchRentalPrice() public static function ajax_searchRentalPrice()
...@@ -113,11 +167,17 @@ class SearchDao ...@@ -113,11 +167,17 @@ class SearchDao
{ {
global $wpdb; global $wpdb;
$where = " where 1=1"; $where = " where 1=1";
$id = "rentalprice";
if ($cityId) { if ($cityId) {
$where .= " and cityId = " . $cityId; $where .= " and cityId = " . $cityId;
$id .= "_" . $cityId;
} }
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_RENTALPRICE_TABLE . $where, $cityId)); $data = SearchDao::get_dic_ojbectCache($id);
return $result; if (!$data) {
$result = DBManager::get_results($wpdb->prepare('select id,priceValue as value from ' . Config::DIC_RENTALPRICE_TABLE . $where, $cityId));
$data = SearchDao::set_dic_ojbectCache($id, $result);
}
return $data;
} }
public static function ajax_searchOrganization() public static function ajax_searchOrganization()
...@@ -147,143 +207,144 @@ class SearchDao ...@@ -147,143 +207,144 @@ class SearchDao
} }
} }
public static function ajax_searchHouse() public static function ajax_searchHouse()
{ {
$house_result = SearchDao::searchHouse( $house_result = SearchDao::searchHouse(
array( array(
'cityId' => $_POST['cityId'], 'cityId' => $_POST['cityId'],
'districtId' => $_POST['districtId'], 'districtId' => $_POST['districtId'],
'plateId' => $_POST['plateId'], 'plateId' => $_POST['plateId'],
'buildPropertyId' => $_POST['buildPropertyId'], 'buildPropertyId' => $_POST['buildPropertyId'],
'roomId' => $_POST['roomId'], 'roomId' => $_POST['roomId'],
'acreage' => $_POST['acreage'], 'acreage' => $_POST['acreage'],
'unitPrice'=> $_POST['unitPrice'], 'unitPrice' => $_POST['unitPrice'],
'totalPrice' => $_POST['totalPrice'], 'totalPrice' => $_POST['totalPrice'],
'rentalPrice' => $_POST['rentalPrice'], 'rentalPrice' => $_POST['rentalPrice'],
'searchText' => $_POST['searchText'], 'searchText' => $_POST['searchText'],
'houseType' => $_POST['houseType'], 'houseType' => $_POST['houseType'],
'feature' => $_POST['feature'], 'feature' => $_POST['feature'],
'userType' => $_POST['userType'], 'userType' => $_POST['userType'],
'userId' => $_POST['userId'], 'userId' => $_POST['userId'],
'index' => $_POST['index'] 'index' => $_POST['index']
) )
); );
$array = SearchDao::get_house_list($house_result); $array = SearchDao::get_house_list($house_result);
wp_send_json($array); wp_send_json($array);
} exit;
}
public static function searchHouse($array)
{ public static function searchHouse($array)
global $wpdb; {
$params = array(); global $wpdb;
$addSql = null; $params = array();
$addWhereSql = null; $addSql = null;
$orderbySql = null; $addWhereSql = null;
if ($array['houseType'] == 0) { $orderbySql = null;
$addSql = " left join (select buildproperty_id,house_area,image_id,house_id as bph_id from ".Config::A_DISTRICT_AREA_TABLE.") ada on th.id = ada.bph_id". if ($array['houseType'] == 0) {
" left join (select value as bp_value,literal as bp_literal from ".Config::DIC_BUILDPROPERTY_TABLE.") dbp on ada.buildproperty_id = dbp.bp_value"; $addSql = " left join (select buildproperty_id,house_area,image_id,house_id as bph_id from " . Config::A_DISTRICT_AREA_TABLE . ") ada on th.id = ada.bph_id" .
$orderbySql = " group by th.id order by th.creattime DESC"; " left join (select value as bp_value,literal as bp_literal from " . Config::DIC_BUILDPROPERTY_TABLE . ") dbp on ada.buildproperty_id = dbp.bp_value";
}else if ($array['houseType'] == 1) { $orderbySql = " group by th.id order by th.creattime DESC";
$addSql = " left join (select value as bp_value,literal as bp_literal from ".Config::DIC_BUILDPROPERTY_TABLE.") dbp on if(th.buildproperty_id>5,5,buildproperty_id) = dbp.bp_value"; } else if ($array['houseType'] == 1) {
if ($array['feature'] > -1) { $addSql = " left join (select value as bp_value,literal as bp_literal from " . Config::DIC_BUILDPROPERTY_TABLE . ") dbp on th.buildproperty_id = dbp.bp_value";
$addSql .= " left join (select house_id,tag_id from ".Config::A_HOUSE_TAG_TABLE.") aht on th.id = aht.house_id"; if ($array['feature'] > -1) {
$addWhereSql = " and tag_id = ".$array['feature']; $addSql .= " left join (select house_id,tag_id from " . Config::A_HOUSE_TAG_TABLE . ") aht on th.id = aht.house_id";
} $addWhereSql = " and tag_id = " . $array['feature'];
$orderbySql = " order by th.creattime DESC"; }
}else if($array['houseType'] == 2){ $orderbySql = " order by th.creattime DESC";
$addSql = " left join (select value as bp_value,literal as bp_literal from ".Config::DIC_BUILDPROPERTY_TABLE.") dbp on th.buildproperty_id = dbp.bp_value"; } else if ($array['houseType'] == 2) {
$orderbySql = " order by th.creattime DESC"; $addSql = " left join (select value as bp_value,literal as bp_literal from " . Config::DIC_BUILDPROPERTY_TABLE . ") dbp on th.buildproperty_id = dbp.bp_value";
} $orderbySql = " order by th.creattime DESC";
$sql = "select th.id,th.house_type,th.name,th.latest_news,th.address,th.average_price,th.community_name,th.covered_area,th.total_price,th.decoration,th.rent,". }
"ti.path,dr.literal,th.house_number,dbp.bp_literal,th.owner_name,th.owner_phone,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht". $sql = "select th.id,th.house_type,th.name,th.latest_news,th.address,th.average_price,th.community_name,th.covered_area,th.total_price,th.decoration,th.rent," .
" LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id". "ti.path,dr.literal,th.house_number,dbp.bp_literal,th.owner_name,th.owner_phone,(SELECT GROUP_CONCAT(left(tt.name,3)) from " . Config::A_HOUSE_TAG_TABLE . " aht" .
" where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th". " LEFT JOIN " . Config::TOSPUR_TAG_TABLE . " tt on tt.id = aht.tag_id" .
$addSql. " where aht.house_id = th.id) as tags from " . Config::TOSPUR_HOUSE_TABLE . " th" .
" left join ".Config::DIC_CITY_TABLE." dc on th.plate_id = dc.plateId". $addSql .
" left join (select id as rid,value as r_value,literal from ".Config::DIC_ROOM_TABLE.") dr on th.room_id = dr.r_value". " left join " . Config::DIC_CITY_TABLE . " dc on th.plate_id = dc.plateId" .
" left join (select id as image_id,path from ".Config::TOSPUR_IMAGE_TABLE.") ti on ti.image_id = th.frontCover_id". " left join (select id as rid,value as r_value,literal from " . Config::DIC_ROOM_TABLE . ") dr on th.room_id = dr.r_value" .
" where 1=1 and th.status = 1 "; " left join (select id as image_id,path from " . Config::TOSPUR_IMAGE_TABLE . ") ti on ti.image_id = th.frontCover_id" .
if ($array['cityId'] > -1) { " where 1=1 and th.status = 1 ";
$params[] = $array['cityId']; if ($array['cityId'] > -1) {
$sql = $sql . " and cityId=%d"; $params[] = $array['cityId'];
} $sql = $sql . " and cityId=%d";
if ($array['districtId'] > -1) { }
$params[] = $array['districtId']; if ($array['districtId'] > -1) {
$sql = $sql . " and districtId=%d"; $params[] = $array['districtId'];
} $sql = $sql . " and districtId=%d";
if ($array['plateId'] > -1) { }
$params[] = $array['plateId']; if ($array['plateId'] > -1) {
$sql = $sql . " and plateId=%d"; $params[] = $array['plateId'];
} $sql = $sql . " and plateId=%d";
if ($array['buildPropertyId'] > -1) { }
$params[] = $array['buildPropertyId']; if ($array['buildPropertyId'] > -1) {
if ($array['houseType'] == 0) { $params[] = $array['buildPropertyId'];
$sql = $sql . " and ada.buildproperty_id=%d"; if ($array['houseType'] == 0) {
}else{ $sql = $sql . " and ada.buildproperty_id=%d";
$sql = $sql . " and th.buildproperty_id=%d"; } else {
} $sql = $sql . " and th.buildproperty_id=%d";
} }
if ($array['roomId'] > -1) { }
$params[] = $array['roomId']; if ($array['roomId'] > -1) {
$sql = $sql . " and room_id=%d"; $params[] = $array['roomId'];
} $sql = $sql . " and room_id=%d";
if ($array['acreage'] > -1) { }
$areaArray = explode("-", $array['acreage']); if ($array['acreage'] > -1) {
$params[] = $areaArray[0]; $areaArray = explode("-", $array['acreage']);
$params[] = $areaArray[1]; $params[] = $areaArray[0];
if ($array['houseType'] == 0) { $params[] = $areaArray[1];
$sql = $sql . " and ada.house_area between %d and %d"; if ($array['houseType'] == 0) {
}else{ $sql = $sql . " and ada.house_area between %d and %d";
$sql = $sql . " and covered_area between %d and %d"; } else {
} $sql = $sql . " and covered_area between %d and %d";
} }
if ($array['unitPrice'] > -1) { }
$priceArray = explode("-", $array['unitPrice']); if ($array['unitPrice'] > -1) {
$params[] = $priceArray[0]; $priceArray = explode("-", $array['unitPrice']);
$params[] = $priceArray[1]; $params[] = $priceArray[0];
$sql = $sql . " and average_price between %d and %d"; $params[] = $priceArray[1];
} $sql = $sql . " and average_price between %d and %d";
}
if ($array['totalPrice'] > -1) { if ($array['totalPrice'] > -1) {
$priceArray = explode("-", $array['totalPrice']); $priceArray = explode("-", $array['totalPrice']);
$params[] = $priceArray[0]; $params[] = $priceArray[0];
$params[] = $priceArray[1]; $params[] = $priceArray[1];
$sql = $sql . " and total_price/10000 between %d and %d"; $sql = $sql . " and total_price between %d and %d";
} }
if ($array['rentalPrice'] > -1) { if ($array['rentalPrice'] > -1) {
$priceArray = explode("-", $array['rentalPrice']); $priceArray = explode("-", $array['rentalPrice']);
$params[] = $priceArray[0]; $params[] = $priceArray[0];
$params[] = $priceArray[1]; $params[] = $priceArray[1];
$sql = $sql . " and rent between %d and %d"; $sql = $sql . " and rent between %d and %d";
} }
if ($array['houseType'] > -1) { if ($array['houseType'] > -1) {
$params[] = $array['houseType']; $params[] = $array['houseType'];
$sql = $sql . " and house_type = %d"; $sql = $sql . " and house_type = %d";
} }
if ($array['userType'] > -1 && $array['userId'] > -1) { if ($array['userType'] > -1 && $array['userId'] > -1) {
$params[] = $array['userType']; $params[] = $array['userType'];
$params[] = $array['userId']; $params[] = $array['userId'];
$sql = $sql . " and id in (select house_id from ".Config::A_HOUSE_USER_TABLE." where user_type = %d and user_id = %d)"; $sql = $sql . " and id in (select house_id from " . Config::A_HOUSE_USER_TABLE . " where user_type = %d and user_id = %d)";
} }
if ($array['searchText'] != null) { if ($array['searchText'] != null) {
$params[] = '%'.$array['searchText'].'%'; $params[] = '%' . $array['searchText'] . '%';
$params[] = '%'.$array['searchText'].'%'; $params[] = '%' . $array['searchText'] . '%';
$sql = $sql . " and (name like '%s' or address like '%s')"; $sql = $sql . " and (name like '%s' or address like '%s')";
} }
if($addWhereSql){ if ($addWhereSql) {
$sql = $sql . $addWhereSql; $sql = $sql . $addWhereSql;
} }
$sql = $sql . $orderbySql; $sql = $sql . $orderbySql;
if ($array['index'] > -1) { if ($array['index'] > -1) {
$params[] = $array['index']; $params[] = $array['index'];
$sql = $sql . " limit %d,10"; $sql = $sql . " limit %d,10";
} }
$result = DBManager::get_results($wpdb->prepare($sql, $params)); $result = DBManager::get_results($wpdb->prepare($sql, $params));
return $result; return $result;
} }
public static function ajax_searchPhotoType() public static function ajax_searchPhotoType()
{ {
...@@ -296,62 +357,65 @@ class SearchDao ...@@ -296,62 +357,65 @@ class SearchDao
$result = DBManager::get_results('select id,photo_name as value from ' . Config::DIC_PHOTOTYPE_TABLE); $result = DBManager::get_results('select id,photo_name as value from ' . Config::DIC_PHOTOTYPE_TABLE);
return $result; return $result;
} }
public static function ajax_searchConsultant(){ public static function ajax_searchConsultant()
wp_send_json(SearchDao::searchConsultant($_GET["organizationId"],$_GET["consultantName"])); {
wp_send_json(SearchDao::searchConsultant($_GET["organizationId"], $_GET["consultantName"]));
} }
public static function searchConsultant($organizationId = NULL,$consultantName = NULL){ public static function searchConsultant($organizationId = NULL, $consultantName = NULL)
{
global $wpdb; global $wpdb;
$sql = "select tc.id,tc.name,tc.subsidiaryId,imageUrl,tor.Name as branchName from ".Config::TOSPUR_CONSULTANT." tc $sql = "select tc.id,tc.name,tc.subsidiaryId,imageUrl,tor.Name as branchName from " . Config::TOSPUR_CONSULTANT . " tc
LEFT JOIN ".Config::TOSPUR_ORGANIZATION_TABLE." tor on tc.subsidiaryId = tor.Id LEFT JOIN " . Config::TOSPUR_ORGANIZATION_TABLE . " tor on tc.subsidiaryId = tor.Id
where 1=1"; where 1=1";
$params = array(); $params = array();
if($organizationId!=NULL && $organizationId != -1 ){ if ($organizationId != -1) {
$params[] = $organizationId; $params[] = $organizationId;
$sql = $sql." and subsidiaryId=%d"; $sql = $sql . " and subsidiaryId=%d";
} }
if($consultantName != NULL){ if ($consultantName != NULL) {
$params[] = '%'.$consultantName.'%'; $params[] = '%' . $consultantName . '%';
$sql = $sql." and tc.name like %s"; $sql = $sql . " and tc.name like %s";
} }
$result = DBManager::get_results($wpdb->prepare($sql,$params)); $result = DBManager::get_results($wpdb->prepare($sql, $params));
return $result; return $result;
} }
public static function get_house_list($house_result) public static function get_house_list($house_result)
{ {
$array = array(); $array = array();
if ($house_result) { if ($house_result) {
$array['code'] = 2000; $array['code'] = 2000;
$house_ids = array(); $house_ids = array();
foreach ($house_result as $key => $value) { foreach ($house_result as $key => $value) {
$house_id = $value->id; $house_id = $value->id;
$house_ids[] = $house_id; $house_ids[] = $house_id;
if($value->path){ if ($value->path) {
$value->path = home_url() . Image::getImage($value->path,'small'); $value->path = home_url() . Image::getImage($value->path, 'small');
} }
} }
$array['result'] = $house_result; $array['result'] = $house_result;
} else { } else {
$array['code'] = 2001; $array['code'] = 2001;
} }
return $array; return $array;
} }
public static function searchFeatureByHouse($hid){ public static function searchFeatureByHouse($hid)
global $wpdb; {
$featureSql ="select tag_id,name from ".Config::A_HOUSE_TAG_TABLE." aht global $wpdb;
LEFT JOIN (select id as tid,name ,type from ".Config::TOSPUR_TAG_TABLE.") tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1"; $featureSql = "select tag_id,name from " . Config::A_HOUSE_TAG_TABLE . " aht
$feature = DBManager::get_results($wpdb->prepare($featureSql,$hid)); LEFT JOIN (select id as tid,name ,type from " . Config::TOSPUR_TAG_TABLE . ") tt on aht.tag_id = tt.tid where aht.house_id = %d and type = 1";
return $feature; $feature = DBManager::get_results($wpdb->prepare($featureSql, $hid));
} return $feature;
}
public static function searchFeature()
{ public static function searchFeature()
$sql = 'select id,name as value from '.Config::TOSPUR_TAG_TABLE.' where type = 1;'; {
return DBManager::get_results($sql); $sql = 'select id,name as value from ' . Config::TOSPUR_TAG_TABLE . ' where type = 1;';
} return DBManager::get_results($sql);
}
public static function ajax_searchTagOrFeature() public static function ajax_searchTagOrFeature()
{ {
...@@ -364,128 +428,130 @@ class SearchDao ...@@ -364,128 +428,130 @@ class SearchDao
return DBManager::get_results($sql); return DBManager::get_results($sql);
} }
public static function getDetailInfo($hid,$type = NULL){ public static function getDetailInfo($hid, $type = NULL)
{
global $wpdb; global $wpdb;
$sql = "select *,dr.literal as room,db.literal as buildproperty from ".Config::TOSPUR_HOUSE_TABLE." th $sql = "select *,dr.literal as room,db.literal as buildproperty from " . Config::TOSPUR_HOUSE_TABLE . " th
left JOIN ".Config::DIC_ROOM_TABLE." dr on th.room_id = dr.id left JOIN " . Config::DIC_ROOM_TABLE . " dr on th.room_id = dr.id
left JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on th.buildproperty_id = db.value left JOIN " . Config::DIC_BUILDPROPERTY_TABLE . " db on th.buildproperty_id = db.value
where th.id = %d"; where th.id = %d";
$result = DBManager::get_row($wpdb->prepare($sql,$hid)); $result = DBManager::get_row($wpdb->prepare($sql, $hid));
$context = array(); $context = array();
$context['result'] = $result; $context['result'] = $result;
$houseType = $result->house_type; $houseType = $result->house_type;
$context['cityName'] = SearchDao::getCityNameWithId($result->city_id); $context['cityName'] = SearchDao::getCityNameWithId($result->city_id);
$consultantLimit = 1; $consultantLimit = 1;
if($houseType == 0){ if ($houseType == 0) {
$consultantLimit = 5; $consultantLimit = 5;
$mainImagesSql = "SELECT ti.id,ada.buildproperty_id,db.literal as type,ada.house_area as area,ti.path FROM ".Config::A_DISTRICT_AREA_TABLE." ada $mainImagesSql = "SELECT ti.id,ada.buildproperty_id,db.literal as type,ada.house_area as area,ti.path FROM " . Config::A_DISTRICT_AREA_TABLE . " ada
LEFT JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on db.value = ada.buildproperty_id LEFT JOIN " . Config::DIC_BUILDPROPERTY_TABLE . " db on db.value = ada.buildproperty_id
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on ti.id = ada.image_id LEFT JOIN " . Config::TOSPUR_IMAGE_TABLE . " ti on ti.id = ada.image_id
where ada.house_id = %d"; where ada.house_id = %d";
$mainImage = DBManager::get_results($wpdb->prepare($mainImagesSql,$hid)); $mainImage = DBManager::get_results($wpdb->prepare($mainImagesSql, $hid));
foreach($mainImage as $key => $value){ foreach ($mainImage as $key => $value) {
$path = $value->path; $path = $value->path;
$value->path = Image::getImage($path,'big'); $value->path = Image::getImage($path, 'big');
$value->smallPath = Image::getImage($path,'small'); $value->smallPath = Image::getImage($path, 'small');
} }
$context['mainImage'] = $mainImage; $context['mainImage'] = $mainImage;
$recommendSql = "select th.id,th.name,th.average_price,th.latest_news,th.address,ti.path,dr.literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht $recommendSql = "select th.id,th.name,th.average_price,th.latest_news,th.address,ti.path,dr.literal,(SELECT GROUP_CONCAT(left(tt.name,3)) from " . Config::A_HOUSE_TAG_TABLE . " aht
LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id LEFT JOIN " . Config::TOSPUR_TAG_TABLE . " tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th where aht.house_id = th.id) as tags from " . Config::TOSPUR_HOUSE_TABLE . " th
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on th.frontCover_id = ti.id LEFT JOIN " . Config::TOSPUR_IMAGE_TABLE . " ti on th.frontCover_id = ti.id
LEFT JOIN ".Config::DIC_ROOM_TABLE." dr on dr.value = th.room_id LEFT JOIN " . Config::DIC_ROOM_TABLE . " dr on dr.value = th.room_id
where th.id in(select recommend_id from ".Config::A_HOUSE_RECOMMEND_TABLE." where house_id = %d);"; where th.id in(select recommend_id from " . Config::A_HOUSE_RECOMMEND_TABLE . " where house_id = %d);";
}else{ } else {
$recommendSql = "select th.id,th.name,th.community_name,ti.path,db.literal,th.rent,th.decoration,th.covered_area,th.total_price,(SELECT GROUP_CONCAT(left(tt.name,3)) from ".Config::A_HOUSE_TAG_TABLE." aht $recommendSql = "select th.id,th.name,th.community_name,ti.path,dr.value,th.rent,th.decoration,th.covered_area,th.total_price,(SELECT GROUP_CONCAT(left(tt.name,3)) from " . Config::A_HOUSE_TAG_TABLE . " aht
LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on tt.id = aht.tag_id LEFT JOIN " . Config::TOSPUR_TAG_TABLE . " tt on tt.id = aht.tag_id
where aht.house_id = th.id) as tags from ".Config::TOSPUR_HOUSE_TABLE." th where aht.house_id = th.id) as tags from " . Config::TOSPUR_HOUSE_TABLE . " th
LEFT JOIN ".Config::DIC_BUILDPROPERTY_TABLE." db on db.value = if(th.buildproperty_id>5,5,buildproperty_id) LEFT JOIN " . Config::DIC_ROOM_TABLE . " dr on dr.id = th.room_id
LEFT JOIN ".Config::TOSPUR_IMAGE_TABLE." ti on th.frontCover_id = ti.id LEFT JOIN " . Config::TOSPUR_IMAGE_TABLE . " ti on th.frontCover_id = ti.id
where th.id in(select recommend_id from ".Config::A_HOUSE_RECOMMEND_TABLE." where house_id = %d);"; where th.id in(select recommend_id from " . Config::A_HOUSE_RECOMMEND_TABLE . " where house_id = %d);";
} }
$recommends = DBManager::get_results($wpdb->prepare($recommendSql,$hid)); $recommends = DBManager::get_results($wpdb->prepare($recommendSql, $hid));
foreach($recommends as $key => $value){ foreach ($recommends as $key => $value) {
$value->path = Image::getImage($value->path,'small'); $value->path = Image::getImage($value->path, 'small');
} }
$context['recommends'] = $recommends; $context['recommends'] = $recommends;
$consultantSql = "select id,name,mobile,imageUrl,subsidiaryId,s.average_score from ".Config::TOSPUR_CONSULTANT." c $consultantSql = "select id,name,mobile,imageUrl,subsidiaryId,s.average_score from " . Config::TOSPUR_CONSULTANT . " c
LEFT JOIN (select consultant_id,sum(score)/count(score) as average_score LEFT JOIN (select consultant_id,sum(score)/count(score) as average_score
from ".Config::TOSPUR_CONSULTANT_SCORE_TABLE." from " . Config::TOSPUR_CONSULTANT_SCORE_TABLE . "
where valid=1 group by consultant_id) s on c.id = s.consultant_id where valid=1 group by consultant_id) s on c.id = s.consultant_id
where id in(select user_id from ".Config::A_HOUSE_USER_TABLE." where user_type = 1 and house_id = %d) limit {$consultantLimit};"; where id in(select user_id from " . Config::A_HOUSE_USER_TABLE . " where user_type = 1 and house_id = %d) limit {$consultantLimit};";
$consultant = DBManager::get_results($wpdb->prepare($consultantSql,$hid)); $consultant = DBManager::get_results($wpdb->prepare($consultantSql, $hid));
$context['consultant'] = $consultant; $context['consultant'] = $consultant;
if($type == 'edit'){ if ($type == 'edit') {
$imagesSql = 'select * from a_house_image ahi $imagesSql = 'select * from a_house_image ahi
LEFT JOIN tospur_image ti on ti.id = ahi.image_id LEFT JOIN tospur_image ti on ti.id = ahi.image_id
where ahi.house_id = %d and ahi.image_id not in (select image_id from '.Config::A_DISTRICT_AREA_TABLE.' where house_id = %d);'; where ahi.house_id = %d and ahi.image_id not in (select image_id from ' . Config::A_DISTRICT_AREA_TABLE . ' where house_id = %d);';
}else{ } else {
$imagesSql = 'select * from '.Config::TOSPUR_IMAGE_TABLE.' ti $imagesSql = 'select * from ' . Config::TOSPUR_IMAGE_TABLE . ' ti
LEFT JOIN '.Config::A_HOUSE_IMAGE_TABLE.' ahi on ti.id = ahi.image_id LEFT JOIN ' . Config::A_HOUSE_IMAGE_TABLE . ' ahi on ti.id = ahi.image_id
WHERE ahi.house_id = %d order by image_type;'; WHERE ahi.house_id = %d order by image_type;';
} }
$images = DBManager::get_results($wpdb->prepare($imagesSql,$hid,$hid)); $images = DBManager::get_results($wpdb->prepare($imagesSql, $hid, $hid));
foreach($images as $key => $value){ foreach ($images as $key => $value) {
$path = $value->path; $path = $value->path;
$value->path = Image::getImage($path,'big'); $value->path = Image::getImage($path, 'big');
$context['normalImages'][]->path = Image::getImage($path,'normal'); $context['normalImages'][]->path = Image::getImage($path, 'normal');
} }
$context['images'] = $images; $context['images'] = $images;
return $context; return $context;
} }
public static function searchHouseTag($houseId){ public static function searchHouseTag($houseId)
{
global $wpdb; global $wpdb;
$sql = "select tt.name from ".Config::A_HOUSE_TAG_TABLE." aht $sql = "select tt.name from " . Config::A_HOUSE_TAG_TABLE . " aht
LEFT JOIN ".Config::TOSPUR_TAG_TABLE." tt on aht.tag_id = tt.id LEFT JOIN " . Config::TOSPUR_TAG_TABLE . " tt on aht.tag_id = tt.id
where aht.house_id = %d and type = 0;"; where aht.house_id = %d and type = 0;";
$results = DBManager::get_results($wpdb->prepare($sql,$houseId)); $results = DBManager::get_results($wpdb->prepare($sql, $houseId));
$tags = array(); $tags = array();
foreach($results as $item){ foreach ($results as $item) {
$tags[] =$item->name; $tags[] = $item->name;
} }
return implode(",",$tags); return implode(",", $tags);
} }
public static function searchStatusType($statusType,$canShow = null,$currentStatus = null,$currentApproval = null){ public static function searchStatusType($statusType, $canShow = null, $currentStatus = null, $currentApproval = null)
{
global $wpdb; global $wpdb;
$sql="select status_id as id,status_name as value from ".Config::TOSPUR_STATUS_TABLE." where status_type = %d "; $sql = "select status_id as id,status_name as value from " . Config::TOSPUR_STATUS_TABLE . " where status_type = %d ";
//控制进入详细后可选的状态 //控制进入详细后可选的状态
if(isset($canShow)){ if (isset($canShow)) {
$sql .= " and canShow = ".$canShow; $sql .= " and canShow = " . $canShow;
} }
if(isset($currentStatus)){ if (isset($currentStatus)) {
//房源为无效时当置业顾问提交后,status变为未审核,approval为重激活,要使此类房源进去后状态仍只有重激活 //房源为无效时当置业顾问提交后,status变为未审核,approval为重激活,要使此类房源进去后状态仍只有重激活
if( $currentApproval == 5 && $currentStatus == 0 ){ if ($currentApproval == 5 && $currentStatus == 0) {
$sql .= " and status_id = 5"; $sql .= " and status_id = 5";
} }
//无效只显示重激活 //无效只显示重激活
if($currentStatus == 4){ if ($currentStatus == 4) {
$sql .= " and status_id = 5"; $sql .= " and status_id = 5";
} }
} }
$results = DBManager::get_results($wpdb->prepare($sql,$statusType)); $results = DBManager::get_results($wpdb->prepare($sql, $statusType));
return $results; return $results;
} }
public static function searchFeatureOld($hid, $type)
public static function searchFeatureOld($hid, $type){ {
global $wpdb; global $wpdb;
$params[] = $hid; $params[] = $hid;
$params[] = $type; $params[] = $type;
$featureSql ="select tag_id,name from a_house_tag aht $featureSql = "select tag_id,name from a_house_tag aht
LEFT JOIN (select id as tid,name ,type from ".Config::TOSPUR_TAG_TABLE.") tt on aht.tag_id = tt.tid where aht.house_id = %d and tt.type = %d"; LEFT JOIN (select id as tid,name ,type from " . Config::TOSPUR_TAG_TABLE . ") tt on aht.tag_id = tt.tid where aht.house_id = %d and tt.type = %d";
$feature = DBManager::get_results($wpdb->prepare($featureSql,$params)); $feature = DBManager::get_results($wpdb->prepare($featureSql, $params));
return $feature; return $feature;
} }
} }
\ No newline at end of file
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
$context = array(); $context = array();
$context['theme'] = get_template_directory_uri(); $context['theme'] = get_template_directory_uri();
require_once(WP_PLUGIN_DIR . "/tospur/Dao/SearchDao.php");
$default_city_id = get_option('default_city_id'); $default_city_id = get_option('default_city_id');
$cityId = ($default_city_id) ? $default_city_id : 2; $cityId = ($default_city_id) ? $default_city_id : 2;
...@@ -27,11 +26,12 @@ $context['select']['plate'] = json_encode($plateArray); ...@@ -27,11 +26,12 @@ $context['select']['plate'] = json_encode($plateArray);
$context['select']['buildProperty'] = SearchDao::searchBuildProperty(); $context['select']['buildProperty'] = SearchDao::searchBuildProperty();
$context['select']['room'] = json_encode(SearchDao::searchRoom()); $context['select']['room'] = json_encode(SearchDao::searchRoom());
$context['select']['feature'] = json_encode(SearchDao::searchTagOrFeature(1)); $context['select']['feature'] = json_encode(SearchDao::searchTagOrFeature(1));
$context['select']['unitPriceRange'] = SearchDao::searchUnitPriceRange($cityId); if ($houseType == 0) {
if ($houseType == 2) { $context['select']['unitPrice'] = SearchDao::searchUnitPriceRange($cityId);
$context['select']['rentalPrice'] = SearchDao::searchRentalPrice($cityId); } else if ($houseType == 1) {
} else {
$context['select']['totalPrice'] = SearchDao::searchTotalPrice($cityId); $context['select']['totalPrice'] = SearchDao::searchTotalPrice($cityId);
} else {
$context['select']['rentalPrice'] = SearchDao::searchRentalPrice($cityId);
} }
$context['select']['area'] = json_encode(SearchDao::searchArea($cityId)); $context['select']['area'] = json_encode(SearchDao::searchArea($cityId));
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
'</span></p></li>'); '</span></p></li>');
$('#carousel_indicator').append('<li/>'); $('#carousel_indicator').append('<li/>');
}); });
sliderTap = true;
} }
carousel.find("#carousel_scroller ul li").css({"width":carouselWidth}); carousel.find("#carousel_scroller ul li").css({"width":carouselWidth});
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
'</span></p></li>'); '</span></p></li>');
$('#carousel_indicator').append('<li/>'); $('#carousel_indicator').append('<li/>');
}); });
sliderTap = true;
} }
carousel.find("#carousel_scroller ul li").css({"width":carouselWidth}); carousel.find("#carousel_scroller ul li").css({"width":carouselWidth});
......
...@@ -59,21 +59,30 @@ ...@@ -59,21 +59,30 @@
<div class="btn-group"> <div class="btn-group">
<a class="btn">价格<span></span></a> <a class="btn">价格<span></span></a>
<div id="price_wrapper" class="dropdown-menu"> <div id="price_wrapper" class="dropdown-menu">
{% if select.totalPrice %} {% if select.unitPrice %}
<div type="unitPrice" id="unitPrice_scroller">
<a href="#" class="active">不限</a>
{% for item in select.unitPrice %}
<a data-id="{{item.value}}">{{item.value}}</a>
{% endfor %}
</div>
{% elseif select.totalPrice %}
<div type="totalPrice" id="totalPrice_scroller"> <div type="totalPrice" id="totalPrice_scroller">
<a href="#" class="active">不限</a> <a href="#" class="active">不限</a>
{% for item in select.totalPrice %} {% for item in select.totalPrice %}
<a data-id="{{item.value}}">{{item.value}}</a> <a data-id="{{item.value}}">{{item.value}}</a>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% elseif select.rentalPrice %}
{% if select.rentalPrice %}
<div type="rentalPrice" id="rentalPrice_scroller"> <div type="rentalPrice" id="rentalPrice_scroller">
<a href="#" class="active">不限</a> <a href="#" class="active">不限</a>
{% for item in select.rentalPrice %} {% for item in select.rentalPrice %}
<a data-id="{{item.value}}">{{item.value}}</a> <a data-id="{{item.value}}">{{item.value}}</a>
{% endfor %} {% endfor %}
</div> </div>
{% else %}
<div id="price_scroller">
</div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
...@@ -343,7 +352,11 @@ ...@@ -343,7 +352,11 @@
}); });
function searchNameAndAddress(){ function searchNameAndAddress(){
searchData.index = 0; searchData.index = 0;
searchData.searchText = $('#searchText').val(); var searchText = $('#searchText').val();
if (searchText.trim() == '') {
searchText = '';
}
searchData.searchText = searchText;
scroller.html(''); scroller.html('');
ajax_get_house('{{ url }}', loading, searchData, scroller); ajax_get_house('{{ url }}', loading, searchData, scroller);
} }
...@@ -352,6 +365,7 @@ ...@@ -352,6 +365,7 @@
cityId: {{ cityId }}, cityId: {{ cityId }},
districtId: -1, districtId: -1,
plateId: -1, plateId: -1,
unitPrice: -1,
totalPrice: -1, totalPrice: -1,
rentalPrice: -1, rentalPrice: -1,
buildPropertyId: -1, buildPropertyId: -1,
......
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