@@ -110,13 +110,14 @@ class SecHandHouse extends Tospur_House{
...
@@ -110,13 +110,14 @@ class SecHandHouse extends Tospur_House{
//获取新房信息,存入tospur_house表
//获取新房信息,存入tospur_house表
$res=$wpdb->get_results('SELECT * FROM tospur_house WHERE address="'.$params['address'].'" and owner_name="'.$params['owner_name'].'" and owner_phone="'.$params['owner_phone'].'" and house_type=1',OBJECT);
$res=$wpdb->get_results('SELECT * FROM tospur_house WHERE address="'.$params['address'].'" and owner_name="'.$params['owner_name'].'" and owner_phone="'.$params['owner_phone'].'" and house_type=1',OBJECT);
$addSql=" left join (select buildproperty_id,house_area,image_id,house_id as bph_id from a_district_area) ada on th.id = ada.bph_id".
$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".
" left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on ada.buildproperty_id = dbp.bp_value";
" left join (select value as bp_value,literal as bp_literal from ".Config::DIC_BUILDPROPERTY_TABLE.") dbp on ada.buildproperty_id = dbp.bp_value";
$orderbySql=" group by th.id order by th.creattime DESC";
$orderbySql=" group by th.id order by th.creattime DESC";
}elseif($array['houseType']==1){
}elseif($array['houseType']==1){
$addSql=" left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value";
$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";
if($array['feature']>-1){
if($array['feature']>-1){
$addSql.=" left join (select house_id,tag_id from a_house_tag) aht on th.id = aht.house_id";
$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'];
$addWhereSql=" and tag_id = ".$array['feature'];
}
}
$orderbySql=" order by th.creattime DESC";
$orderbySql=" order by th.creattime DESC";
}elseif($array['houseType']==2){
}elseif($array['houseType']==2){
$addSql=" left join (select value as bp_value,literal as bp_literal from dic_buildproperty) dbp on th.buildproperty_id = dbp.bp_value";
$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";
$statusSql="select status_id as id from tospur_house th
$statusSql="select status_id as id from tospur_house th
left join(select status_type,status_id,status_name from tospur_status) ts on th.status = ts.status_id where th.id=".$hid." and status_type=".$statusType;
left join(select status_type,status_id,status_name from ".Config::TOSPUR_STATUS_TABLE.") ts on th.status = ts.status_id where th.id=".$hid." and status_type=".$statusType;
$status=$wpdb->get_row($statusSql);
$status=$wpdb->get_row($statusSql);
return$status;
return$status;
}
}
publicstaticfunctionsearchRent($hid){
publicstaticfunctionsearchRent($hid){
global$wpdb;
global$wpdb;
$rentSql="select rent as value from tospur_house where id = %d";
$rentSql="select rent as value from ".Config::TOSPUR_HOUSE_TABLE." where id = %d";
$consultant_sql='select c.*,u.display_name,s.average_score from '.Config::TOSPUR_CONSULTANT.' c '.
$consultant_sql='select c.id, c.mobile, c.imageUrl, c.name as display_name, s.average_score from '.Config::TOSPUR_CONSULTANT.' c '.
'left join '.Config::WP_USERS_TABLE.' u on c.id = u.ID '.
'left join (select consultant_id,sum(score)/count(score) as average_score from '.Config::TOSPUR_CONSULTANT_SCORE_TABLE.' where valid=1 group by consultant_id) s on c.id = s.consultant_id '.
'left join (select consultant_id,sum(score)/count(score) as average_score from '.Config::TOSPUR_CONSULTANT_SCORE_TABLE.' where valid=1 group by consultant_id) s on c.id = s.consultant_id '.