<?php
/**
 * 计算A+房源（租房）
 * 推荐到首页（时间可根据具体情况定）每天更新
 */

require('path.inc.php');

$houserent =  new HouseRent($query);
//计算租房A+房源的单价比
$query->execute("update fke_houserent set order_weight=0");

$sql ="select * from fke_houserent where status=1 and house_price<2500";
$query->open($sql);
while ($rs = $query->next()) {
	$img_num = $houserent->getImgNum($rs['id']);
	if($img_num<1){
		continue;
	}
	if(!$rs['house_support']){
		//没有填写房源的配套设施
		continue;
	}
	$temp = explode(',',$rs['house_support']);
	if(count($temp) < 13){
		//配套设施不低于13项
		continue;	
	}
	
	$order_weight = ($rs['house_room']+$rs['house_hall'])/$rs['house_price'];
	$query_mysql->execute('update fke_houserent set order_weight='.$order_weight.' where id='.$rs['id']);
}

echo "A+房源更新完成";

?>