<?php

$conf_basedir	= "../../";	//相对主目录的位置
$conf_where		= "admin";	//选择调用相应模块
$directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
include_once($conf_basedir."base.inc.php");
checkAuth('113');	//判断登录和权限
//$x = new BlockLevelStat();
//$x->flushHeat();
$title = "小区等级设置";
$request  = new Request();

$blockLevelHeatSetting = new BlockLevelHeatSetting();
//echo $blockLevelHeatSetting->getExpWayAlias('A');
//print_r($data_info);
//xdebug_var_dump($data_info);
//echo xdebug_time_index();
//echo xdebug_memory_usage();
if($request->isAjax()) {
    $HouseNumber1 = intval($_POST['max_house_number1']);
    $HouseNumber2 = intval($_POST['max_house_number2']);
    $HouseNumber3 = intval($_POST['max_house_number3']);
    $houseNumArr = array(
        array('level'=>'D','min'=>0,'max'=>$HouseNumber1),
        array('level'=>'C','min'=>$HouseNumber1,'max'=>$HouseNumber2),
        array('level'=>'B','min'=>$HouseNumber2,'max'=>$HouseNumber3),
        array('level'=>'A','min'=>$HouseNumber3,'max'=>'')
    );
   
    $number = $blockLevelHeatSetting->update($houseNumArr);
    if($number>0) {
        //写操作日志
        $operateRecord->insertData('79', 'update', 
                '更新小区等级设置的房源数量为'.$houseNumber.'成功', $_SESSION['esfadmin']['username']);
        echo json_encode(array('result'=>1));
    }else {
        //写操作日志
        $operateRecord->insertData('79', 'update', 
                '更新小区等级设置的房源数量为'.$houseNumber.'失败', $_SESSION['esfadmin']['username']);
        echo json_encode(array('result'=>0));
    }
    exit;
} else {
    $data_info = $blockLevelHeatSetting->findAll();
    include_once(Template("header"));
    include_once(Template("growth_nj/block_level_heat_setting"));
    include_once(Template("footer"));
}



?>
