<?php
//小区图片
require('path.inc.php');
$sql ="select * from T_H_HousePic where HouseSize like '%5910_8%'";
$query_mssql->open($sql);
$result = array();

while ($rs = $query_mssql->next()) {
	//loginNum 没有数据不需要导
	//$creater = $query_mssql2->getValue('select Brokers_LoginName from FK_User_Brokers where Brokers_LoginNum =\''.$rs['Images_LoginNum'].'\'');
	$housesell_id = $query_mssql2->getValue('select ID from T_H_HireHouse where HouseSize =\''.$rs['HouseSize'].'\'');
	$created = $rs['Add_Time']?MyDate::transform('timestamp',$rs['Add_Time']):"";

	$url = 'house/rent/'.date('Y',$created).'/'.date('n',$created).'/'.$rs['Pic_Url'];
	$fieldArray = array(
		'id'=>$rs['Pic_ID'],
		'pic_url'=>$url,
		'pic_desc'=>$rs['Pic_Memo'],
		'houserent_id'=>$housesell_id,
		//'creater'=>$creater,
		'addtime'=>$created
		);
	$query->insert('fke_houserent_pic',$fieldArray);
	//$sourcePath = "d:/系统/House/".$rs['Pic_Url'];
	if(in_array(substr($rs['Pic_Url'],0,1),array(0,1,2,3))){
		$sourcePath = "d:/系统/03/".$rs['Pic_Url'];
	}else{
		$sourcePath = "d:/系统/49/".$rs['Pic_Url'];
	}
	$destinPath = "d:/AppServ/www/系统/upfile/".$url;
	if(copy($sourcePath,$destinPath)){
		$a++;
	}
	else{
		$b++;
	}
}
echo $a .'|'.$b;
print_r("房源图片导入完成");
exit;
?>