<?php
/**
 * 小区房源数量
 * 可以设定每天计算一次（可根据实时性要求设定时间）
 * 需要在均价评估之前计算一次，避免均价计算错误
 */
//小区数量
set_time_limit(0); 
require('path.inc.php');
$sql ="select * from fke_borough";
$query_mysql->open($sql);
$result = array();
$houseSell= new HouseSell($query);
$houseRent= new HouseRent($query);

while ($rs = $query_mysql->next()) {
	$housesell_num = $houseSell->getCount(0,' and status =1 and borough_id='.$rs['id']);
	$houserent_num = $houseRent->getCount(0,' and status =1 and borough_id='.$rs['id']);
	$query->execute('update fke_borough set sell_num = '.$housesell_num.', rent_num = '.$houserent_num .' where id ='.$rs['id']);
}
print_r("小区房源数量更新完成");
exit;
?>