<?php
$conf_basedir	= "../../";	//相对主目录的位置
$conf_where		= "admin";	//选择调用相应模块
$directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
include_once($conf_basedir."base.inc.php");
checkAuth('63');	//判断登录和权限

$title = "用户意见反馈回复";

$sql = "SELECT id,esta,del_flag,message,reply,telno,email,orign,dateline,replytime,type,remark FROM  user_feedback where id = '{$id}' ";
$data_info = $dbback->GetRow($sql);

if($data_info['del_flag'] == '1'){
	echo '非法操作';die;
}

if($data_info['orign'] == '1'){
	$from = '【二手房】';
}elseif($data_info['orign'] == '2'){
	$from = '【租房】';
}elseif($data_info['orign'] == '3'){
	$from = '【资讯】';
}elseif($data_info['orign'] == '4'){
	$from = '【小区】';
}elseif($data_info['orign'] == '5'){
	$from = '【资讯】';
}else{
	$from = '';
}

//单个删除
if($do == 'del'){
    $sql = "update  user_feedback set del_flag='1' where id = '{$id}' ";
    $result = $db->Execute($sql);
	if($result == 1){
		echo 1;die;
	}else{
		echo 0;die;
	}
}

//批量删除
if($do == 'del_batch'){
	if($ids){
		$sql = "update  user_feedback set del_flag='1' where id in ({$ids}) ";
		$result = $db->Execute($sql);
		if($result){
			echo 1;die;
		}else{
			echo 0;die;
		}
	}else{
		echo '非法数据';die;
	}
}

//回复
if($do == 'reply'){
	$reply = trim($reply);
	if($reply != ''){
		//echo "<script>alert('回复不能为空!');</script>";die;
		$esta='1';
	}else{
		$esta='0';
	}
	$time = time();
    $sql = "update  user_feedback set reply='{$reply}' , esta = '{$esta}',replytime = '{$time}',type='{$type}',remark='{$remark}' where id = '{$id}' ";
	//echo $sql;
    $result = $db->Execute($sql);

	if($result == 1){
		echo "<script>alert('回复成功');window.opener.location.reload();window.close();</script>";die;
	}else{
		echo "<script>alert('回复失败');window.close();</script>"; die;
	}
}

//引用模版文件
include_once(Template("header"));
include_once(Template("feedback/replay"));
include_once(Template("footer"));
?>