<?php

    /*******************************************************************\
    |                                                                   |
    |   房开源（综合房产ERP管理系统）                                   |
    |                                                                   |
    |   © 2019-2023 http://www.kaidandashi.com/ All rights reserved.    |
    |                                                                   |
    |   本系统由淮南市银泰软件科技有限公司提供技术支持                  |
    |                                                                   |
    |   QQ号：984784483                                                 |
    |                                                                   |
    \*******************************************************************/

    namespace Admin\Controller;
    use Think\Controller;
    class ZiyuanController extends CommonController {
        // 中介黑名单管理
        public function zjhmd(){
            $map .= " where gongsiid=".session('gongsiid');
            $x = _rbac_lists_where(223,0);
            if ($x && $x != "all" && $x != "me") {
                $map .= " and bumen in ({$x})";
            }elseif ($x == "me") {
                $map .= " and id=".session('uid');
            }elseif ($x == false) {
                $map .= " and id=0";
            }
            $sousuo=I('sousuo');
            if ($sousuo) {//搜索
                $condition .= " where (sjh like '%$sousuo%' OR xm like '%$sousuo%')";
            }
            $Model = new \Think\Model();
            $count=$Model->query("select count(*) from __QTJJR__ a join (select id as e_id,ygmingcheng,bumen from __YONGHU__ {$map}) e on a.adduid=e.e_id {$condition}");
            $Page=new \Think\Page($count['0']['count(*)'],30);
            $show=$Page->show();
            $list="select * from __QTJJR__ a join (select id as e_id,ygmingcheng,bumen from __YONGHU__ {$map}) e on a.adduid=e.e_id {$condition} order by id DESC limit ".$Page->firstRow.','.$Page->listRows;
            $zjhmd=$Model->query($list);
            $this->assign('firstRow',$Page->firstRow);
            $this->assign('zjhmd',$zjhmd);
            $this->assign('count',$count);
            $this->assign('page',$show);
            $this->bumen=M('yonghu')->where(array('id'=>session('uid')))->getField('bumen');
            $this->display();
        }
        // 删除中介黑名单
        public function delzjhmd(){
            $id=I('id');
            $adduid=M('Qtjjr')->where(array('id'=>$id))->getField('adduid');
            $is_rbac = _rbac_btn_show(225,0,$adduid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $isok=M('Qtjjr')->where(array('id'=>$id))->delete();
            if ($isok){
                data_rizhi(3,8,$id,"","删除中介黑名单","","黑名单");
                $this->success('删除成功');
            }else{
                $this->error('删除失败');
            }
        }
        // 添加中介黑名单
        public function addzjhmd(){
            $is_rbac = _rbac_btn_show(226,0);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $bumen=M('yonghu')->where(array('id'=>session('uid')))->getField('bumen');
                $data['bumen']=$bumen;
                $data['xm']=I('xm');
                $data['sjh']=I('sjh');
                $data['gs']=I('gs');
                $data['bz']=I('bz');
                $data['tjsj']=time();
                $data['gongsiid']=session('gongsiid');
                $data['adduid']=session('uid');
                $isok=M('Qtjjr')->add($data);
                if ($isok) {
                    data_rizhi(3,1,$isok,"","添加中介黑名单","","黑名单");
                    $this->success('添加成功');
                }else{
                    $this->error('添加失败');
                }
            } else {
                $this->display();
            }
        }
        // 更新中介黑名单
        public function editzjhmd(){
            $id=I('id');
            $adduid=M('Qtjjr')->where(array('id'=>$id))->getField('adduid');
            $is_rbac = _rbac_btn_show(228,0,$adduid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $sjh = I('sjh');
                if (!preg_match("/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[8-9])\d{8}$|^0\d{2,3}-?\d{7,8}$/",$sjh)) {
                    $this->error('手机号请输入正确的手机号码或电话号码！');
                }
                $data['xm']=I('xm');
                $data['sjh']=$sjh;
                $data['gs']=I('gs');
                $data['bz']=I('bz');
                $xiugai = "";
                $zjhmd=M('Qtjjr')->where(array('id'=>$id))->find();
                if ($zjhmd['xm'] != I('xm') && ($zjhmd['xm'] || I('xm'))) {
                    $xiugai .= "姓名：[".$zjhmd['xm']."]=>[".I('xm')."]；";
                }
                if ($zjhmd['sjh'] != $sjh && ($zjhmd['sjh'] || $sjh)) {
                    $xiugai .= "手机号：[".$zjhmd['sjh']."]=>[".$sjh."]；";
                }
                if ($zjhmd['gs'] != I('gs') && ($zjhmd['gs'] || I('gs'))) {
                    $xiugai .= "所属中介公司：[".$zjhmd['gs']."]=>[".I('gs')."]；";
                }
                if ($zjhmd['bz'] != I('bz') && ($zjhmd['bz'] || I('bz'))) {
                    $xiugai .= "备注说明：[".$zjhmd['bz']."]=>[".I('bz')."]；";
                }
                $isok=M("Qtjjr")->where(array('id'=>$id))->save($data);
                if ($isok){
                    data_rizhi(3,2,$id,"",$xiugai,"","黑名单");
                    $this->success('更新成功');
                }else{
                    $this->error('更新失败');
                }
            } else {
                $this->zjhmd=M('Qtjjr')->where(array('id'=>$id))->find();
                $this->display();
            }
        }
        // 房源打印模板管理
        public function fydayinsz(){
            $map .= " where gongsiid=".session('gongsiid');
            $x = _rbac_lists_where(217,0);
            if ($x && $x != "all" && $x != "me") {
                $map .= " and bumen in ({$x})";
            }elseif ($x == "me") {
                $map .= " and id=".session('uid');
            }elseif ($x == false) {
                $map .= " and id=0";
            }
            $sousuo=I('sousuo');
            if ($sousuo) {//搜索
                $condition .= " where (mbmingcheng like '%$sousuo%')";
            }
            $Model = new \Think\Model();
            $count=$Model->query("select count(*) from __FYDAYIN__ a join (select id as e_id,ygmingcheng,bumen from __YONGHU__ {$map}) e on a.adduid=e.e_id {$condition}");
            $Page=new \Think\Page($count['0']['count(*)'],10);
            $show=$Page->show();
            $list="select * from __FYDAYIN__ a join (select id as e_id,ygmingcheng,bumen from __YONGHU__ {$map}) e on a.adduid=e.e_id {$condition} order by id DESC limit ".$Page->firstRow.','.$Page->listRows;
            $fydayinsz=$Model->query($list);
            $this->assign('firstRow',$Page->firstRow);
            $this->assign('fydayinsz',$fydayinsz);
            $this->assign('count',$count);
            $this->assign('page',$show);
            $this->display();
        }
        // 删除房源打印模板
        public function delmoban(){
            $id=I('id');
            $adduid=M('Fydayin')->where(array('id'=>$id))->getField('adduid');
            $mbbj=M('Fydayin')->where(array('id'=>$id))->getField('mbbj');
            $is_rbac = _rbac_btn_show(218,0,$adduid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $isok=M('Fydayin')->where(array('id'=>$id))->delete();
            if ($isok){
                unlink('./Upload/'.session('gongsiid').'/dayinmoban/'.$mbbj);
                data_rizhi(3,8,$id,"","删除房源打印模板","","房源打印模板");
                $this->success('删除成功');
            }else{
                $this->error('删除失败');
            }
        }
        // 添加房源打印模板
        public function addmoban(){
            $is_rbac = _rbac_btn_show(219,0);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $data['mbmingcheng']=I('mbmingcheng');
                $data['mbbj']=I('mbbj');
                $data['mbleixing']=I('mbleixing');
                $data['mobancss']=I('mobancss');
                $data['gxsj']=time();
                $data['gongsiid']=session('gongsiid');
                $data['adduid']=session('uid');
                $isok=M('Fydayin')->add($data);
                if ($isok) {
                    data_rizhi(3,1,$isok,"","添加房源打印模板","","房源打印模板");
                    $this->success('添加成功');
                }else{
                    $this->error('添加失败');
                }
            } else {
                $this->mbleixing=get_peizhi('leixing',0,1);
                $this->display();
            }
        }
        // 更新房源打印模板
        public function editmoban(){
            $id=I('id');
            $adduid=M('Fydayin')->where(array('id'=>$id))->getField('adduid');
            $is_rbac = _rbac_btn_show(221,0,$adduid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $data['mbmingcheng']=I('mbmingcheng');
                $data['mbbj']=I('mbbj');
                $data['mbleixing']=I('mbleixing');
                $data['mobancss']=I('mobancss');
                $data['gxsj']=time();
                $xiugai = "";
                $moban=M('Fydayin')->where(array('id'=>$id))->find();
                if ($moban['mbmingcheng'] != I('mbmingcheng') && ($moban['mbmingcheng'] || I('mbmingcheng'))) {
                    $xiugai .= "模板名称：[".$moban['mbmingcheng']."]=>[".I('mbmingcheng')."]；";
                }
                if ($moban['mbbj'] != $mbbj && ($moban['mbbj'] || $mbbj)) {
                    $xiugai .= "模板背景名：[".$moban['mbbj']."]=>[".$mbbj."]；";
                }
                if ($moban['mbleixing'] != I('mbleixing') && ($moban['mbleixing'] || I('mbleixing'))) {
                    $xiugai .= get_xiugai1("模板类型",$moban['mbleixing'],I('mbleixing'),'leixing');
                }
                if ($moban['mobancss'] != I('mobancss') && ($moban['mobancss'] || I('mobancss'))) {
                    $xiugai .= "模板css：[".$moban['mobancss']."]=>[".I('mobancss')."]；";
                }
                $isok=M("Fydayin")->where(array('id'=>$id))->save($data);
                if ($isok){
                    data_rizhi(3,2,$id,"",$xiugai,"","房源打印模板");
                    $this->success('更新成功');
                }else{
                    $this->error('更新失败');
                }
            } else {
                $this->mbleixing=get_peizhi('leixing',0,1);
                $this->moban=M('Fydayin')->where(array('id'=>$id))->find();
                $this->display();
            }
        }
        // 行政区列表
        public function xingzhengqu() {
            if (I('is_ajax')) {
                $field = I('field'); //排序字段名
                $order = I('order'); //排序方式
                $limit = I('limit',30,'int'); //每页条数
                $limit = $limit > 150 ? 150 : $limit;
                $map .= " where gongsiid=".session('gongsiid');
                $x = _rbac_lists_where(372,0);
                if ($x && $x != "all" && $x != "me") {
                    $map .= " and bumen in ({$x})";
                }elseif ($x == "me") {
                    $map .= " and id=".session('uid');
                }elseif ($x == false) {
                    $map .= " and id=0";
                }
                $condition="gongsiid=".session('gongsiid');
                $sousuo=I('sousuo');
                if ($sousuo) {
                    $condition.=" and ((xzqming like '%$sousuo%') or (pinyinjs like '%$sousuo%'))";
                }
                if ($field && $order) {
                    $xzqpx.="order by ".$field." ".$order;
                } else {
                    $xzqpx.="order by id DESC";
                }
                $Model = new \Think\Model();
                $count=$Model->query("select count(*) from (select * from __XINGZHENGQU__ where {$condition}) a join (select id as e_id from __YONGHU__ {$map}) e on a.whrid=e.e_id");
                $Page = new \Think\Page($count['0']['count(*)'],$limit);
                $list="select a.*,e.* from (select * from __XINGZHENGQU__ where {$condition}) a join (select id as e_id from __YONGHU__ {$map}) e on a.whrid=e.e_id ".$xzqpx." limit ".$Page->firstRow.','.$Page->listRows;
                $data=$Model->query($list);
                foreach ($data as $key => $value) {
                    $data[$key]['whbm'] = yhbm($value['whrid'],3);
                    $data[$key]['whr'] = zym($value['whrid'],5);
                    $data[$key]['tjr'] = zym($value['adduid'],5);
                    $is_rbacgx = _rbac_btn_show(375,0,$value['whrid']);
                    $is_rbaczy = _rbac_btn_show(533,0,$value['whrid']);
                    $is_rbacsc = _rbac_btn_show(377,0,$value['whrid']);
                    $data[$key]['rbacgx'] = $is_rbacgx ? 1 : 0;
                    $data[$key]['rbaczy'] = $is_rbaczy ? 1 : 0;
                    $data[$key]['rbacsc'] = $is_rbacsc ? 1 : 0;
                    $data[$key]['pinyinjs'] = $value['pinyinjs'] ? $value['pinyinjs'] : "——";
                    $data[$key]['dituzb'] = $value['dituzb'] ? $value['dituzb'] : "——";
                }
                $return_data = array(
                    'code'=>0,
                    'count'=>$count['0']['count(*)'],
                    'data'=>$data
                );
                $this->ajaxReturn($return_data);
            } else {
                $this->display();
            }
        }
        // 添加行政区
        public function addxzq(){
            $is_rbac = _rbac_node_show(373);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $condition['gongsiid']=session('gongsiid');
                $xzqming=I('xzqming');
                $condition['xzqming']=$xzqming;
                $cfxzq=M('xingzhengqu')->where($condition)->find();
                if($cfxzq){
                    $this->error('行政区已存在');
                }
                $whrid=I('whrid');
                $yhbm=yhbm($whrid,1);
                $yh = _rbac_btn_show(373,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $data['shijian']=time();
                $data['xzqming']=I('xzqming');
                $data['pinyinjs']=I('pinyinjs');
                $data['dituzb']=I('zuobiao');
                $data['whrid']=$whrid;
                $data['bumen']=$yhbm;
                $data['adduid']=session('uid');
                $data['gongsiid']=session('gongsiid');
                $isok=M('xingzhengqu')->add($data);
                if ($isok) {
                    data_rizhi(3,1,$isok,"","添加行政区","","行政区");
                    $this->success('添加成功');
                }else{
                    $this->error('添加失败');
                }
            } else {
                $this->display();
            }
        }
        // 更新行政区
        public function editxzq(){
            $id=I('id');
            $whrid=M('xingzhengqu')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(375,0,$whrid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $condition['gongsiid']=session('gongsiid');
                $condition['id']=array('neq',$id);
                $xzqming=I('xzqming');
                $condition['xzqming']=$xzqming;
                $cfxzq=M('xingzhengqu')->where($condition)->find();
                if($cfxzq){
                    $this->error('行政区已存在');
                }
                $whrid=I('whrid');
                $yhbm=yhbm($whrid,1);
                $yh = _rbac_btn_show(375,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $data['whrid']=$whrid;
                $data['bumen']=$yhbm;
                $data['dituzb']=I('zuobiao');
                $data['xzqming']=I('xzqming');
                $data['pinyinjs']=I('pinyinjs');
                $xiugai = "";
                $xzq=M('xingzhengqu')->where(array('id'=>$id))->find();
                if ($xzq['whrid'] != $whrid && ($xzq['whrid'] || $whrid)) {
                    $xiugai .= "维护人：[".zym($xzq['whrid'],5)."]=>[".zym($whrid,5)."]；";
                    $xiugai .= "维护部门：[".yhbm($xzq['whrid'],3)."]=>[".yhbm($whrid,3)."]；";
                }
                if ($xzq['dituzb'] != I('zuobiao') && ($xzq['dituzb'] || I('zuobiao'))) {
                    $xiugai .= "地图坐标：[".$xzq['dituzb']."]=>[".I('zuobiao')."]；";
                }
                if ($xzq['xzqming'] != I('xzqming') && ($xzq['xzqming'] || I('xzqming'))) {
                    $xiugai .= "行政区名：[".$xzq['xzqming']."]=>[".I('xzqming')."]；";
                }
                if ($xzq['pinyinjs'] != I('pinyinjs') && ($xzq['pinyinjs'] || I('pinyinjs'))) {
                    $xiugai .= "拼音检索：[".$xzq['pinyinjs']."]=>[".I('pinyinjs')."]；";
                }
                $isok=M("xingzhengqu")->where(array('id'=>$id))->save($data);
                if ($isok){
                    data_rizhi(3,2,$id,"",$xiugai,"","行政区");
                    $this->success('更新成功');
                }else{
                    $this->error('更新失败');
                }
            } else {
                $this->xingzhengqu=M('xingzhengqu')->where(array('id'=>$id))->find();
                $this->user=zym($this->xingzhengqu['whrid'],5);
                $this->display();
            }
        }
        // 删除行政区
        public function delxzq(){
            $id=I('id');
            $whrid=M('xingzhengqu')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(377,0,$whrid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $pqshu=M('pianqu')->where(array('ssxzq'=>$id))->count();
            $xqshu=M('xiaoqu')->where(array('ssxzq'=>$id))->count();
            $fyshu=M('fangyuan')->where(array('xingzhengqu'=>$id))->count();
            if ($pqshu==0 && $xqshu==0 && $fyshu==0){
                $isok=M('xingzhengqu')->where(array('id'=>$id))->delete();
            } else {
                $this->error('请先转移数据');
            }
            if ($isok){
                data_rizhi(3,8,$id,"","删除行政区","","行政区");
                $this->success('删除成功');
            }else{
                $this->error('删除失败');
            }
        }
        // 商圈列表
        public function Pianqu() {
            if (I('is_ajax')) {
                $field = I('field'); //排序字段名
                $order = I('order'); //排序方式
                $limit = I('limit',30,'int'); //每页条数
                $limit = $limit > 150 ? 150 : $limit;
                $map .= " where gongsiid=".session('gongsiid');
                $x = _rbac_lists_where(123,0);
                if ($x && $x != "all" && $x != "me") {
                    $map .= " and bumen in ({$x})";
                }elseif ($x == "me") {
                    $map .= " and id=".session('uid');
                }elseif ($x == false) {
                    $map .= " and id=0";
                }
                $condition="gongsiid=".session('gongsiid');
                $sousuo=I('sousuo');
                if ($sousuo) {
                    $condition.=" and ((pianqum like '%$sousuo%') or (pinyinjs like '%$sousuo%'))";
                }
                if ($field && $order) {
                    $pqpx.="order by ".$field." ".$order;
                } else {
                    $pqpx.="order by id DESC";
                }
                $Model = new \Think\Model();
                $count=$Model->query("select count(*) from (select * from __PIANQU__ where {$condition}) a join (select id as e_id from __YONGHU__ {$map}) e on a.whrid=e.e_id");
                $Page = new \Think\Page($count['0']['count(*)'],$limit);
                $list="select * from (select * from __PIANQU__ where {$condition}) a join (select id as e_id from __YONGHU__ {$map}) e on a.whrid=e.e_id ".$pqpx." limit ".$Page->firstRow.','.$Page->listRows;
                $data=$Model->query($list);
                foreach ($data as $key => $value) {
                    $data[$key]['xzqm'] = zym($value['ssxzq'],1);
                    $data[$key]['whbm'] = yhbm($value['whrid'],3);
                    $data[$key]['whr'] = zym($value['whrid'],5);
                    $data[$key]['tjr'] = zym($value['adduid'],5);
                    $is_rbacgx = _rbac_btn_show(126,0,$value['whrid']);
                    $is_rbaczy = _rbac_btn_show(533,0,$value['whrid']);
                    $is_rbacsc = _rbac_btn_show(128,0,$value['whrid']);
                    $data[$key]['rbacgx'] = $is_rbacgx ? 1 : 0;
                    $data[$key]['rbaczy'] = $is_rbaczy ? 1 : 0;
                    $data[$key]['rbacsc'] = $is_rbacsc ? 1 : 0;
                    $data[$key]['pinyinjs'] = $value['pinyinjs'] ? $value['pinyinjs'] : "——";
                    $data[$key]['dituzb'] = $value['dituzb'] ? $value['dituzb'] : "——";
                }
                $return_data = array(
                    'code'=>0,
                    'count'=>$count['0']['count(*)'],
                    'data'=>$data
                );
                $this->ajaxReturn($return_data);
            } else {
                $this->display();
            }
        }
        // 添加商圈
        public function addPianqu(){
            $is_rbac = _rbac_node_show(124);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $condition['gongsiid']=session('gongsiid');
                $ssxzq=I('ssxzq');
                $pianqum=I('pianqum');
                $condition['ssxzq']=$ssxzq;
                $condition['pianqum']=$pianqum;
                $cfpq=M('pianqu')->where($condition)->find();
                if($cfpq){
                    $this->error('商圈已存在');
                }
                $whrid=I('whrid');
                $yhbm=yhbm($whrid,1);
                $yh = _rbac_btn_show(124,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $data['shijian']=time();
                $data['pianqum']=I('pianqum');
                $data['pinyinjs']=I('pinyinjs');
                $data['ssxzq']=I('ssxzq');
                $data['dituzb']=I('zuobiao');
                $data['whrid']=$whrid;
                $data['bumen']=$yhbm;
                $data['adduid']=session('uid');
                $data['gongsiid']=session('gongsiid');
                $isok=M('pianqu')->add($data);
                if ($isok) {
                    data_rizhi(3,1,$isok,"","添加商圈","","商圈");
                    $this->success('添加成功');
                }else{
                    $this->error('添加失败');
                }
            } else {
                $this->ssxzq=M('xingzhengqu')->where(array('gongsiid'=>session('gongsiid')))->select();
                $this->display();
            }
        }
        // 更新商圈
        public function editPianqu(){
            $id=I('id');
            $whrid=M('pianqu')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(126,0,$whrid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $condition['gongsiid']=session('gongsiid');
                $condition['id']=array('neq',$id);
                $ssxzq=I('ssxzq');
                $pianqum=I('pianqum');
                $condition['ssxzq']=$ssxzq;
                $condition['pianqum']=$pianqum;
                $cfpq=M('pianqu')->where($condition)->find();
                if($cfpq){
                    $this->error('商圈已存在');
                }
                $whrid=I('whrid');
                $yhbm=yhbm($whrid,1);
                $yh = _rbac_btn_show(126,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $data['whrid']=$whrid;
                $data['bumen']=$yhbm;
                $data['pianqum']=I('pianqum');
                $data['pinyinjs']=I('pinyinjs');
                $data['ssxzq']=I('ssxzq');
                $data['dituzb']=I('zuobiao');
                $xiugai = "";
                $pianqu=M('pianqu')->where(array('id'=>$id))->find();
                if ($pianqu['whrid'] != $whrid && ($pianqu['whrid'] || $whrid)) {
                    $xiugai .= "维护人：[".zym($pianqu['whrid'],5)."]=>[".zym($whrid,5)."]；";
                    $xiugai .= "维护部门：[".yhbm($pianqu['whrid'],3)."]=>[".yhbm($whrid,3)."]；";
                }
                if ($pianqu['pianqum'] != I('pianqum') && ($pianqu['pianqum'] || I('pianqum'))) {
                    $xiugai .= "商圈名称：[".$pianqu['pianqum']."]=>[".I('pianqum')."]；";
                }
                if ($pianqu['pinyinjs'] != I('pinyinjs') && ($pianqu['pinyinjs'] || I('pinyinjs'))) {
                    $xiugai .= "拼音检索：[".$pianqu['pinyinjs']."]=>[".I('pinyinjs')."]；";
                }
                if ($pianqu['ssxzq'] != I('ssxzq') && ($pianqu['ssxzq'] || I('ssxzq'))) {
                    $xiugai .= "所属行政区：[".zym($pianqu['ssxzq'],1)."]=>[".zym(I('ssxzq'),1)."]；";
                }
                if ($pianqu['dituzb'] != I('zuobiao') && ($pianqu['dituzb'] || I('zuobiao'))) {
                    $xiugai .= "地图坐标：[".$pianqu['dituzb']."]=>[".I('zuobiao')."]；";
                }
                $isok=M("pianqu")->where(array('id'=>$id))->save($data);
                if ($isok){
                    data_rizhi(3,2,$id,"",$xiugai,"","商圈");
                    $this->success('更新成功');
                }else{
                    $this->error('更新失败');
                }
            } else {
                $this->pianqu=M('pianqu')->where(array('id'=>$id))->find();
                $this->user=zym($this->pianqu['whrid'],5);
                $this->ssxzq=M('xingzhengqu')->where(array('gongsiid'=>session('gongsiid')))->select();
                $this->display();
            }
        }
        // 删除商圈
        public function delPianqu(){
            $id=I('id');
            $whrid=M('pianqu')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(128,0,$whrid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $xqshu=M('xiaoqu')->where(array('sspianqu'=>$id))->count();
            $fyshu=M('fangyuan')->where(array('pianqu'=>$id))->count();
            if ($xqshu==0 && $fyshu==0){
                $isok=M('pianqu')->where(array('id'=>$id))->delete();
            } else {
                $this->error('请先转移数据');
            }
            if ($isok){
                data_rizhi(3,8,$id,"","删除商圈","","商圈");
                $this->success('删除成功');
            }else{
                $this->error('删除失败');
            }
        }
        // 楼盘字典
        public function Xiaoqu() {
            if (I('is_ajax')) {
                $field = I('field'); //排序字段名
                $order = I('order'); //排序方式
                $limit = I('limit',30,'int'); //每页条数
                $limit = $limit > 150 ? 150 : $limit;
                $condition .= " where e.gongsiid=".session('gongsiid');
                $x = _rbac_lists_where(129,0);
                if ($x && $x != "all" && $x != "me") {
                    $condition .= " and e.bumen in ({$x})";
                }elseif ($x == "me") {
                    $condition .= " and e.id=".session('uid');
                }elseif ($x == false) {
                    $condition .= " and e.id=0";
                }
                $ssxzq=I('ssxzq');
                $sspianqu=I('sspianqu');
                $lpleixing=I('lpleixing');
                $shtype=I('shtype');
                $sousuo=I('sousuo');
                if ($ssxzq) {
                    $condition.=" and a.ssxzq = ".$ssxzq;
                }
                if ($sspianqu) {
                    $condition.=" and a.sspianqu = ".$sspianqu;
                }
                if ($lpleixing) {
                    $condition.=" and a.lpleixing = ".$lpleixing;
                }
                if ($shtype) {
                    $condition.=" and a.shtype = ".$shtype;
                }
                if ($sousuo) {
                    $condition.=" and ((a.xiaoqum like '%$sousuo%') or (a.pinyinjs like '%$sousuo%'))";
                }
                if ($field && $order) {
                    $xqpx.="order by a.".$field." ".$order;
                } else {
                    $xqpx.="order by a.id DESC";
                }
                $Model = new \Think\Model();
                $count=$Model->query("select count(*) from __XIAOQU__ a join __YONGHU__ e on a.whrid=e.id {$condition}");
                $Page = new \Think\Page($count['0']['count(*)'],$limit);
                $list="select a.* from __XIAOQU__ a join __YONGHU__ e on a.whrid=e.id {$condition} ".$xqpx." limit ".$Page->firstRow.','.$Page->listRows;
                $data=$Model->query($list);
                foreach ($data as $key => $value) {
                    switch ($value['lpleixing']) {
                        case '1':
                            $lplxm = "写字楼";
                            break;
                        case '2':
                            $lplxm = "商铺";
                            break;
                        case '3':
                            $lplxm = "住宅";
                            break;
                        case '4':
                            $lplxm = "混合型";
                            break;
                        default:
                            $lplxm = "混合型";
                            break;
                    }
                    $data[$key]['lxm'] = $lplxm;
                    $data[$key]['img'] = get_x_img($value['id']);
                    $data[$key]['pqm'] = zym($value['sspianqu'],2);
                    $data[$key]['xzqm'] = zym($value['ssxzq'],1);
                    $data[$key]['whbm'] = yhbm($value['whrid'],3);
                    $data[$key]['whr'] = zym($value['whrid'],5);
                    $data[$key]['tjr'] = zym($value['adduid'],5);
                    $is_rbacsh = _rbac_btn_show(1050,0,$value['whrid']);
                    $is_rbaczd = _rbac_btn_show(503,0,$value['whrid']);
                    $is_rbacxq = _rbac_btn_show(175,0,$value['whrid']);
                    $is_rbacgx = _rbac_btn_show(132,0,$value['whrid']);
                    $is_rbaczy = _rbac_btn_show(533,0,$value['whrid']);
                    $is_rbacsc = _rbac_btn_show(134,0,$value['whrid']);
                    $data[$key]['rbacsh'] = $is_rbacsh ? 1 : 0;
                    $data[$key]['rbaczd'] = $is_rbaczd ? 1 : 0;
                    $data[$key]['rbacxq'] = $is_rbacxq ? 1 : 0;
                    $data[$key]['rbacgx'] = $is_rbacgx ? 1 : 0;
                    $data[$key]['rbaczy'] = $is_rbaczy ? 1 : 0;
                    $data[$key]['rbacsc'] = $is_rbacsc ? 1 : 0;
                }
                $return_data = array(
                    'code'=>0,
                    'count'=>$count['0']['count(*)'],
                    'data'=>$data
                );
                $this->ajaxReturn($return_data);
            } else {
                $this->lpleixing = get_peizhi('lpleixing',0,1);
                $this->ssxzq = M('xingzhengqu')->select();
                $this->display();
            }
        }
        // 添加楼盘
        public function addXiaoqu(){
            $is_rbac = _rbac_node_show(130);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                if (I('youzheng') && !is_numeric(I('youzheng'))) {
                    $this->error('邮政编码只能为数字！');
                } 
                
                $condition['gongsiid']=session('gongsiid');
                $ssxzq=I('ssxzq');
                $sspianqu=I('sspianqu');
                $xiaoqum=I('xiaoqum');
                $condition['ssxzq']=$ssxzq;
                $condition['sspianqu']=$sspianqu;
                $condition['xiaoqum']=$xiaoqum;
                $cfxq=M('xiaoqu')->where($condition)->find();
                if($cfxq){
                    $this->error('楼盘已存在');
                }
                $bhao = 'LP-';
                $bh = M('bianhao')->where(array('id'=>3))->setInc('bianhao');
                $bh1 = M('bianhao')->where(array('id'=>3))->getField('bianhao');
                $data['shijian']=time();
                $data['ssxzq']=$ssxzq;
                $data['bianhao']=$bhao.$bh1;
                $data['dituzb']=I('dituzb');
                $data['jiedao']=I('jiedao');
                $data['jianjie']=I('jianjie');
                $data['xiaoqum']=$xiaoqum;
                if (I('csjunjia')) {
                    $data['csjunjia']=I('csjunjia');
                }
                if (I('czjunjia')) {
                    $data['czjunjia']=I('czjunjia');
                }
                $whrid=I('whrid');
                $yhbm=yhbm($whrid,1);
                $yh = _rbac_btn_show(130,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $lpleixing = I('lpleixing');
                $lplxs = "1,2,3,4";
                $lplxs1 = explode(",",$lplxs);
                if (in_array($lpleixing,$lplxs1)) {
                    $lpleixing = $lpleixing;
                } else {
                    $lpleixing = 4;
                }
                $data['pinyinjs']=I('pinyinjs');
                $data['sspianqu']=$sspianqu;
                $data['xiaoqudz']=I('xiaoqudz');
                $data['youzheng']=I('youzheng');
                $data['lpleixing']=$lpleixing;
                $data['whrid']=$whrid;
                $data['bumen']=$yhbm;
                $data['adduid']=session('uid');
                $data['gongsiid']=session('gongsiid');
                $isok=M("xiaoqu")->add($data);
                if ($isok) {
                    data_rizhi(3,1,$isok,$data['bianhao'],"添加楼盘",U('ziyuan/xiaoqurr',array('id'=>$isok)),"楼盘");
                    $this->success('已添加，请等待审核！');
                }else{
                    $this->error('添加失败');
                }
            } else {
                $this->ssxzq=M('xingzhengqu')->where(array('gongsiid'=>session('gongsiid')))->select();
                $this->display();
            }
        }
        // 楼盘审核
        public function lpshenhe(){
            $id = I('id');
            $whrid = M('xiaoqu')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(1050,0,$whrid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $shtype = I('shtype');
                $cfsh = M('xiaoqu')->where(array('id'=>$id))->getField('shtype');
                if ($cfsh == 1 || $cfsh == 2){
                    $this->error('已审核！');
                }
                if ($shtype == ""){
                    $this->error('请选择审核意见！');
                }
                $isok = M('xiaoqu')->where(array('id'=>$id))->setField('shtype',$shtype);
                if ($isok) {
                    $xqbh = M('xiaoqu')->where(array('id'=>$id))->getField('bianhao');
                    if ($shtype == 1) {
                        $xiugai = "通过了";
                    }
                    if ($shtype == 2) {
                        $xiugai = "驳回了";
                    }
                    $xiugai .= $xqbh."的添加。";
                    data_rizhi(3,18,$id,$xqbh,$xiugai,U('xiaoqu/xiaoqurr',array('id'=>$id)),"楼盘");
                    $this->success('审核成功');
                } else {
                    $this->error('审核失败！');
                }
            } else {
                $this->display();
            }
        }
        // 更新楼盘
        public function editXiaoqu(){
            $id = I('id');
            $xiaoqu = M('xiaoqu')->where(array('id'=>$id))->find();
            $is_rbac = _rbac_btn_show(132,0,$xiaoqu['whrid']);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if ($xiaoqu['shtype'] == 3) {
                $this->assign("error","楼盘待审核！");
                $this->display('ajax/error');
                die;
            }
            if (IS_POST) {
                $condition['gongsiid'] = session('gongsiid');
                $condition['id'] = array('neq',$id);
                $ssxzq = I('ssxzq');
                $sspianqu = I('sspianqu');
                $xiaoqum = I('xiaoqum');
                $condition['ssxzq'] = $ssxzq;
                $condition['sspianqu'] = $sspianqu;
                $condition['xiaoqum'] = $xiaoqum;
                $cfxq = M('xiaoqu')->where($condition)->find();
                if($cfxq){
                    $this->error('楼盘已存在');
                }
                $whrid = I('whrid');
                $yhbm = yhbm($whrid,1);
                $yh = _rbac_btn_show(132,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $lpleixing = I('lpleixing');
                $lplxs = "1,2,3,4";
                $lplxs1 = explode(",",$lplxs);
                if (in_array($lpleixing,$lplxs1)) {
                    $lpleixing = $lpleixing;
                } else {
                    $lpleixing = 4;
                }
                $data['whrid'] = $whrid;
                $data['bumen'] = $yhbm;
                $data['ssxzq'] = $ssxzq;
                $data['dituzb'] = I('dituzb');
                $data['jiedao'] = I('jiedao');
                $data['jianjie'] = I('jianjie');
                $data['lpleixing'] = $lpleixing;
                $data['xiaoqum'] = $xiaoqum;
                if (I('csjunjia')) {
                    $data['csjunjia'] = I('csjunjia');
                }
                if (I('czjunjia')) {
                    $data['czjunjia']=I('czjunjia');
                }
                $data['pinyinjs'] = I('pinyinjs');
                $data['sspianqu'] = $sspianqu;
                $data['xiaoqudz'] = I('xiaoqudz');
                $data['youzheng'] = I('youzheng');
                $xiugai = "";
                if ($xiaoqu['xiaoqum'] != $xiaoqum && ($xiaoqu['xiaoqum'] || $xiaoqum)) {
                    $xiugai .= "楼盘名称：[".$xiaoqu['xiaoqum']."]=>[".$xiaoqum."]；";
                }
                if ($xiaoqu['lpleixing'] != $lpleixing && ($xiaoqu['lpleixing'] || $lpleixing)) {
                    switch ($xiaoqu['lpleixing']) {
                        case '1':
                            $xgqlplx = "写字楼";
                            break;
                        case '2':
                            $xgqlplx = "商铺";
                            break;
                        case '3':
                            $xgqlplx = "住宅";
                            break;
                        case '4':
                            $xgqlplx = "混合型";
                            break;
                        default:
                            $xgqlplx = "混合型";
                            break;
                    }
                    switch ($lpleixing) {
                        case '1':
                            $xghlplx = "写字楼";
                            break;
                        case '2':
                            $xghlplx = "商铺";
                            break;
                        case '3':
                            $xghlplx = "住宅";
                            break;
                        case '4':
                            $lxbd = 1;
                            $xghlplx = "混合型";
                            break;
                        default:
                            $lxbd = 1;
                            $xghlplx = "混合型";
                            break;
                    }
                    if ($lxbd != 1) {
                        $xghlxbg = "，（楼盘下所有座栋、房间的类型均更改为".$xghlplx."）；";
                    }
                    $xiugai .= "物业类型：[".$xgqlplx."]=>[".$xghlplx."]".$xghlxbg."；";
                }
                if ($xiaoqu['csjunjia'] != I('csjunjia') && ($xiaoqu['csjunjia'] || I('csjunjia'))) {
                    $xiugai .= "出售均价：[".$xiaoqu['csjunjia']."元 / m²]=>[".I('csjunjia')."元 / m²]；";
                }
                if ($xiaoqu['czjunjia'] != I('czjunjia') && ($xiaoqu['czjunjia'] || I('czjunjia'))) {
                    $xiugai .= "出租均价：[".$xiaoqu['czjunjia']."元 / 月]=>[".I('czjunjia')."元 / 月]；";
                }
                if ($xiaoqu['ssxzq'] != $ssxzq && ($xiaoqu['ssxzq'] || $ssxzq)) {
                    $xiugai .= "所属行政区：[".zym($xiaoqu['ssxzq'],1)."]=>[".zym($ssxzq,1)."]；";
                }
                if ($xiaoqu['sspianqu'] != $sspianqu && ($xiaoqu['sspianqu'] || $sspianqu)) {
                    $xiugai .= "所属商圈：[".zym($xiaoqu['sspianqu'],2)."]=>[".zym($sspianqu,2)."]；";
                }
                if ($xiaoqu['whrid'] != $whrid && ($xiaoqu['whrid'] || $whrid)) {
                    $xiugai .= "维护人：[".zym($xiaoqu['whrid'],5)."]=>[".zym($whrid,5)."]；";
                    $xiugai .= "维护部门：[".yhbm($xiaoqu['whrid'],3)."]=>[".yhbm($whrid,3)."]；";
                }
                if ($xiaoqu['youzheng'] != I('youzheng') && ($xiaoqu['youzheng'] || I('youzheng'))) {
                    $xiugai .= "邮政编码：[".$xiaoqu['youzheng']."]=>[".I('youzheng')."]；";
                }
                if ($xiaoqu['dituzb'] != I('dituzb') && ($xiaoqu['dituzb'] || I('dituzb'))) {
                    $xiugai .= "地图坐标：[".$xiaoqu['dituzb']."]=>[".I('dituzb')."]；";
                }
                if ($xiaoqu['pinyinjs'] != I('pinyinjs') && ($xiaoqu['pinyinjs'] || I('pinyinjs'))) {
                    $xiugai .= "拼音检索：[".$xiaoqu['pinyinjs']."]=>[".I('pinyinjs')."]；";
                }
                if ($xiaoqu['jiedao'] != I('jiedao') && ($xiaoqu['jiedao'] || I('jiedao'))) {
                    $xiugai .= "街道：[".$xiaoqu['jiedao']."]=>[".I('jiedao')."]；";
                }
                if ($xiaoqu['xiaoqudz'] != I('xiaoqudz') && ($xiaoqu['xiaoqudz'] || I('xiaoqudz'))) {
                    $xiugai .= "楼盘地址：[".$xiaoqu['xiaoqudz']."]=>[".I('xiaoqudz')."]；";
                }
                if ($xiaoqu['jianjie'] != I('jianjie') && ($xiaoqu['jianjie'] || I('jianjie'))) {
                    $xiugai .= "楼盘简介：[".$xiaoqu['jianjie']."]=>[".I('jianjie')."]；";
                }
                $isok=M("xiaoqu")->where(array('id'=>$id))->save($data);
                if ($isok){
                    data_rizhi(3,2,$id,$xiaoqu['bianhao'],$xiugai,U('ziyuan/xiaoqurr',array('id'=>$id)),"楼盘");
                    if ($xiaoqu['shtype'] == 2) {
                        M("xiaoqu")->where(array('id'=>$id))->setField('shtype',3);
                        $this->success('已更新，请等待审核！');
                    } else {
                        if ($lxbd != 1) {
                            M('zdxinxi')->where(array('xqid'=>$id))->setField('zdleixing',$lpleixing);
                            M('fjxinxi')->where(array('xqid'=>$id))->setField('fjleixing',$lpleixing);
                            M('fjhbxx')->where(array('xqid'=>$id))->setField('fjleixing',$lpleixing);
                        }
                        $this->success('更新成功');
                    }
                }else{
                    $this->error('更新失败');
                }
            } else {
                $this->xiaoqu=$xiaoqu;
                $this->user=zym($xiaoqu['whrid'],5);
                $this->ssxzq=M('xingzhengqu')->where(array('gongsiid'=>session('gongsiid')))->select();
                $this->sspianqu=M('pianqu')->where(array('gongsiid'=>session('gongsiid'),'ssxzq'=>$xiaoqu['ssxzq']))->select();
                $this->display();
            }
        }
        // 删除楼盘
        public function delXiaoqu(){
            $id=I('id');
            $whrid=M('xiaoqu')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(134,0,$whrid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $zdshu=M('zdxinxi')->where(array('xqid'=>$id))->count();
            $fyshu=M('fangyuan')->where(array('xiaoqu'=>$id))->count();
            if ($zdshu==0 && $fyshu==0){
                $isok=M('xiaoqu')->where(array('id'=>$id))->delete();
            } else {
                $this->error('请先转移数据');
            }
            if ($isok){
                $xqbh=M('xiaoqu')->where(array('id'=>$id))->getField('bianhao');
                data_rizhi(3,8,$id,$xqbh,"删除楼盘","","楼盘");
                $this->success('删除成功');
            }else{
                $this->error('删除失败');
            }
        }
        // 学区列表
        public function Xuequ() {
            if (I('is_ajax')) {
                $field = I('field'); //排序字段名
                $order = I('order'); //排序方式
                $limit = I('limit',30,'int'); //每页条数
                $limit = $limit > 150 ? 150 : $limit;
                $map .= " where gongsiid=".session('gongsiid');
                $x = _rbac_lists_where(135,0);
                if ($x && $x != "all" && $x != "me") {
                    $map .= " and bumen in ({$x})";
                }elseif ($x == "me") {
                    $map .= " and id=".session('uid');
                }elseif ($x == false) {
                    $map .= " and id=0";
                }
                $condition="gongsiid=".session('gongsiid');
                $sousuo=I('sousuo');
                if ($sousuo) {
                    $condition.=" and ((xuexiaom like '%$sousuo%') or (pinyinjs like '%$sousuo%'))";
                }
                if ($field && $order) {
                    $pqpx.="order by ".$field." ".$order;
                } else {
                    $pqpx.="order by id DESC";
                }
                $Model = new \Think\Model();
                $count=$Model->query("select count(*) from (select * from __XUEQU__ where {$condition}) a join (select id as e_id from __YONGHU__ {$map}) e on a.whrid=e.e_id");
                $Page = new \Think\Page($count['0']['count(*)'],$limit);
                $list="select * from (select * from __XUEQU__ where {$condition}) a join (select id as e_id from __YONGHU__ {$map}) e on a.whrid=e.e_id ".$pqpx." limit ".$Page->firstRow.','.$Page->listRows;
                $data=$Model->query($list);
                foreach ($data as $key => $value) {
                    $data[$key]['ssbm'] = zym($value['bumen'],6);
                    $data[$key]['whbm'] = yhbm($value['whrid'],3);
                    $data[$key]['whr'] = zym($value['whrid'],5);
                    $data[$key]['tjr'] = zym($value['adduid'],5);
                    $is_rbacgx = _rbac_btn_show(138,0,$value['whrid']);
                    $is_rbacsc = _rbac_btn_show(140,0,$value['whrid']);
                    $data[$key]['rbacgx'] = $is_rbacgx ? 1 : 0;
                    $data[$key]['rbacsc'] = $is_rbacsc ? 1 : 0;
                    $data[$key]['duikou'] = $value['duikou'] ? $value['duikou'] : "——";
                    $data[$key]['pinyinjs'] = $value['pinyinjs'] ? $value['pinyinjs'] : "——";
                }
                $return_data = array(
                    'code'=>0,
                    'count'=>$count['0']['count(*)'],
                    'data'=>$data
                );
                $this->ajaxReturn($return_data);
            } else {
                $this->display();
            }
        }
        // 添加学区
        public function addXuequ(){
            $is_rbac = _rbac_node_show(136);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $condition['gongsiid']=session('gongsiid');
                $xuexiaom=I('xuexiaom');
                $condition['xuexiaom']=$xuexiaom;
                $cfxzq=M('xuequ')->where($condition)->find();
                if($cfxzq){
                    $this->error('学校已存在');
                }
                $whrid=I('whrid');
                $yhbm=yhbm($whrid,1);
                $yh = _rbac_btn_show(136,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $data['xuexiaom']=$xuexiaom;
                $data['pinyinjs']=I('pinyinjs');
                $data['xuexiaodz']=I('xuexiaodz');
                $data['duikou']=I('duikou');
                $data['shijian']=time();
                $data['whrid']=$whrid;
                $data['bumen']=$yhbm;
                $data['adduid']=session('uid');
                $data['gongsiid']=session('gongsiid');
                $isok=M('Xuequ')->add($data);
                if ($isok) {
                    data_rizhi(3,1,$isok,"","添加学区","","学区");
                    $this->success('添加成功');
                }else{
                    $this->error('添加失败');
                }
            } else {
                $this->display();
            }
        }
        // 更新学区
        public function editXuequ(){
            $id=I('id');
            $whrid=M('xuequ')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(138,0,$whrid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $condition['gongsiid']=session('gongsiid');
                $condition['id']=array('neq',$id);
                $xuexiaom=I('xuexiaom');
                $condition['xuexiaom']=$xuexiaom;
                $cfxzq=M('xuequ')->where($condition)->find();
                if($cfxzq){
                    $this->error('学校已存在');
                }
                $whrid=I('whrid');
                $yhbm=yhbm($whrid,1);
                $yh = _rbac_btn_show(138,0,$whrid);
                if (!$yh || !$whrid) {
                    $this->error('异常错误！');
                }
                $data['whrid']=$whrid;
                $data['bumen']=$yhbm;
                $data['xuexiaom']=$xuexiaom;
                $data['pinyinjs']=I('pinyinjs');
                $data['xuexiaodz']=I('xuexiaodz');
                $data['duikou']=I('duikou');
                $xiugai = "";
                $xuequ=M('xuequ')->where(array('id'=>$id))->find();
                if ($xuequ['whrid'] != $whrid && ($xuequ['whrid'] || $whrid)) {
                    $xiugai .= "维护人：[".zym($xuequ['whrid'],5)."]=>[".zym($whrid,5)."]；";
                    $xiugai .= "维护部门：[".yhbm($xuequ['whrid'],3)."]=>[".yhbm($whrid,3)."]；";
                }
                if ($xuequ['xuexiaom'] != I('xuexiaom') && ($xuequ['xuexiaom'] || I('xuexiaom'))) {
                    $xiugai .= "学校名称：[".$xuequ['xuexiaom']."]=>[".I('xuexiaom')."]；";
                }
                if ($xuequ['pinyinjs'] != I('pinyinjs') && ($xuequ['pinyinjs'] || I('pinyinjs'))) {
                    $xiugai .= "拼音检索：[".$xuequ['pinyinjs']."]=>[".I('pinyinjs')."]；";
                }
                if ($xuequ['xuexiaodz'] != I('xuexiaodz') && ($xuequ['xuexiaodz'] || I('xuexiaodz'))) {
                    $xiugai .= "学校地址：[".$xuequ['xuexiaodz']."]=>[".I('xuexiaodz')."]；";
                }
                if ($xuequ['duikou'] != I('duikou') && ($xuequ['duikou'] || I('duikou'))) {
                    $xiugai .= "对口学校：[".$xuequ['duikou']."]=>[".I('duikou')."]；";
                }
                $isok=M("Xuequ")->where(array('id'=>$id))->save($data);
                if ($isok){
                    data_rizhi(3,2,$id,"",$xiugai,"","学区");
                    $this->success('更新成功');
                }else{
                    $this->error('更新失败');
                }
            } else {
                $this->xuequ=M('Xuequ')->where(array('id'=>$id))->find();
                $this->user=zym($this->xuequ['whrid'],5);
                $this->display();
            }
        }
        // 删除学区
        public function delXuequ(){
            $id=I('id');
            $whrid=M('xuequ')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(140,0,$whrid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $isok=M('Xuequ')->where(array('id'=>$id))->delete();
            if ($isok){
                data_rizhi(3,8,$id,"","删除学区","","学区");
                $this->success('删除成功');
            }else{
                $this->error('删除失败');
            }
        }
        // 楼盘详情
        public function xiaoqurr(){
            $id=I('id');
            $whrid=M('xiaoqu')->where(array('id'=>$id))->getField('whrid');
            $is_rbac = _rbac_btn_show(175,0,$whrid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            $xiaoqu=M('xiaoqu')->where(array('id'=>$id))->find();
            $this->pianqu=zym($xiaoqu['sspianqu'],2);
            $this->xingzhengqu=zym($xiaoqu['ssxzq'],1);
            $this->xuexiao=zym($xiaoqu['ssxuexiao'],4);
            $this->xiaoqu=$xiaoqu;
            $this->zdshu=M('zdxinxi')->where(array('gongsiid'=>session('gongsiid'),'xqid'=>$id))->count();
            $this->fjshu=M('fjxinxi')->where(array('gongsiid'=>session('gongsiid'),'xqid'=>$id))->count();
            $this->ktlx=get_peizhi('lpktlx',$xiaoqu['ktlx'],3);
            $this->type=get_peizhi('lptype',$xiaoqu['type'],3);
            $this->wuyelx=get_peizhi('wuyelx',$xiaoqu['wuyelx'],3);
            $this->wuyezz=get_peizhi('wuyezz',$xiaoqu['wuyezz'],3);
            $this->xmjibie=get_peizhi('xmjibie',$xiaoqu['xmjibie'],3);
            $this->gongqifs=get_peizhi('gongqifs',$xiaoqu['gongqifs'],3);
            $this->kangzhen=get_peizhi('kangzhen',$xiaoqu['kangzhen'],3);
            $this->waiqiang=get_peizhi('waiqiang',$xiaoqu['waiqiang'],3);
            $this->ceweizldw=get_peizhi('ceweizldw',$xiaoqu['ceweizldw'],3);
            $this->gongdianlx=get_peizhi('gongdianlx',$xiaoqu['gongdianlx'],3);
            $this->gongshuilx=get_peizhi('gongshuilx',$xiaoqu['gongshuilx'],3);
            $this->spjzleixing=get_peizhi('spjzleixing',$xiaoqu['spjzleixing'],3);
            $Model = new \Think\Model();
            if ($xiaoqu['jiegou']) {
                $condition1="pzming = 'jiegou' and lxid in (".$xiaoqu['jiegou'].")";
                $this->jiegou=$Model->query("select * from __PEIZHI__ where {$condition1} order by xsshunxu asc");
            }
            if ($xiaoqu['yongtu']) {
                $condition2="pzming = 'yongtu' and lxid in (".$xiaoqu['yongtu'].")";
                $this->yongtu=$Model->query("select * from __PEIZHI__ where {$condition2} order by xsshunxu asc");
            }
            if ($xiaoqu['dianshi']) {
                $condition3="pzming = 'dianshi' and lxid in (".$xiaoqu['dianshi'].")";
                $this->dianshi=$Model->query("select * from __PEIZHI__ where {$condition3} order by xsshunxu asc");
            }
            if ($xiaoqu['tongxun']) {
                $condition4="pzming = 'tongxun' and lxid in (".$xiaoqu['tongxun'].")";
                $this->tongxun=$Model->query("select * from __PEIZHI__ where {$condition4} order by xsshunxu asc");
            }
            if ($xiaoqu['chanquan']) {
                $condition5="pzming = 'chanquan' and lxid in (".$xiaoqu['chanquan'].")";
                $this->chanquan=$Model->query("select * from __PEIZHI__ where {$condition5} order by xsshunxu asc");
            }
            if ($xiaoqu['lrpeitao']) {
                $condition6="pzming = 'lrpeitao' and lxid in (".$xiaoqu['lrpeitao'].")";
                $this->lrpeitao=$Model->query("select * from __PEIZHI__ where {$condition6} order by xsshunxu asc");
            }
            if ($xiaoqu['sqanquan']) {
                $condition7="pzming = 'sqanquan' and lxid in (".$xiaoqu['sqanquan'].")";
                $this->sqanquan=$Model->query("select * from __PEIZHI__ where {$condition7} order by xsshunxu asc");
            }
            if ($xiaoqu['cainuanfs']) {
                $condition8="pzming = 'cainuanfs' and lxid in (".$xiaoqu['cainuanfs'].")";
                $this->cainuanfs=$Model->query("select * from __PEIZHI__ where {$condition8} order by xsshunxu asc");
            }
            if ($xiaoqu['fwleixing']) {
                $condition9="pzming = 'fwleixing' and lxid in (".$xiaoqu['fwleixing'].")";
                $this->fwleixing=$Model->query("select * from __PEIZHI__ where {$condition9} order by xsshunxu asc");
            }
            if ($xiaoqu['wldibanlx']) {
                $condition10="pzming = 'wldibanlx' and lxid in (".$xiaoqu['wldibanlx'].")";
                $this->wldibanlx=$Model->query("select * from __PEIZHI__ where {$condition10} order by xsshunxu asc");
            }
            if ($xiaoqu['gongshuifs']) {
                $condition11="pzming = 'gongshuifs' and lxid in (".$xiaoqu['gongshuifs'].")";
                $this->gongshuifs=$Model->query("select * from __PEIZHI__ where {$condition11} order by xsshunxu asc");
            }
            $this->display();
        }
        // 修改楼盘详情
        public function xiugaixiaoqu(){
            $id = I('id');
            $xiaoqu = M('xiaoqu')->where(array('id'=>$id))->find();
            $is_rbac = _rbac_btn_show(176,0,$xiaoqu['whrid']);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if ($xiaoqu['shtype'] == 3) {
                $this->assign("error","楼盘待审核！");
                $this->display('ajax/error');
                die;
            }
            $bjlpxq = I('bjlpxq');
            if (IS_POST) {
                $xiugai = "";
                $Model = new \Think\Model();
                switch ($bjlpxq) {
                    case '1':
                        $condition['gongsiid'] = session('gongsiid');
                        $condition['id'] = array('neq',$id);
                        $ssxzq = I('ssxzq');
                        $sspianqu = I('sspianqu');
                        $xiaoqum = I('xiaoqum');
                        $condition['ssxzq'] = $ssxzq;
                        $condition['sspianqu'] = $sspianqu;
                        $condition['xiaoqum'] = $xiaoqum;
                        $cfxq = M('xiaoqu')->where($condition)->find();
                        if($cfxq){
                            $this->error('楼盘已存在');
                        }
                        $whrid = I('whrid');
                        $yhbm = yhbm($whrid,1);
                        $yh = _rbac_btn_show(176,0,$whrid);
                        if (!$yh || !$whrid) {
                            $this->error('异常错误！');
                        }
                        $lpleixing = I('lpleixing');
                        $rongjilv = I('rongjilv');
                        $lvhualv = I('lvhualv');
                        $zhandimj = I('zhandimj');
                        $jianzhumj = I('jianzhumj');
                        $jianzaond = I('jianzaond');
                        $csjunjia = I('csjunjia');
                        $czjunjia = I('czjunjia');
                        $chewei = I('chewei');
                        if ($chewei) {
                            $dshangtcwsl = I('dshangtcwsl');
                            $dxiatcwsl = I('dxiatcwsl');
                            $dshangtcwsj = I('dshangtcwsj');
                            $dxiatcwsj = I('dxiatcwsj');
                            $dshangtcwzl = I('dshangtcwzl');
                            $dxiatcwzl = I('dxiatcwzl');
                            $ceweizldw = I('ceweizldw');
                            $cheweiyzj = I('cheweiyzj');
                        }
                        $dianti = I('dianti');
                        if ($dianti) {
                            $diantifq = I('diantifq');
                        }
                        $youzheng = I('youzheng');
                        $wuyefei = I('wuyefei');
                        $wuyedh = I('wuyedh');
                        $lplxs = "1,2,3,4";
                        $lplxs1 = explode(",",$lplxs);
                        if (in_array($lpleixing,$lplxs1)) {
                            $lpleixing = $lpleixing;
                        } else {
                            $lpleixing = 4;
                        }
                        if ($rongjilv) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$rongjilv)) {
                                $this->error('容积率请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($lvhualv) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$lvhualv)) {
                                $this->error('绿化率请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($zhandimj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$zhandimj)) {
                                $this->error('占地面积请输入＞0且≤一百万的数字（限两位小数）！');
                            }
                        }
                        if ($jianzhumj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,6})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{7})(\.[0][0]{0,1})?$/",$jianzhumj)) {
                                $this->error('建筑面积请输入＞0且≤一千万的数字（限两位小数）！');
                            }
                        }
                        if ($jianzaond) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$jianzaond)) {
                                $this->error('建造年代请输入＞0且≤一万的整数！');
                            }
                        }
                        if ($csjunjia) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$csjunjia)) {
                                $this->error('出售均价请输入＞0且≤十亿的数字（限六位小数）！');
                            }
                        }
                        if ($czjunjia) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$czjunjia)) {
                                $this->error('出租均价请输入＞0且≤一百万的数字（限两位小数）！');
                            }
                        }
                        if ($chewei) {
                            $chewei = 1;
                            if ($dshangtcwsl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dshangtcwsl)) {
                                    $this->error('地上车位数请输入＞0且≤一万的整数！');
                                }
                            }
                            if ($dxiatcwsl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dxiatcwsl)) {
                                    $this->error('地下车位数请输入＞0且≤一万的整数！');
                                }
                            }
                            if ($dshangtcwsj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$dshangtcwsj)) {
                                    $this->error('地上车位售价请输入＞0且≤十亿的数字（限六位小数）！');
                                }
                            }
                            if ($dxiatcwsj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$dxiatcwsj)) {
                                    $this->error('地下车位售价请输入＞0且≤十亿的数字（限六位小数）！');
                                }
                            }
                            if ($dshangtcwzl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$dshangtcwzl)) {
                                    $this->error('地上车位租价请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                                if (!$ceweizldw) {
                                    $this->error('请输入车位租赁单位！');
                                }
                            }
                            if ($dxiatcwzl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$dxiatcwzl)) {
                                    $this->error('地下车位租价请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                                if (!$ceweizldw) {
                                    $this->error('请输入车位租赁单位！');
                                }
                            }
                            if ($cheweiyzj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$cheweiyzj)) {
                                    $this->error('车位月租金请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                            }
                        } else {
                            $chewei = 0;
                        }
                        if ($dianti) {
                            $dianti = 1;
                            if ($diantifq) {
                                $diantifq = 1;
                            } else {
                                $diantifq = 0;
                            }
                        } else {
                            $dianti = 0;
                        }
                        if ($youzheng) {
                            if (!preg_match("/^$|^[0-9]{6}$/",$youzheng)) {
                                $this->error('请输入正确的邮政编码！');
                            }
                        }
                        if ($wuyefei) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{5})(\.[0][0]{0,1})?$/",$wuyefei)) {
                                $this->error('物业费请输入＞0且≤十万的数字（限两位小数）！');
                            }
                        }
                        if ($wuyedh) {
                            if (strstr($wuyedh,'；')) {
                                $wuyedh1 = explode("；",$wuyedh);
                                foreach ($wuyedh1 as $key => $value) {
                                    if (!preg_match("/^$|^0\d{2,3}-?\d{7,8}$/",$value)) {
                                        $this->error('物业电话请输入正确的电话号码！');
                                    }
                                }
                            } else {
                                if (!preg_match("/^$|^0\d{2,3}-?\d{7,8}$/",$wuyedh)) {
                                    $this->error('物业电话请输入正确的电话号码！');
                                }
                            }
                        }
                        $data['xiaoqum'] = $xiaoqum;
                        $data['lpleixing'] = $lpleixing;
                        $data['ssxzq'] = $ssxzq;
                        $data['sspianqu'] = $sspianqu;
                        $data['whrid'] = $whrid;
                        $data['bumen'] = $yhbm;
                        $data['pinyinjs'] = I('pinyinjs');
                        $data['xiaoqubm'] = I('xiaoqubm');
                        $data['rongjilv'] = $rongjilv;
                        $data['lvhualv'] = $lvhualv;
                        $data['zhandimj'] = $zhandimj;
                        $data['jianzhumj'] = $jianzhumj;
                        $data['jianzaond'] = $jianzaond;
                        $data['csjunjia'] = $csjunjia;
                        $data['czjunjia'] = $czjunjia;
                        $data['gongdianlx'] = I('gongdianlx');
                        $data['gongshuilx'] = I('gongshuilx');
                        $data['gongqifs'] = I('gongqifs');
                        $data['chewei'] = $chewei;
                        if ($chewei) {
                            $data['dshangtcwsl'] = $dshangtcwsl;
                            $data['dxiatcwsl'] = $dxiatcwsl;
                            $data['dshangtcwsj'] = $dshangtcwsj;
                            $data['dxiatcwsj'] = $dxiatcwsj;
                            $data['dshangtcwzl'] = $dshangtcwzl;
                            $data['dxiatcwzl'] = $dxiatcwzl;
                            $data['ceweizldw'] = $ceweizldw;
                            $data['cheweiyzj'] = $cheweiyzj;
                        }
                        $data['dianti'] = $dianti;
                        if ($dianti) {
                            $data['diantifq'] = $diantifq;
                            $data['diantipp'] = I('diantipp');
                            $data['diantixq'] = I('diantixq');
                        }
                        $data['youzheng'] = $youzheng;
                        $data['wuyefei'] = $wuyefei;
                        $data['wuyedh'] = $wuyedh;
                        $data['wuyemc'] = I('wuyemc');
                        $data['wuyedz'] = I('wuyedz');
                        $data['jiedao'] = I('jiedao');
                        $data['xiaoqudz'] = I('xiaoqudz');
                        $data['jianjie'] = I('jianjie');
                        $data['beizhu'] = I('beizhu');
                        if ($xiaoqu['xiaoqum'] != $xiaoqum && ($xiaoqu['xiaoqum'] || $xiaoqum)) {
                            $xiugai .= "楼盘名称：[".$xiaoqu['xiaoqum']."]=>[".$xiaoqum."]；";
                        }
                        if ($xiaoqu['lpleixing'] != $lpleixing && ($xiaoqu['lpleixing'] || $lpleixing)) {
                            switch ($xiaoqu['lpleixing']) {
                                case '1':
                                    $xgqlplx = "写字楼";
                                    break;
                                case '2':
                                    $xgqlplx = "商铺";
                                    break;
                                case '3':
                                    $xgqlplx = "住宅";
                                    break;
                                case '4':
                                    $xgqlplx = "混合型";
                                    break;
                                default:
                                    $xgqlplx = "混合型";
                                    break;
                            }
                            switch ($lpleixing) {
                                case '1':
                                    $xghlplx = "写字楼";
                                    break;
                                case '2':
                                    $xghlplx = "商铺";
                                    break;
                                case '3':
                                    $xghlplx = "住宅";
                                    break;
                                case '4':
                                    $lxbd = 1;
                                    $xghlplx = "混合型";
                                    break;
                                default:
                                    $lxbd = 1;
                                    $xghlplx = "混合型";
                                    break;
                            }
                            if ($lxbd != 1) {
                                $xghlxbg = "，（楼盘下所有座栋、房间的类型均更改为".$xghlplx."）；";
                            }
                            $xiugai .= "物业类型：[".$xgqlplx."]=>[".$xghlplx."]".$xghlxbg."；";
                        }
                        if ($xiaoqu['ssxzq'] != $ssxzq && ($xiaoqu['ssxzq'] || $ssxzq)) {
                            $xiugai .= "所属行政区：[".zym($xiaoqu['ssxzq'],1)."]=>[".zym($ssxzq,1)."]；";
                        }
                        if ($xiaoqu['sspianqu'] != $sspianqu && ($xiaoqu['sspianqu'] || $sspianqu)) {
                            $xiugai .= "所属商圈：[".zym($xiaoqu['sspianqu'],2)."]=>[".zym($sspianqu,2)."]；";
                        }
                        if ($xiaoqu['whrid'] != $whrid && ($xiaoqu['whrid'] || $whrid)) {
                            $xiugai .= "维护人：[".zym($xiaoqu['whrid'],5)."]=>[".zym($whrid,5)."]；";
                            $xiugai .= "维护部门：[".yhbm($xiaoqu['whrid'],3)."]=>[".yhbm($whrid,3)."]；";
                        }
                        if ($xiaoqu['pinyinjs'] != I('pinyinjs') && ($xiaoqu['pinyinjs'] || I('pinyinjs'))) {
                            $xiugai .= "拼音检索：[".$xiaoqu['pinyinjs']."]=>[".I('pinyinjs')."]；";
                        }
                        if ($xiaoqu['xiaoqubm'] != I('xiaoqubm') && ($xiaoqu['xiaoqubm'] || I('xiaoqubm'))) {
                            $xiugai .= "楼盘别名：[".$xiaoqu['xiaoqubm']."]=>[".I('xiaoqubm')."]；";
                        }
                        if ($xiaoqu['rongjilv'] != $rongjilv && ($xiaoqu['rongjilv'] || $rongjilv)) {
                            $xiugai .= "容积率：[".$xiaoqu['rongjilv']."%]=>[".$rongjilv."%]；";
                        }
                        if ($xiaoqu['lvhualv'] != $lvhualv && ($xiaoqu['lvhualv'] || $lvhualv)) {
                            $xiugai .= "绿化率：[".$xiaoqu['lvhualv']."%]=>[".$lvhualv."%]；";
                        }
                        if ($xiaoqu['zhandimj'] != $zhandimj && ($xiaoqu['zhandimj'] || $zhandimj)) {
                            $xiugai .= "占地面积：[".$xiaoqu['zhandimj']."m²]=>[".$zhandimj."m²]；";
                        }
                        if ($xiaoqu['jianzhumj'] != $jianzhumj && ($xiaoqu['jianzhumj'] || $jianzhumj)) {
                            $xiugai .= "建筑面积：[".$xiaoqu['jianzhumj']."m²]=>[".$jianzhumj."m²]；";
                        }
                        if ($xiaoqu['jianzaond'] != $jianzaond && ($xiaoqu['jianzaond'] || $jianzaond)) {
                            $xiugai .= "建造年代：[".$xiaoqu['jianzaond']."年]=>[".$jianzaond."年]；";
                        }
                        if ($xiaoqu['csjunjia'] != $csjunjia && ($xiaoqu['csjunjia'] || $csjunjia)) {
                            $xiugai .= "出售均价：[".$xiaoqu['csjunjia']."元 / m²]=>[".$csjunjia."元 / m²]；";
                        }
                        if ($xiaoqu['czjunjia'] != $czjunjia && ($xiaoqu['czjunjia'] || $czjunjia)) {
                            $xiugai .= "出租均价：[".$xiaoqu['czjunjia']."元 / 月]=>[".$czjunjia."元 / 月]；";
                        }
                        if ($xiaoqu['gongdianlx'] != I('gongdianlx') && ($xiaoqu['gongdianlx'] || I('gongdianlx'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongdianlx'],I('gongdianlx'),'gongdianlx');
                        }
                        if ($xiaoqu['gongshuilx'] != I('gongshuilx') && ($xiaoqu['gongshuilx'] || I('gongshuilx'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongshuilx'],I('gongshuilx'),'gongshuilx');
                        }
                        if ($xiaoqu['gongqifs'] != I('gongqifs') && ($xiaoqu['gongqifs'] || I('gongqifs'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongqifs'],I('gongqifs'),'gongqifs');
                        }
                        if ($xiaoqu['chewei'] != $chewei && ($xiaoqu['chewei'] || $chewei)) {
                            if ($xiaoqu['chewei'] == 1) {
                                $xgqdt = "有车位";
                            } else {
                                $xgqdt = "无车位";
                            }
                            if ($chewei == 1) {
                                $xghdt = "有车位";
                            } else {
                                $xghdt = "无车位";
                            }
                            $xiugai .= "车位：[".$xgqdt."]=>[".$xghdt."]；";
                            if ($chewei) {
                                if ($xiaoqu['dshangtcwsl'] != $dshangtcwsl && ($xiaoqu['dshangtcwsl'] || $dshangtcwsl)) {
                                    $xiugai .= "地上车位数量：[".$xiaoqu['dshangtcwsl']."个]=>[".$dshangtcwsl."个]；";
                                }
                                if ($xiaoqu['dxiatcwsl'] != $dxiatcwsl && ($xiaoqu['dxiatcwsl'] || $dxiatcwsl)) {
                                    $xiugai .= "地下车位数量：[".$xiaoqu['dxiatcwsl']."个]=>[".$dxiatcwsl."个]；";
                                }
                                if ($xiaoqu['dshangtcwsj'] != $dshangtcwsj && ($xiaoqu['dshangtcwsj'] || $dshangtcwsj)) {
                                    $xiugai .= "地上车位售价：[".$xiaoqu['dshangtcwsj']."万]=>[".$dshangtcwsj."万]；";
                                }
                                if ($xiaoqu['dxiatcwsj'] != $dxiatcwsj && ($xiaoqu['dxiatcwsj'] || $dxiatcwsj)) {
                                    $xiugai .= "地下车位售价：[".$xiaoqu['dxiatcwsj']."万]=>[".$dxiatcwsj."万]；";
                                }
                                if ($xiaoqu['ceweizldw'] != $ceweizldw && ($xiaoqu['ceweizldw'] || $ceweizldw)) {
                                    $xgqdw = get_peizhi('ceweizldw',$xiaoqu['ceweizldw'],3);
                                    $xghdw = get_peizhi('ceweizldw',I('ceweizldw'),3);
                                    $zldwbd = 1;
                                }
                                if ($xiaoqu['dshangtcwzl'] != $dshangtcwzl && ($xiaoqu['dshangtcwzl'] || $dshangtcwzl) || $zldwbd) {
                                    $xiugai .= "地上车位租赁：[".$xiaoqu['dshangtcwzl'].$xgqdw."]=>[".$dshangtcwzl.$xghdw."]；";
                                }
                                if ($xiaoqu['dxiatcwzl'] != $dxiatcwzl && ($xiaoqu['dxiatcwzl'] || $dxiatcwzl) || $zldwbd) {
                                    $xiugai .= "地下车位租赁：[".$xiaoqu['dxiatcwzl'].$xgqdw."]=>[".$dxiatcwzl.$xghdw."]；";
                                }
                                if ($xiaoqu['cheweiyzj'] != $cheweiyzj && ($xiaoqu['cheweiyzj'] || $cheweiyzj)) {
                                    $xiugai .= "车位月租金：[".$xiaoqu['cheweiyzj']."元 / 月]=>[".$cheweiyzj."元 / 月]；";
                                }
                            }
                        }
                        if ($xiaoqu['dianti'] != $dianti && ($xiaoqu['dianti'] || $dianti)) {
                            if ($xiaoqu['dianti'] == 1) {
                                $xgqdt = "有电梯";
                            } else {
                                $xgqdt = "无电梯";
                            }
                            if ($dianti == 1) {
                                $xghdt = "有电梯";
                            } else {
                                $xghdt = "无电梯";
                            }
                            $xiugai .= "电梯：[".$xgqdt."]=>[".$xghdt."]；";
                            if ($dianti) {
                                if ($xiaoqu['diantifq']) {
                                    $xgqfq = "是";
                                } else {
                                    $xgqfq = "否";
                                }
                                if ($diantifq) {
                                    $xghfq = "是";
                                } else {
                                    $xghfq = "否";
                                }
                                if ($xiaoqu['diantifq'] != $diantifq && ($xiaoqu['diantifq'] || $diantifq)) {
                                    $xiugai .= "电梯是否分区：[".$xgqfq."]=>[".$xghfq."]；";
                                }
                                if ($xiaoqu['diantipp'] != I('diantipp') && ($xiaoqu['diantipp'] || I('diantipp'))) {
                                    $xiugai .= "电梯品牌：[".$xiaoqu['diantipp']."]=>[".I('diantipp')."]；";
                                }
                                if ($xiaoqu['diantixq'] != I('diantixq') && ($xiaoqu['diantixq'] || I('diantixq'))) {
                                    $xiugai .= "电梯详情：[".$xiaoqu['diantixq']."]=>[".I('diantixq')."]；";
                                }
                            }
                        }
                        if ($xiaoqu['youzheng'] != $youzheng && ($xiaoqu['youzheng'] || $youzheng)) {
                            $xiugai .= "邮政编码：[".$xiaoqu['youzheng']."]=>[".$youzheng."]；";
                        }
                        if ($xiaoqu['wuyefei'] != $wuyefei && ($xiaoqu['wuyefei'] || $wuyefei)) {
                            $xiugai .= "物业费：[".$xiaoqu['wuyefei']."元 / 平米 · 月]=>[".$wuyefei."元 / 平米 · 月]；";
                        }
                        if ($xiaoqu['wuyedh'] != $wuyedh && ($xiaoqu['wuyedh'] || $wuyedh)) {
                            $xiugai .= "物业电话：[".$xiaoqu['wuyedh']."]=>[".$wuyedh."]；";
                        }
                        if ($xiaoqu['wuyemc'] != I('wuyemc') && ($xiaoqu['wuyemc'] || I('wuyemc'))) {
                            $xiugai .= "物业公司：[".$xiaoqu['wuyemc']."]=>[".I('wuyemc')."]；";
                        }
                        if ($xiaoqu['wuyedz'] != I('wuyedz') && ($xiaoqu['wuyedz'] || I('wuyedz'))) {
                            $xiugai .= "物业地址：[".$xiaoqu['wuyedz']."]=>[".I('wuyedz')."]；";
                        }
                        if ($xiaoqu['jiedao'] != I('jiedao') && ($xiaoqu['jiedao'] || I('jiedao'))) {
                            $xiugai .= "街道：[".$xiaoqu['jiedao']."]=>[".I('jiedao')."]；";
                        }
                        if ($xiaoqu['xiaoqudz'] != I('xiaoqudz') && ($xiaoqu['xiaoqudz'] || I('xiaoqudz'))) {
                            $xiugai .= "楼盘地址：[".$xiaoqu['xiaoqudz']."]=>[".I('xiaoqudz')."]；";
                        }
                        if ($xiaoqu['jianjie'] != I('jianjie') && ($xiaoqu['jianjie'] || I('jianjie'))) {
                            $xiugai .= "楼盘简介：[".$xiaoqu['jianjie']."]=>[".I('jianjie')."]；";
                        }
                        if ($xiaoqu['beizhu'] != I('beizhu') && ($xiaoqu['beizhu'] || I('beizhu'))) {
                            $xiugai .= "楼盘备注：[".$xiaoqu['beizhu']."]=>[".I('beizhu')."]；";
                        }
                        break;
                    case '2':
                        $condition['gongsiid'] = session('gongsiid');
                        $condition['id'] = array('neq',$id);
                        $ssxzq = $xiaoqu['ssxzq'];
                        $sspianqu = $xiaoqu['sspianqu'];
                        $xiaoqum = I('xiaoqum');
                        $condition['ssxzq'] = $ssxzq;
                        $condition['sspianqu'] = $sspianqu;
                        $condition['xiaoqum'] = $xiaoqum;
                        $cfxq = M('xiaoqu')->where($condition)->find();
                        if($cfxq){
                            $this->error('楼盘已存在');
                        }
                        $data['xiaoqum'] = $xiaoqum;
                        $data['pinyinjs'] = I('pinyinjs');
                        $data['dizhi'] = I('dizhi');
                        $data['type'] = I('type');
                        $data['xmjibie'] = I('xmjibie');
                        $data['jianjie'] = I('jianjie');
                        if ($xiaoqu['xiaoqum'] != $xiaoqum && ($xiaoqu['xiaoqum'] || $xiaoqum)) {
                            $xiugai .= "楼盘名称：[".$xiaoqu['xiaoqum']."]=>[".$xiaoqum."]；";
                        }
                        if ($xiaoqu['pinyinjs'] != I('pinyinjs') && ($xiaoqu['pinyinjs'] || I('pinyinjs'))) {
                            $xiugai .= "拼音检索：[".$xiaoqu['pinyinjs']."]=>[".I('pinyinjs')."]；";
                        }
                        if ($xiaoqu['dizhi'] != I('dizhi') && ($xiaoqu['dizhi'] || I('dizhi'))) {
                            $xiugai .= "楼盘地址：[".$xiaoqu['dizhi']."]=>[".I('dizhi')."]；";
                        }
                        if ($xiaoqu['type'] != I('type') && ($xiaoqu['type'] || I('type'))) {
                            $xiugai .= get_xiugai($xiaoqu['type'],I('type'),'lptype');
                        }
                        if ($xiaoqu['xmjibie'] != I('xmjibie') && ($xiaoqu['xmjibie'] || I('xmjibie'))) {
                            $xiugai .= get_xiugai1('级别',$xiaoqu['xmjibie'],I('xmjibie'),'xmjibie');
                        }
                        if ($xiaoqu['jianjie'] != I('jianjie') && ($xiaoqu['jianjie'] || I('jianjie'))) {
                            $xiugai .= "楼盘简介：[".$xiaoqu['jianjie']."]=>[".I('jianjie')."]；";
                        }
                        break;
                    case '3':
                        $wuyefei = I('wuyefei');
                        $ktshu = I('ktshu');
                        $htshu = I('htshu');
                        $diantifq = I('diantifq');
                        $cheweiyzj = I('cheweiyzj');
                        $dshangtcwsl = I('dshangtcwsl');
                        $dxiatcwsl = I('dxiatcwsl');
                        if ($wuyefei) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{5})(\.[0][0]{0,1})?$/",$wuyefei)) {
                                $this->error('物业费请输入＞0且≤十万的数字（限两位小数）！');
                            }
                        }
                        if ($ktshu) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$ktshu)) {
                                $this->error('客梯数请输入＞0且≤一万的整数！');
                            }
                        }
                        if ($htshu) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$htshu)) {
                                $this->error('货梯数请输入＞0且≤一万的整数！');
                            }
                        }
                        if ($diantifq) {
                            $diantifq = 1;
                        } else {
                            $diantifq = 0;
                        }
                        if ($cheweiyzj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$cheweiyzj)) {
                                $this->error('车位月租金请输入＞0且≤一百万的数字（限两位小数）！');
                            }
                        }
                        if ($dshangtcwsl) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dshangtcwsl)) {
                                $this->error('地上车位数请输入＞0且≤一万的整数！');
                            }
                        }
                        if ($dxiatcwsl) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dxiatcwsl)) {
                                $this->error('地下车位数请输入＞0且≤一万的整数！');
                            }
                        }
                        $tx1 = array_keys(I('tongxun'));
                        $tx2 = implode(',',$tx1);
                        $pt1 = array_keys(I('lrpeitao'));
                        $pt2 = implode(',',$pt1);
                        $af1 = array_keys(I('sqanquan'));
                        $af2 = implode(',',$af1);
                        $data['wuyefei'] = $wuyefei;
                        $data['ktlx'] = I('ktlx');
                        $data['ktshu'] = $ktshu;
                        $data['htshu'] = $htshu;
                        $data['diantipp'] = I('diantipp');
                        $data['diantifq'] = $diantifq;
                        $data['cheweiyzj'] = $cheweiyzj;
                        $data['dshangtcwsl'] = $dshangtcwsl;
                        $data['dxiatcwsl'] = $dxiatcwsl;
                        $data['wuyemc'] = I('wuyemc');
                        $data['tongxun'] = $tx2;
                        $data['lrpeitao'] = $pt2;
                        $data['zyktgzsj'] = I('zyktgzsj');
                        $data['yrzqy'] = I('yrzqy');
                        $data['sqanquan'] = $af2;
                        if ($xiaoqu['wuyefei'] != $wuyefei && ($xiaoqu['wuyefei'] || $wuyefei)) {
                            $xiugai .= "物业费：[".$xiaoqu['wuyefei']."元 / 平米 · 月]=>[".$wuyefei."元 / 平米 · 月]；";
                        }
                        if ($xiaoqu['ktlx'] != I('ktlx') && ($xiaoqu['ktlx'] || I('ktlx'))) {
                            $xiugai .= get_xiugai($xiaoqu['ktlx'],I('ktlx'),'lpktlx');
                        }
                        if ($xiaoqu['ktshu'] != $ktshu && ($xiaoqu['ktshu'] || $ktshu)) {
                            $xiugai .= "客梯数：[".$xiaoqu['ktshu']."个]=>[".$ktshu."个]；";
                        }
                        if ($xiaoqu['htshu'] != $htshu && ($xiaoqu['htshu'] || $htshu)) {
                            $xiugai .= "货梯数：[".$xiaoqu['htshu']."个]=>[".$htshu."个]；";
                        }
                        if ($xiaoqu['diantipp'] != I('diantipp') && ($xiaoqu['diantipp'] || I('diantipp'))) {
                            $xiugai .= "电梯品牌：[".$xiaoqu['diantipp']."]=>[".I('diantipp')."]；";
                        }
                        if ($xiaoqu['diantifq'] != $diantifq && ($xiaoqu['diantifq'] || $diantifq)) {
                            if ($xiaoqu['diantifq'] == 1) {
                                $xgqfq = "是";
                            } else {
                                $xgqfq = "否";
                            }
                            if ($diantifq == 1) {
                                $xghfq = "是";
                            } else {
                                $xghfq = "否";
                            }
                            $xiugai .= "电梯是否分区：[".$xgqfq."]=>[".$xghfq."]；";
                        }
                        if ($xiaoqu['cheweiyzj'] != $cheweiyzj && ($xiaoqu['cheweiyzj'] || $cheweiyzj)) {
                            $xiugai .= "车位月租金：[".$xiaoqu['cheweiyzj']."元 / 月]=>[".$cheweiyzj."元 / 月]；";
                        }
                        if ($xiaoqu['dshangtcwsl'] != $dshangtcwsl && ($xiaoqu['dshangtcwsl'] || $dshangtcwsl)) {
                            $xiugai .= "地上车位数：[".$xiaoqu['dshangtcwsl']."个]=>[".$dshangtcwsl."个]；";
                        }
                        if ($xiaoqu['dxiatcwsl'] != $dxiatcwsl && ($xiaoqu['dxiatcwsl'] || $dxiatcwsl)) {
                            $xiugai .= "地下车位数：[".$xiaoqu['dxiatcwsl']."个]=>[".$dxiatcwsl."个]；";
                        }
                        if ($xiaoqu['wuyemc'] != I('wuyemc') && ($xiaoqu['wuyemc'] || I('wuyemc'))) {
                            $xiugai .= "物业公司：[".$xiaoqu['wuyemc']."]=>[".I('wuyemc')."]；";
                        }
                        if ($xiaoqu['tongxun'] != I('tongxun') && ($xiaoqu['tongxun'] || I('tongxun'))) {
                            if ($xiaoqu['tongxun']) {
                                $condition1 = "pzming = 'tongxun' and lxid in (".$xiaoqu['tongxun'].")";
                                $tongxun1 = $Model->query("select * from __PEIZHI__ where {$condition1} order by xsshunxu asc");
                                $wltxsz1 = array();
                                foreach ($tongxun1 AS $key => $val) {
                                    $wltxsz1[] = $val['lxming'];
                                }
                                $wltxs1 = implode("；",$wltxsz1);
                            }
                            if ($tx2) {
                                $condition2 = "pzming = 'tongxun' and lxid in (".$tx2.")";
                                $tongxun2 = $Model->query("select * from __PEIZHI__ where {$condition2} order by xsshunxu asc");
                                $wltxsz2 = array();
                                foreach ($tongxun2 AS $key => $val) {
                                    $wltxsz2[] = $val['lxming'];
                                }
                                $wltxs2 = implode("；",$wltxsz2);
                            }
                            $xiugai .= "网络通讯：[".$wltxs1."]=>[".$wltxs2."]；";
                        }
                        if ($xiaoqu['lrpeitao'] != I('lrpeitao') && ($xiaoqu['lrpeitao'] || I('lrpeitao'))) {
                            if ($xiaoqu['lrpeitao']) {
                                $condition3 = "pzming = 'lrpeitao' and lxid in (".$xiaoqu['lrpeitao'].")";
                                $lrpeitao1 = $Model->query("select * from __PEIZHI__ where {$condition3} order by xsshunxu asc");
                                $lrptsz1 = array();
                                foreach ($lrpeitao1 AS $key => $val) {
                                    $lrptsz1[] = $val['lxming'];
                                }
                                $lrpts1 = implode("；",$lrptsz1);
                            }
                            if ($pt2) {
                                $condition4 = "pzming = 'lrpeitao' and lxid in (".$pt2.")";
                                $lrpeitao2 = $Model->query("select * from __PEIZHI__ where {$condition4} order by xsshunxu asc");
                                $lrptsz2 = array();
                                foreach ($lrpeitao2 AS $key => $val) {
                                    $lrptsz2[] = $val['lxming'];
                                }
                                $lrpts2 = implode("；",$lrptsz2);
                            }
                            $xiugai .= "楼内配套：[".$lrpts1."]=>[".$lrpts2."]；";
                        }
                        if ($xiaoqu['zyktgzsj'] != I('zyktgzsj') && ($xiaoqu['zyktgzsj'] || I('zyktgzsj'))) {
                            $xiugai .= "空调开放时间：[".$xiaoqu['zyktgzsj']."]=>[".I('zyktgzsj')."]；";
                        }
                        if ($xiaoqu['yrzqy'] != I('yrzqy') && ($xiaoqu['yrzqy'] || I('yrzqy'))) {
                            $xiugai .= "已入驻企业：[".$xiaoqu['yrzqy']."]=>[".I('yrzqy')."]；";
                        }
                        if ($xiaoqu['sqanquan'] != I('sqanquan') && ($xiaoqu['sqanquan'] || I('sqanquan'))) {
                            if ($xiaoqu['sqanquan']) {
                                $condition5 = "pzming = 'sqanquan' and lxid in (".$xiaoqu['sqanquan'].")";
                                $sqanquan1 = $Model->query("select * from __PEIZHI__ where {$condition5} order by xsshunxu asc");
                                $afxtsz1 = array();
                                foreach ($sqanquan1 AS $key => $val) {
                                    $afxtsz1[] = $val['lxming'];
                                }
                                $afxts1 = implode("；",$afxtsz1);
                            }
                            if ($sx2) {
                                $condition6 = "pzming = 'sqanquan' and lxid in (".$sx2.")";
                                $sqanquan2 = $Model->query("select * from __PEIZHI__ where {$condition6} order by xsshunxu asc");
                                $afxtsz2 = array();
                                foreach ($sqanquan2 AS $key => $val) {
                                    $afxtsz2[] = $val['lxming'];
                                }
                                $afxts2 = implode("；",$afxtsz2);
                            }
                            $xiugai .= "安防系统：[".$afxts1."]=>[".$afxts2."]；";
                        }
                        break;
                    case '4':
                        $zonglc = I('zonglc');
                        $jianzhumj = I('jianzhumj');
                        $bzcjzmj = I('bzcjzmj');
                        $dxiatcwsl = I('dxiatcwsl');
                        $bzcg = I('bzcg');
                        $jinggao = I('jinggao');
                        $shewai = I('shewai');
                        $datangcg = I('datangcg');
                        $zhuce = I('zhuce');
                        if ($zonglc) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,2})$|^(1[0]{3})$/",$zonglc)) {
                                $this->error('总楼层请输入＞0且≤一千的整数！');
                            }
                        }
                        if ($jianzhumj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,6})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{7})(\.[0][0]{0,1})?$/",$jianzhumj)) {
                                $this->error('总建筑面积请输入＞0且≤一千万的数字（限两位小数）！');
                            }
                        }
                        if ($bzcjzmj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,6})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{7})(\.[0][0]{0,1})?$/",$bzcjzmj)) {
                                $this->error('标准层面积请输入＞0且≤一千万的数字（限两位小数）！');
                            }
                        }
                        if ($dxiatcwsl) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dxiatcwsl)) {
                                $this->error('地下车位数请输入＞0且≤一万的整数！');
                            }
                        }
                        if ($bzcg) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$bzcg)) {
                                $this->error('标准层高请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($jinggao) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$jinggao)) {
                                $this->error('净高请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($shewai) {
                            $shewai = 1;
                        } else {
                            $shewai = 0;
                        }
                        if ($datangcg) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$datangcg)) {
                                $this->error('大堂层高请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($zhuce) {
                            $zhuce = 1;
                        } else {
                            $zhuce = 0;
                        }
                        $data['zonglc'] = $zonglc;
                        $data['jgshijian'] = strtotime(I('jgshijian'));
                        $data['jianzhumj'] = $jianzhumj;
                        $data['bzcjzmj'] = $bzcjzmj;
                        $data['dxiatcwsl'] = $dxiatcwsl;
                        $data['bzcg'] = $bzcg;
                        $data['waiqiang'] = I('waiqiang');
                        $data['jinggao'] = $jinggao;
                        $data['shewai'] = $shewai;
                        $data['datangcg'] = $datangcg;
                        $data['zhuce'] = $zhuce;
                        $data['kjmianji'] = I('kjmianji');
                        $data['kaifashang'] = I('kaifashang');
                        if ($xiaoqu['zonglc'] != $zonglc && ($xiaoqu['zonglc'] || $zonglc)) {
                            $xiugai .= "总楼层：[".$xiaoqu['zonglc']."层]=>[".$zonglc."层]；";
                        }
                        if ($xiaoqu['jgshijian'] != I('jgshijian') && ($xiaoqu['jgshijian'] || I('jgshijian'))) {
                            $xiugai .= "竣工时间：[".date('Y-m-d',$xiaoqu['jgshijian'])."]=>[".I('jgshijian')."]；";
                        }
                        if ($xiaoqu['jianzhumj'] != $jianzhumj && ($xiaoqu['jianzhumj'] || $jianzhumj)) {
                            $xiugai .= "建筑面积：[".$xiaoqu['jianzhumj']."m²]=>[".$jianzhumj."m²]；";
                        }
                        if ($xiaoqu['bzcjzmj'] != $bzcjzmj && ($xiaoqu['bzcjzmj'] || $bzcjzmj)) {
                            $xiugai .= "标准层面积：[".$xiaoqu['bzcjzmj']."m²]=>[".$bzcjzmj."m²]；";
                        }
                        if ($xiaoqu['dxiatcwsl'] != $dxiatcwsl && ($xiaoqu['dxiatcwsl'] || $dxiatcwsl)) {
                            $xiugai .= "地下车位数量：[".$xiaoqu['dxiatcwsl']."个]=>[".$dxiatcwsl."个]；";
                        }
                        if ($xiaoqu['bzcg'] != $bzcg && ($xiaoqu['bzcg'] || $bzcg)) {
                            $xiugai .= "标准层高：[".$xiaoqu['bzcg']."米]=>[".$bzcg."米]；";
                        }
                        if ($xiaoqu['waiqiang'] != I('waiqiang') && ($xiaoqu['waiqiang'] || I('waiqiang'))) {
                            $xiugai .= get_xiugai($xiaoqu['waiqiang'],I('waiqiang'),'waiqiang');
                        }
                        if ($xiaoqu['jinggao'] != $jinggao && ($xiaoqu['jinggao'] || $jinggao)) {
                            $xiugai .= "净高：[".$xiaoqu['jinggao']."米]=>[".$jinggao."米]；";
                        }
                        if ($xiaoqu['shewai'] != $shewai && ($xiaoqu['shewai'] || $shewai)) {
                            if ($xiaoqu['shewai'] == 1) {
                                $xgqsw = "是";
                            } else {
                                $xgqsw = "否";
                            }
                            if ($shewai == 1) {
                                $xghsw = "是";
                            } else {
                                $xghsw = "否";
                            }
                            $xiugai .= "是否涉外：[".$xgqsw."]=>[".$xghsw."]；";
                        }
                        if ($xiaoqu['datangcg'] != $datangcg && ($xiaoqu['datangcg'] || $datangcg)) {
                            $xiugai .= "大堂层高：[".$xiaoqu['datangcg']."米]=>[".$datangcg."米]；";
                        }
                        if ($xiaoqu['zhuce'] != $zhuce && ($xiaoqu['zhuce'] || $zhuce)) {
                            if ($xiaoqu['zhuce'] == 1) {
                                $xgqzc = "是";
                            } else {
                                $xgqzc = "否";
                            }
                            if ($zhuce == 1) {
                                $xghzc = "是";
                            } else {
                                $xghzc = "否";
                            }
                            $xiugai .= "是否可注册：[".$xgqzc."]=>[".$xghzc."]；";
                        }
                        if ($xiaoqu['kjmianji'] != I('kjmianji') && ($xiaoqu['kjmianji'] || I('kjmianji'))) {
                            $xiugai .= "开间面积：[".$xiaoqu['kjmianji']."]=>[".I('kjmianji')."]；";
                        }
                        if ($xiaoqu['kaifashang'] != I('kaifashang') && ($xiaoqu['kaifashang'] || I('kaifashang'))) {
                            $xiugai .= "开发商：[".$xiaoqu['kaifashang']."]=>[".I('kaifashang')."]；";
                        }
                        break;
                    case '5':
                        $data['gongjiaolx'] = I('gongjiaolx');
                        $data['ditielx'] = I('ditielx');
                        $data['xiuxianyule'] = I('xiuxianyule');
                        $data['shangchangcs'] = I('shangchangcs');
                        $data['ssxuexiao'] = I('ssxuexiao');
                        $data['paichusuo'] = I('paichusuo');
                        $data['yiliaojigou'] = I('yiliaojigou');
                        $data['jinrongjg'] = I('jinrongjg');
                        $data['zhengfujg'] = I('zhengfujg');
                        if ($xiaoqu['gongjiaolx'] != I('gongjiaolx') && ($xiaoqu['gongjiaolx'] || I('gongjiaolx'))) {
                            $xiugai .= "公交线路：[".$xiaoqu['gongjiaolx']."]=>[".I('gongjiaolx')."]；";
                        }
                        if ($xiaoqu['ditielx'] != I('ditielx') && ($xiaoqu['ditielx'] || I('ditielx'))) {
                            $xiugai .= "地铁线路：[".$xiaoqu['ditielx']."]=>[".I('ditielx')."]；";
                        }
                        if ($xiaoqu['xiuxianyule'] != I('xiuxianyule') && ($xiaoqu['xiuxianyule'] || I('xiuxianyule'))) {
                            $xiugai .= "休闲娱乐：[".$xiaoqu['xiuxianyule']."]=>[".I('xiuxianyule')."]；";
                        }
                        if ($xiaoqu['shangchangcs'] != I('shangchangcs') && ($xiaoqu['shangchangcs'] || I('shangchangcs'))) {
                            $xiugai .= "商场超市：[".$xiaoqu['shangchangcs']."]=>[".I('shangchangcs')."]；";
                        }
                        if ($xiaoqu['ssxuexiao'] != I('ssxuexiao') && ($xiaoqu['ssxuexiao'] || I('ssxuexiao'))) {
                            $xiugai .= "所属学区：[".zym($xiaoqu['ssxuexiao'],4)."]=>[".zym(I('ssxuexiao'),4)."]；";
                        }
                        if ($xiaoqu['paichusuo'] != I('paichusuo') && ($xiaoqu['paichusuo'] || I('paichusuo'))) {
                            $xiugai .= "派出所：[".$xiaoqu['paichusuo']."]=>[".I('paichusuo')."]；";
                        }
                        if ($xiaoqu['yiliaojigou'] != I('yiliaojigou') && ($xiaoqu['yiliaojigou'] || I('yiliaojigou'))) {
                            $xiugai .= "医疗机构：[".$xiaoqu['yiliaojigou']."]=>[".I('yiliaojigou')."]；";
                        }
                        if ($xiaoqu['jinrongjg'] != I('jinrongjg') && ($xiaoqu['jinrongjg'] || I('jinrongjg'))) {
                            $xiugai .= "金融机构：[".$xiaoqu['jinrongjg']."]=>[".I('jinrongjg')."]；";
                        }
                        if ($xiaoqu['zhengfujg'] != I('zhengfujg') && ($xiaoqu['zhengfujg'] || I('zhengfujg'))) {
                            $xiugai .= "政府机关：[".$xiaoqu['zhengfujg']."]=>[".I('zhengfujg')."]；";
                        }
                        break;
                    case '6':
                        $rongjilv = I('rongjilv');
                        $lvhualv = I('lvhualv');
                        $zhandimj = I('zhandimj');
                        $jianzhumj = I('jianzhumj');
                        $jianzaond = I('jianzaond');
                        $csjunjia = I('csjunjia');
                        $czjunjia = I('czjunjia');
                        $nianxian = I('nianxian');
                        if ($rongjilv) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$rongjilv)) {
                                $this->error('容积率请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($lvhualv) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$lvhualv)) {
                                $this->error('绿化率请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($zhandimj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$zhandimj)) {
                                $this->error('占地面积请输入＞0且≤一百万的数字（限两位小数）！');
                            }
                        }
                        if ($jianzhumj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,6})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{7})(\.[0][0]{0,1})?$/",$jianzhumj)) {
                                $this->error('建筑面积请输入＞0且≤一千万的数字（限两位小数）！');
                            }
                        }
                        if ($jianzaond) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$jianzaond)) {
                                $this->error('建造年代请输入＞0且≤一万的整数！');
                            }
                        }
                        if ($csjunjia) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$csjunjia)) {
                                $this->error('出售均价请输入＞0且≤十亿的数字（限六位小数）！');
                            }
                        }
                        if ($czjunjia) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$czjunjia)) {
                                $this->error('出租均价请输入＞0且≤一百万的数字（限两位小数）！');
                            }
                        }
                        if ($nianxian) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$nianxian)) {
                                $this->error('土地使用年限请输入＞0且≤一万的整数！');
                            }
                        }
                        $cq1 = array_keys(I('chanquan'));
                        $cq2 = implode(',',$cq1);
                        $yt1 = array_keys(I('yongtu'));
                        $yt2 = implode(',',$yt1);
                        $lx1 = array_keys(I('fwleixing'));
                        $lx2 = implode(',',$lx1);
                        $jg1 = array_keys(I('jiegou'));
                        $jg2 = implode(',',$jg1);
                        $data['rongjilv'] = $rongjilv;
                        $data['lvhualv'] = $lvhualv;
                        $data['zhandimj'] = $zhandimj;
                        $data['jianzhumj'] = $jianzhumj;
                        $data['jianzaond'] = $jianzaond;
                        $data['csjunjia'] = $csjunjia;
                        $data['czjunjia'] = $czjunjia;
                        $data['kpshijian'] = strtotime(I('kpshijian'));
                        $data['rzshijian'] = strtotime(I('rzshijian'));
                        $data['nianxian'] = $nianxian;
                        $data['ycqdanwei'] = I('ycqdanwei');
                        $data['kaifashang'] = I('kaifashang');
                        $data['chanquan'] = $cq2;
                        $data['yongtu'] = $yt2;
                        $data['fwleixing'] = $lx2;
                        $data['jiegou'] = $jg2;
                        if ($xiaoqu['rongjilv'] != $rongjilv && ($xiaoqu['rongjilv'] || $rongjilv)) {
                            $xiugai .= "容积率：[".$xiaoqu['rongjilv']."%]=>[".$rongjilv."%]；";
                        }
                        if ($xiaoqu['lvhualv'] != $lvhualv && ($xiaoqu['lvhualv'] || $lvhualv)) {
                            $xiugai .= "绿化率：[".$xiaoqu['lvhualv']."%]=>[".$lvhualv."%]；";
                        }
                        if ($xiaoqu['zhandimj'] != $zhandimj && ($xiaoqu['zhandimj'] || $zhandimj)) {
                            $xiugai .= "占地面积：[".$xiaoqu['zhandimj']."m²]=>[".$zhandimj."m²]；";
                        }
                        if ($xiaoqu['jianzhumj'] != $jianzhumj && ($xiaoqu['jianzhumj'] || $jianzhumj)) {
                            $xiugai .= "建筑面积：[".$xiaoqu['jianzhumj']."m²]=>[".$jianzhumj."m²]；";
                        }
                        if ($xiaoqu['jianzaond'] != $jianzaond && ($xiaoqu['jianzaond'] || $jianzaond)) {
                            $xiugai .= "建造年代：[".$xiaoqu['jianzaond']."年]=>[".$jianzaond."年]；";
                        }
                        if ($xiaoqu['csjunjia'] != $csjunjia && ($xiaoqu['csjunjia'] || $csjunjia)) {
                            $xiugai .= "出售均价：[".$xiaoqu['csjunjia']."元 / m²]=>[".$csjunjia."元 / m²]；";
                        }
                        if ($xiaoqu['czjunjia'] != $czjunjia && ($xiaoqu['czjunjia'] || $czjunjia)) {
                            $xiugai .= "出租均价：[".$xiaoqu['czjunjia']."元 / 月]=>[".$czjunjia."元 / 月]；";
                        }
                        if ($xiaoqu['kpshijian'] != I('kpshijian') && ($xiaoqu['kpshijian'] || I('kpshijian'))) {
                            $xiugai .= "开盘时间：[".date('Y-m-d',$xiaoqu['kpshijian'])."]=>[".I('kpshijian')."]；";
                        }
                        if ($xiaoqu['rzshijian'] != I('rzshijian') && ($xiaoqu['rzshijian'] || I('rzshijian'))) {
                            $xiugai .= "入住时间：[".date('Y-m-d',$xiaoqu['rzshijian'])."]=>[".I('rzshijian')."]；";
                        }
                        if ($xiaoqu['nianxian'] != $nianxian && ($xiaoqu['nianxian'] || $nianxian)) {
                            $xiugai .= "土地使用年限：[".$xiaoqu['nianxian']."年]=>[".$nianxian."年]；";
                        }
                        if ($xiaoqu['ycqdanwei'] != I('ycqdanwei') && ($xiaoqu['ycqdanwei'] || I('ycqdanwei'))) {
                            $xiugai .= "原产权单位：[".$xiaoqu['ycqdanwei']."]=>[".I('ycqdanwei')."]；";
                        }
                        if ($xiaoqu['kaifashang'] != I('kaifashang') && ($xiaoqu['kaifashang'] || I('kaifashang'))) {
                            $xiugai .= "开发商：[".$xiaoqu['kaifashang']."]=>[".I('kaifashang')."]；";
                        }
                        if ($xiaoqu['chanquan'] != $cq2 && ($xiaoqu['chanquan'] || $cq2)) {
                            if ($xiaoqu['chanquan']) {
                                $condition1 = "pzming = 'chanquan' and lxid in (".$xiaoqu['chanquan'].")";
                                $chanquan1 = $Model->query("select * from __PEIZHI__ where {$condition1} order by xsshunxu asc");
                                $lpqssz1 = array();
                                foreach ($chanquan1 AS $key => $val) {
                                    $lpqssz1[] = $val['lxming'];
                                }
                                $lpqss1 = implode("；",$lpqssz1);
                            }
                            if ($cq2) {
                                $condition2 = "pzming = 'chanquan' and lxid in (".$cq2.")";
                                $chanquan2 = $Model->query("select * from __PEIZHI__ where {$condition2} order by xsshunxu asc");
                                $lpqssz2 = array();
                                foreach ($chanquan2 AS $key => $val) {
                                    $lpqssz2[] = $val['lxming'];
                                }
                                $lpqss2 = implode("；",$lpqssz2);
                            }
                            $xiugai .= "权属：[".$lpqss1."]=>[".$lpqss2."]；";
                        }
                        if ($xiaoqu['yongtu'] != $yt2 && ($xiaoqu['yongtu'] || $yt2)) {
                            if ($xiaoqu['yongtu']) {
                                $condition3 = "pzming = 'yongtu' and lxid in (".$xiaoqu['yongtu'].")";
                                $yongtu1 = $Model->query("select * from __PEIZHI__ where {$condition3} order by xsshunxu asc");
                                $fwytsz1 = array();
                                foreach ($yongtu1 AS $key => $val) {
                                    $fwytsz1[] = $val['lxming'];
                                }
                                $fwyts1 = implode("；",$fwytsz1);
                            }
                            if ($yt2) {
                                $condition4 = "pzming = 'yongtu' and lxid in (".$yt2.")";
                                $yongtu2 = $Model->query("select * from __PEIZHI__ where {$condition4} order by xsshunxu asc");
                                $fwytsz2 = array();
                                foreach ($yongtu2 AS $key => $val) {
                                    $fwytsz2[] = $val['lxming'];
                                }
                                $fwyts2 = implode("；",$fwytsz2);
                            }
                            $xiugai .= "房屋用途：[".$fwyts1."]=>[".$fwyts2."]；";
                        }
                        if ($xiaoqu['fwleixing'] != $lx2 && ($xiaoqu['fwleixing'] || $lx2)) {
                            if ($xiaoqu['fwleixing']) {
                                $condition5 = "pzming = 'fwleixing' and lxid in (".$xiaoqu['fwleixing'].")";
                                $fwleixing1 = $Model->query("select * from __PEIZHI__ where {$condition5} order by xsshunxu asc");
                                $txpzsz1 = array();
                                foreach ($fwleixing1 AS $key => $val) {
                                    $txpzsz1[] = $val['lxming'];
                                }
                                $jzlxs1 = implode("；",$jzlxsz1);
                            }
                            if ($lx2) {
                                $condition6 = "pzming = 'fwleixing' and lxid in (".$lx2.")";
                                $fwleixing2 = $Model->query("select * from __PEIZHI__ where {$condition6} order by xsshunxu asc");
                                $jzlxsz2 = array();
                                foreach ($fwleixing2 AS $key => $val) {
                                    $jzlxsz2[] = $val['lxming'];
                                }
                                $jzlxs2 = implode("；",$jzlxsz2);
                            }
                            $xiugai .= "建筑类型：[".$jzlxs1."]=>[".$jzlxs2."]；";
                        }
                        if ($xiaoqu['jiegou'] != $jg2 && ($xiaoqu['jiegou'] || $jg2)) {
                            if ($xiaoqu['jiegou']) {
                                $condition7 = "pzming = 'jiegou' and lxid in (".$xiaoqu['jiegou'].")";
                                $jiegou1 = $Model->query("select * from __PEIZHI__ where {$condition7} order by xsshunxu asc");
                                $jzjgsz1 = array();
                                foreach ($jiegou1 AS $key => $val) {
                                    $jzjgsz1[] = $val['lxming'];
                                }
                                $jzjgs1 = implode("；",$jzjgsz1);
                            }
                            if ($jg2) {
                                $condition8 = "pzming = 'jiegou' and lxid in (".$jg2.")";
                                $jiegou2 = $Model->query("select * from __PEIZHI__ where {$condition8} order by xsshunxu asc");
                                $jzjgsz2 = array();
                                foreach ($jiegou2 AS $key => $val) {
                                    $jzjgsz2[] = $val['lxming'];
                                }
                                $jzjgs2 = implode("；",$jzjgsz2);
                            }
                            $xiugai .= "建筑结构：[".$jzjgs1."]=>[".$jzjgs2."]；";
                        }
                        break;
                    case '7':
                        $dianfei = I('dianfei');
                        $chewei = I('chewei');
                        if ($chewei) {
                            $dshangtcwsl = I('dshangtcwsl');
                            $dxiatcwsl = I('dxiatcwsl');
                            $dshangtcwsj = I('dshangtcwsj');
                            $dxiatcwsj = I('dxiatcwsj');
                            $dshangtcwzl = I('dshangtcwzl');
                            $dxiatcwzl = I('dxiatcwzl');
                            $ceweizldw = I('ceweizldw');
                            $cheweiyzj = I('cheweiyzj');
                        }
                        $dianti = I('dianti');
                        if ($dianti) {
                            $diantifq = I('diantifq');
                        }
                        $wuyefei = I('wuyefei');
                        $wuyedh = I('wuyedh');
                        $cainuanfy = I('cainuanfy');
                        if ($dianfei) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{4})(\.[0][0]{0,1})?$/",$dianfei)) {
                                $this->error('电费请输入＞0且≤一万的数字（限两位小数）！');
                            }
                        }
                        if ($chewei) {
                            $chewei = 1;
                            if ($dshangtcwsl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dshangtcwsl)) {
                                    $this->error('地上车位数请输入＞0且≤一万的整数！');
                                }
                            }
                            if ($dxiatcwsl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dxiatcwsl)) {
                                    $this->error('地下车位数请输入＞0且≤一万的整数！');
                                }
                            }
                            if ($dshangtcwsj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$dshangtcwsj)) {
                                    $this->error('地上车位售价请输入＞0且≤十亿的数字（限六位小数）！');
                                }
                            }
                            if ($dxiatcwsj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$dxiatcwsj)) {
                                    $this->error('地下车位售价请输入＞0且≤十亿的数字（限六位小数）！');
                                }
                            }
                            if ($dshangtcwzl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$dshangtcwzl)) {
                                    $this->error('地上车位租价请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                                if (!$ceweizldw) {
                                    $this->error('请输入车位租赁单位！');
                                }
                            }
                            if ($dxiatcwzl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$dxiatcwzl)) {
                                    $this->error('地下车位租价请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                                if (!$ceweizldw) {
                                    $this->error('请输入车位租赁单位！');
                                }
                            }
                            if ($cheweiyzj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$cheweiyzj)) {
                                    $this->error('车位月租金请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                            }
                        } else {
                            $chewei = 0;
                        }
                        if ($dianti) {
                            $dianti = 1;
                            if ($diantifq) {
                                $diantifq = 1;
                            } else {
                                $diantifq = 0;
                            }
                        } else {
                            $dianti = 0;
                        }
                        if ($wuyefei) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{5})(\.[0][0]{0,1})?$/",$wuyefei)) {
                                $this->error('物业费请输入＞0且≤十万的数字（限两位小数）！');
                            }
                        }
                        if ($wuyedh) {
                            if (strstr($wuyedh,'；')) {
                                $wuyedh1 = explode("；",$wuyedh);
                                foreach ($wuyedh1 as $key => $value) {
                                    if (!preg_match("/^$|^0\d{2,3}-?\d{7,8}$/",$value)) {
                                        $this->error('物业电话请输入正确的电话号码！');
                                    }
                                }
                            } else {
                                if (!preg_match("/^$|^0\d{2,3}-?\d{7,8}$/",$wuyedh)) {
                                    $this->error('物业电话请输入正确的电话号码！');
                                }
                            }
                        }
                        if ($cainuanfy) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{5})(\.[0][0]{0,1})?$/",$cainuanfy)) {
                                $this->error('采暖费用请输入＞0且≤十万的数字（限两位小数）！');
                            }
                        }
                        $gs1 = array_keys(I('gongshuifs'));
                        $gs2 = implode(',',$gs1);
                        $cn1 = array_keys(I('cainuanfs'));
                        $cn2 = implode(',',$cn1);
                        $tx1 = array_keys(I('tongxun'));
                        $tx2 = implode(',',$tx1);
                        $ds1 = array_keys(I('dianshi'));
                        $ds2 = implode(',',$ds1);
                        $aq1 = array_keys(I('sqanquan'));
                        $aq2 = implode(',',$aq1);
                        $data['gongdianlx'] = I('gongdianlx');
                        $data['gongshuilx'] = I('gongshuilx');
                        $data['gongqifs'] = I('gongqifs');
                        $data['dianfei'] = $dianfei;
                        $data['chewei'] = $chewei;
                        if ($chewei) {
                            $data['dshangtcwsl'] = $dshangtcwsl;
                            $data['dxiatcwsl'] = $dxiatcwsl;
                            $data['dshangtcwsj'] = $dshangtcwsj;
                            $data['dxiatcwsj'] = $dxiatcwsj;
                            $data['dshangtcwzl'] = $dshangtcwzl;
                            $data['dxiatcwzl'] = $dxiatcwzl;
                            $data['ceweizldw'] = $ceweizldw;
                            $data['cheweiyzj'] = $cheweiyzj;
                        }
                        $data['dianti'] = $dianti;
                        if ($dianti) {
                            $data['diantifq'] = $diantifq;
                            $data['diantipp'] = I('diantipp');
                            $data['diantixq'] = I('diantixq');
                        }
                        $data['wuyemc'] = I('wuyemc');
                        $data['wuyefei'] = $wuyefei;
                        $data['wuyedh'] = $wuyedh;
                        $data['wuyezz'] = I('wuyezz');
                        $data['wuyelx'] = I('wuyelx');
                        $data['wuyedz'] = I('wuyedz');
                        $data['gongshuifs'] = $gs2;
                        $data['cainuanfs'] = $cn2;
                        $data['cainuanfy'] = $cainuanfy;
                        $data['tongxun'] = $tx2;
                        $data['dianshi'] = $ds2;
                        $data['sqanquan'] = $aq2;
                        if ($xiaoqu['gongdianlx'] != I('gongdianlx') && ($xiaoqu['gongdianlx'] || I('gongdianlx'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongdianlx'],I('gongdianlx'),'gongdianlx');
                        }
                        if ($xiaoqu['gongshuilx'] != I('gongshuilx') && ($xiaoqu['gongshuilx'] || I('gongshuilx'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongshuilx'],I('gongshuilx'),'gongshuilx');
                        }
                        if ($xiaoqu['gongqifs'] != I('gongqifs') && ($xiaoqu['gongqifs'] || I('gongqifs'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongqifs'],I('gongqifs'),'gongqifs');
                        }
                        if ($xiaoqu['dianfei'] != $dianfei && ($xiaoqu['dianfei'] || $dianfei)) {
                            $xiugai .= "电费：[".$xiaoqu['dianfei']."元 / 度]=>[".$dianfei."元 / 度]；";
                        }
                        if ($xiaoqu['chewei'] != $chewei && ($xiaoqu['chewei'] || $chewei)) {
                            if ($xiaoqu['chewei'] == 1) {
                                $xgqdt = "有车位";
                            } else {
                                $xgqdt = "无车位";
                            }
                            if ($chewei == 1) {
                                $xghdt = "有车位";
                            } else {
                                $xghdt = "无车位";
                            }
                            $xiugai .= "车位：[".$xgqdt."]=>[".$xghdt."]；";
                            if ($chewei) {
                                if ($xiaoqu['dshangtcwsl'] != $dshangtcwsl && ($xiaoqu['dshangtcwsl'] || $dshangtcwsl)) {
                                    $xiugai .= "地上车位数量：[".$xiaoqu['dshangtcwsl']."个]=>[".$dshangtcwsl."个]；";
                                }
                                if ($xiaoqu['dxiatcwsl'] != $dxiatcwsl && ($xiaoqu['dxiatcwsl'] || $dxiatcwsl)) {
                                    $xiugai .= "地下车位数量：[".$xiaoqu['dxiatcwsl']."个]=>[".$dxiatcwsl."个]；";
                                }
                                if ($xiaoqu['dshangtcwsj'] != $dshangtcwsj && ($xiaoqu['dshangtcwsj'] || $dshangtcwsj)) {
                                    $xiugai .= "地上车位售价：[".$xiaoqu['dshangtcwsj']."万]=>[".$dshangtcwsj."万]；";
                                }
                                if ($xiaoqu['dxiatcwsj'] != $dxiatcwsj && ($xiaoqu['dxiatcwsj'] || $dxiatcwsj)) {
                                    $xiugai .= "地下车位售价：[".$xiaoqu['dxiatcwsj']."万]=>[".$dxiatcwsj."万]；";
                                }
                                if ($xiaoqu['ceweizldw'] != $ceweizldw && ($xiaoqu['ceweizldw'] || $ceweizldw)) {
                                    $xgqdw = get_peizhi('ceweizldw',$xiaoqu['ceweizldw'],3);
                                    $xghdw = get_peizhi('ceweizldw',I('ceweizldw'),3);
                                    $zldwbd = 1;
                                }
                                if ($xiaoqu['dshangtcwzl'] != $dshangtcwzl && ($xiaoqu['dshangtcwzl'] || $dshangtcwzl) || $zldwbd) {
                                    $xiugai .= "地上车位租赁：[".$xiaoqu['dshangtcwzl'].$xgqdw."]=>[".$dshangtcwzl.$xghdw."]；";
                                }
                                if ($xiaoqu['dxiatcwzl'] != $dxiatcwzl && ($xiaoqu['dxiatcwzl'] || $dxiatcwzl) || $zldwbd) {
                                    $xiugai .= "地下车位租赁：[".$xiaoqu['dxiatcwzl'].$xgqdw."]=>[".$dxiatcwzl.$xghdw."]；";
                                }
                                if ($xiaoqu['cheweiyzj'] != $cheweiyzj && ($xiaoqu['cheweiyzj'] || $cheweiyzj)) {
                                    $xiugai .= "车位月租金：[".$xiaoqu['cheweiyzj']."元 / 月]=>[".$cheweiyzj."元 / 月]；";
                                }
                            }
                        }
                        if ($xiaoqu['dianti'] != $dianti && ($xiaoqu['dianti'] || $dianti)) {
                            if ($xiaoqu['dianti'] == 1) {
                                $xgqdt = "有电梯";
                            } else {
                                $xgqdt = "无电梯";
                            }
                            if ($dianti == 1) {
                                $xghdt = "有电梯";
                            } else {
                                $xghdt = "无电梯";
                            }
                            $xiugai .= "电梯：[".$xgqdt."]=>[".$xghdt."]；";
                            if ($dianti) {
                                if ($xiaoqu['diantifq']) {
                                    $xgqfq = "是";
                                } else {
                                    $xgqfq = "否";
                                }
                                if ($diantifq) {
                                    $xghfq = "是";
                                } else {
                                    $xghfq = "否";
                                }
                                if ($xiaoqu['diantifq'] != $diantifq && ($xiaoqu['diantifq'] || $diantifq)) {
                                    $xiugai .= "电梯是否分区：[".$xgqfq."]=>[".$xghfq."]；";
                                }
                                if ($xiaoqu['diantipp'] != I('diantipp') && ($xiaoqu['diantipp'] || I('diantipp'))) {
                                    $xiugai .= "电梯品牌：[".$xiaoqu['diantipp']."]=>[".I('diantipp')."]；";
                                }
                                if ($xiaoqu['diantixq'] != I('diantixq') && ($xiaoqu['diantixq'] || I('diantixq'))) {
                                    $xiugai .= "电梯详情：[".$xiaoqu['diantixq']."]=>[".I('diantixq')."]；";
                                }
                            }
                        }
                        if ($xiaoqu['wuyemc'] != I('wuyemc') && ($xiaoqu['wuyemc'] || I('wuyemc'))) {
                            $xiugai .= "物业公司：[".$xiaoqu['wuyemc']."]=>[".I('wuyemc')."]；";
                        }
                        if ($xiaoqu['wuyefei'] != $wuyefei && ($xiaoqu['wuyefei'] || $wuyefei)) {
                            $xiugai .= "物业费：[".$xiaoqu['wuyefei']."元 / 平米 · 月]=>[".$wuyefei."元 / 平米 · 月]；";
                        }
                        if ($xiaoqu['wuyedh'] != $wuyedh && ($xiaoqu['wuyedh'] || $wuyedh)) {
                            $xiugai .= "物业电话：[".$xiaoqu['wuyedh']."]=>[".$wuyedh."]；";
                        }
                        if ($xiaoqu['wuyezz'] != I('wuyezz') && ($xiaoqu['wuyezz'] || I('wuyezz'))) {
                            $xiugai .= get_xiugai($xiaoqu['wuyezz'],I('wuyezz'),'wuyezz');
                        }
                        if ($xiaoqu['wuyelx'] != I('wuyelx') && ($xiaoqu['wuyelx'] || I('wuyelx'))) {
                            $xiugai .= get_xiugai($xiaoqu['wuyelx'],I('wuyelx'),'wuyelx');
                        }
                        if ($xiaoqu['wuyedz'] != I('wuyedz') && ($xiaoqu['wuyedz'] || I('wuyedz'))) {
                            $xiugai .= "物业地址：[".$xiaoqu['wuyedz']."]=>[".I('wuyedz')."]；";
                        }
                        if ($xiaoqu['gongshuifs'] != $gs2 && ($xiaoqu['gongshuifs'] || $gs2)) {
                            if ($xiaoqu['gongshuifs']) {
                                $condition1 = "pzming = 'gongshuifs' and lxid in (".$xiaoqu['gongshuifs'].")";
                                $gongshuifs1 = $Model->query("select * from __PEIZHI__ where {$condition1} order by xsshunxu asc");
                                $gsfssz1 = array();
                                foreach ($gongshuifs1 AS $key => $val) {
                                    $gsfssz1[] = $val['lxming'];
                                }
                                $gsfss1 = implode("；",$gsfssz1);
                            }
                            if ($gs2) {
                                $condition2 = "pzming = 'gongshuifs' and lxid in (".$gs2.")";
                                $gongshuifs2 = $Model->query("select * from __PEIZHI__ where {$condition2} order by xsshunxu asc");
                                $gsfssz2 = array();
                                foreach ($gongshuifs2 AS $key => $val) {
                                    $gsfssz2[] = $val['lxming'];
                                }
                                $gsfss2 = implode("；",$gsfssz2);
                            }
                            $xiugai .= "供水方式：[".$gsfss1."]=>[".$gsfss2."]；";
                        }
                        if ($xiaoqu['cainuanfs'] != $cn2 && ($xiaoqu['cainuanfs'] || $cn2)) {
                            if ($xiaoqu['cainuanfs']) {
                                $condition3 = "pzming = 'cainuanfs' and lxid in (".$xiaoqu['cainuanfs'].")";
                                $cainuanfs1 = $Model->query("select * from __PEIZHI__ where {$condition3} order by xsshunxu asc");
                                $cnfssz1 = array();
                                foreach ($cainuanfs1 AS $key => $val) {
                                    $cnfssz1[] = $val['lxming'];
                                }
                                $cnfss1 = implode("；",$cnfssz1);
                            }
                            if ($cn2) {
                                $condition4 = "pzming = 'cainuanfs' and lxid in (".$cn2.")";
                                $cainuanfs2 = $Model->query("select * from __PEIZHI__ where {$condition4} order by xsshunxu asc");
                                $cnfssz2 = array();
                                foreach ($cainuanfs2 AS $key => $val) {
                                    $cnfssz2[] = $val['lxming'];
                                }
                                $cnfss2 = implode("；",$cnfssz2);
                            }
                            $xiugai .= "采暖方式：[".$cnfss1."]=>[".$cnfss2."]；";
                        }
                        if ($xiaoqu['cainuanfy'] != $cainuanfy && ($xiaoqu['cainuanfy'] || $cainuanfy)) {
                            $xiugai .= "采暖费用：[".$xiaoqu['cainuanfy']."元 / m² / 供暖季]=>[".$cainuanfy."元 / m² / 供暖季]；";
                        }
                        if ($xiaoqu['tongxun'] != $tx2 && ($xiaoqu['tongxun'] || $tx2)) {
                            if ($xiaoqu['tongxun']) {
                                $condition5 = "pzming = 'tongxun' and lxid in (".$xiaoqu['tongxun'].")";
                                $tongxun1 = $Model->query("select * from __PEIZHI__ where {$condition5} order by xsshunxu asc");
                                $txpzsz1 = array();
                                foreach ($tongxun1 AS $key => $val) {
                                    $txpzsz1[] = $val['lxming'];
                                }
                                $txpzs1 = implode("；",$txpzsz1);
                            }
                            if ($tx2) {
                                $condition6 = "pzming = 'tongxun' and lxid in (".$tx2.")";
                                $tongxun2 = $Model->query("select * from __PEIZHI__ where {$condition6} order by xsshunxu asc");
                                $txpzsz2 = array();
                                foreach ($tongxun2 AS $key => $val) {
                                    $txpzsz2[] = $val['lxming'];
                                }
                                $txpzs2 = implode("；",$txpzsz2);
                            }
                            $xiugai .= "通讯配置：[".$txpzs1."]=>[".$txpzs2."]；";
                        }
                        if ($xiaoqu['dianshi'] != $ds2 && ($xiaoqu['dianshi'] || $ds2)) {
                            if ($xiaoqu['dianshi']) {
                                $condition7 = "pzming = 'dianshi' and lxid in (".$xiaoqu['dianshi'].")";
                                $dianshi1 = $Model->query("select * from __PEIZHI__ where {$condition7} order by xsshunxu asc");
                                $lpdssz1 = array();
                                foreach ($dianshi1 AS $key => $val) {
                                    $lpdssz1[] = $val['lxming'];
                                }
                                $lpdss1 = implode("；",$lpdssz1);
                            }
                            if ($ds2) {
                                $condition8 = "pzming = 'dianshi' and lxid in (".$ds2.")";
                                $dianshi2 = $Model->query("select * from __PEIZHI__ where {$condition8} order by xsshunxu asc");
                                $lpdssz2 = array();
                                foreach ($dianshi2 AS $key => $val) {
                                    $lpdssz2[] = $val['lxming'];
                                }
                                $lpdss2 = implode("；",$lpdssz2);
                            }
                            $xiugai .= "电视：[".$jzjgs1."]=>[".$jzjgs2."]；";
                        }
                        if ($xiaoqu['sqanquan'] != $aq2 && ($xiaoqu['sqanquan'] || $aq2)) {
                            if ($xiaoqu['sqanquan']) {
                                $condition9 = "pzming = 'sqanquan' and lxid in (".$xiaoqu['sqanquan'].")";
                                $sqanquan1 = $Model->query("select * from __PEIZHI__ where {$condition9} order by xsshunxu asc");
                                $sqaqsz1 = array();
                                foreach ($sqanquan1 AS $key => $val) {
                                    $sqaqsz1[] = $val['lxming'];
                                }
                                $sqaqs1 = implode("；",$sqaqsz1);
                            }
                            if ($aq2) {
                                $condition10 = "pzming = 'sqanquan' and lxid in (".$aq2.")";
                                $sqanquan2 = $Model->query("select * from __PEIZHI__ where {$condition10} order by xsshunxu asc");
                                $sqaqsz2 = array();
                                foreach ($sqanquan2 AS $key => $val) {
                                    $sqaqsz2[] = $val['lxming'];
                                }
                                $sqaqs2 = implode("；",$sqaqsz2);
                            }
                            $xiugai .= "社区安全：[".$sqaqs1."]=>[".$sqaqs2."]；";
                        }
                        break;
                    case '8':
                        $zhuce = I('zhuce');
                        $wa = I('5a');
                        $xmgaodu = I('xmgaodu');
                        $bzcjzmj = I('bzcjzmj');
                        $youhui = I('youhui');
                        if ($zhuce) {
                            $zhuce = 1;
                        } else {
                            $zhuce = 0;
                        }
                        if ($wa) {
                            $wa = 1;
                        } else {
                            $wa = 0;
                        }
                        if ($xmgaodu) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,2})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{3})(\.[0][0]{0,1})?$/",$xmgaodu)) {
                                $this->error('项目高度请输入＞0且≤一千的数字（限两位小数）！');
                            }
                        }
                        if ($bzcjzmj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,6})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{7})(\.[0][0]{0,1})?$/",$bzcjzmj)) {
                                $this->error('标准层建筑面积请输入＞0且≤一千万的数字（限两位小数）！');
                            }
                        }
                        if ($youhui) {
                            $youhui = 1;
                        } else {
                            $youhui = 0;
                        }
                        $data['zhuce'] = $zhuce;
                        $data['5a'] = $wa;
                        $data['xmjibie'] = I('xmjibie');
                        $data['xmgaodu'] = $xmgaodu;
                        $data['spjzleixing'] = I('spjzleixing');
                        $data['kangzhen'] = I('kangzhen');
                        $data['bzcjzmj'] = $bzcjzmj;
                        $data['youhui'] = $youhui;
                        if ($dianti) {
                            $data['youhuizc'] = I('youhuizc');
                        }
                        $data['wlmzxbz'] = I('wlmzxbz');
                        if ($xiaoqu['zhuce'] != $zhuce && ($xiaoqu['zhuce'] || $zhuce)) {
                            if ($xiaoqu['zhuce'] == 1) {
                                $xgqzc = "是";
                            } else {
                                $xgqzc = "否";
                            }
                            if ($zhuce == 1) {
                                $xghzc = "是";
                            } else {
                                $xghzc = "否";
                            }
                            $xiugai .= "是否可注册：[".$xgqzc."]=>[".$xghzc."]；";
                        }
                        if ($xiaoqu['5a'] != $wa && ($xiaoqu['5a'] || $wa)) {
                            if ($xiaoqu['5a'] == 1) {
                                $xgq5a = "是";
                            } else {
                                $xgq5a = "否";
                            }
                            if ($wa == 1) {
                                $xgh5a = "是";
                            } else {
                                $xgh5a = "否";
                            }
                            $xiugai .= "是否5A：[".$xgq5a."]=>[".$xgh5a."]；";
                        }
                        if ($xiaoqu['xmjibie'] != I('xmjibie') && ($xiaoqu['xmjibie'] || I('xmjibie'))) {
                            $xiugai .= get_xiugai($xiaoqu['xmjibie'],I('xmjibie'),'xmjibie');
                        }
                        if ($xiaoqu['xmgaodu'] != $xmgaodu && ($xiaoqu['xmgaodu'] || $xmgaodu)) {
                            $xiugai .= "项目高度：[".$xiaoqu['xmgaodu']."米]=>[".$xmgaodu."米]；";
                        }
                        if ($xiaoqu['spjzleixing'] != I('spjzleixing') && ($xiaoqu['spjzleixing'] || I('spjzleixing'))) {
                            $xiugai .= get_xiugai($xiaoqu['spjzleixing'],I('spjzleixing'),'spjzleixing');
                        }
                        if ($xiaoqu['kangzhen'] != I('kangzhen') && ($xiaoqu['kangzhen'] || I('kangzhen'))) {
                            $xiugai .= get_xiugai($xiaoqu['kangzhen'],I('kangzhen'),'kangzhen');
                        }
                        if ($xiaoqu['bzcjzmj'] != $bzcjzmj && ($xiaoqu['bzcjzmj'] || $bzcjzmj)) {
                            $xiugai .= "标准层建筑面积：[".$xiaoqu['bzcjzmj']."m²]=>[".$bzcjzmj."m²]；";
                        }
                        if ($xiaoqu['youhui'] != $youhui && ($xiaoqu['youhui'] || $youhui)) {
                            if ($xiaoqu['youhui'] == 1) {
                                $xgqyh = "有优惠";
                            } else {
                                $xgqyh = "无优惠";
                            }
                            if ($youhui == 1) {
                                $xghyh = "有优惠";
                            } else {
                                $xghyh = "无优惠";
                            }
                            $xiugai .= "优惠：[".$xgqyh."]=>[".$xghyh."]；";
                            if ($youhui) {
                                if ($xiaoqu['youhuizc'] != I('youhuizc') && ($xiaoqu['youhuizc'] || I('youhuizc'))) {
                                    $xiugai .= "优惠政策：[".$xiaoqu['youhuizc']."]=>[".I('youhuizc')."]；";
                                }
                            }
                        }
                        if ($xiaoqu['wlmzxbz'] != I('wlmzxbz') && ($xiaoqu['wlmzxbz'] || I('wlmzxbz'))) {
                            $xiugai .= "外立面装修标准：[".$xiaoqu['wlmzxbz']."]=>[".I('wlmzxbz')."]；";
                        }
                        break;
                    case '9':
                        $wldiban = I('wldiban');
                        if ($wldiban) {
                            $wldibangd = I('wldibangd');
                        }
                        $ygcanting = I('ygcanting');
                        $yjfjzx = I('yjfjzx');
                        $xfsjgyl = I('xfsjgyl');
                        if ($wldiban) {
                            $wldiban = 1;
                            if ($wldibangd) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,2})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{3})(\.[0][0]{0,1})?$/",$wldibangd)) {
                                    $this->error('网络地板高度请输入＞0且≤一千的数字（限两位小数）！');
                                }
                            }
                            $db1 = array_keys(I('wldibanlx'));
                            $db2 = implode(',',$db1);
                        } else {
                            $wldiban = 0;
                        }
                        if ($ygcanting) {
                            $ygcanting = 1;
                        } else {
                            $ygcanting = 0;
                        }
                        if ($yjfjzx) {
                            $yjfjzx = 1;
                        } else {
                            $yjfjzx = 0;
                        }
                        if ($xfsjgyl) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{4})(\.[0][0]{0,1})?$/",$xfsjgyl)) {
                                $this->error('新风设计供应量请输入＞0且≤一万的数字（限两位小数）！');
                            }
                        }
                        $data['wldiban'] = $wldiban;
                        if ($wldiban) {
                            $data['wldibangd'] = $wldibangd;
                            $data['wldibanlx'] = $db2;
                        }
                        $data['ygcanting'] = $ygcanting;
                        if ($ygcanting) {
                            $data['ygcantingjj'] = I('ygcantingjj');
                        }
                        $data['yjfjzx'] = $yjfjzx;
                        $data['zyktpp'] = I('zyktpp');
                        $data['zyktgzsj'] = I('zyktgzsj');
                        $data['zyktjsf'] = I('zyktjsf');
                        $data['xfsjgyl'] = $xfsjgyl;
                        if ($xiaoqu['wldiban'] != $wldiban && ($xiaoqu['wldiban'] || $wldiban)) {
                            if ($xiaoqu['wldiban'] == 1) {
                                $xgqdb = "是";
                            } else {
                                $xgqdb = "否";
                            }
                            if ($wldiban == 1) {
                                $xghdb = "是";
                            } else {
                                $xghdb = "否";
                            }
                            $xiugai .= "网络地板：[".$xgqdb."]=>[".$xghdb."]；";
                            if ($wldiban) {
                                if ($xiaoqu['wldibangd'] != $wldibangd && ($xiaoqu['wldibangd'] || $wldibangd)) {
                                    $xiugai .= "网络地板高度：[".$xiaoqu['wldibangd']."毫米]=>[".$wldibangd."毫米]；";
                                }
                                if ($xiaoqu['wldibanlx'] != $db2 && ($xiaoqu['wldibanlx'] || $db2)) {
                                    if ($xiaoqu['wldibanlx']) {
                                        $condition1 = "pzming = 'wldibanlx' and lxid in (".$xiaoqu['wldibanlx'].")";
                                        $wldibanlx1 = $Model->query("select * from __PEIZHI__ where {$condition1} order by xsshunxu asc");
                                        $wldbsz1 = array();
                                        foreach ($wldibanlx1 AS $key => $val) {
                                            $wldbsz1[] = $val['lxming'];
                                        }
                                        $wldbs1 = implode("；",$wldbsz1);
                                    }
                                    if ($db2) {
                                        $condition2 = "pzming = 'wldibanlx' and lxid in (".$db2.")";
                                        $wldibanlx2 = $Model->query("select * from __PEIZHI__ where {$condition2} order by xsshunxu asc");
                                        $wldbsz2 = array();
                                        foreach ($wldibanlx2 AS $key => $val) {
                                            $wldbsz2[] = $val['lxming'];
                                        }
                                        $wldbs2 = implode("；",$wldbsz2);
                                    }
                                    $xiugai .= "网络地板类型：[".$wldbs1."]=>[".$wldbs2."]；";
                                }
                            }
                        }
                        if ($xiaoqu['ygcanting'] != $ygcanting && ($xiaoqu['ygcanting'] || $ygcanting)) {
                            if ($xiaoqu['ygcanting'] == 1) {
                                $xgqdt = "有";
                            } else {
                                $xgqdt = "无";
                            }
                            if ($ygcanting == 1) {
                                $xghdt = "有";
                            } else {
                                $xghdt = "无";
                            }
                            $xiugai .= "员工餐厅：[".$xgqdt."]=>[".$xghdt."]；";
                            if ($ygcanting) {
                                if ($xiaoqu['ygcantingjj'] != I('ygcantingjj') && ($xiaoqu['ygcantingjj'] || I('ygcantingjj'))) {
                                    $xiugai .= "员工餐厅简介：[".$xiaoqu['ygcantingjj']."]=>[".I('ygcantingjj')."]；";
                                }
                            }
                        }
                        if ($xiaoqu['yjfjzx'] != $yjfjzx && ($xiaoqu['yjfjzx'] || $yjfjzx)) {
                            if ($xiaoqu['yjfjzx'] == 1) {
                                $xgqdt = "有";
                            } else {
                                $xgqdt = "无";
                            }
                            if ($yjfjzx == 1) {
                                $xghdt = "有";
                            } else {
                                $xghdt = "无";
                            }
                            $xiugai .= "邮件分拣中心：[".$xgqdt."]=>[".$xghdt."]；";
                        }
                        if ($xiaoqu['zyktpp'] != I('zyktpp') && ($xiaoqu['zyktpp'] || I('zyktpp'))) {
                            $xiugai .= "中央空调品牌：[".$xiaoqu['zyktpp']."]=>[".I('zyktpp')."]；";
                        }
                        if ($xiaoqu['zyktgzsj'] != I('zyktgzsj') && ($xiaoqu['zyktgzsj'] || I('zyktgzsj'))) {
                            $xiugai .= "中央空调工作时间：[".$xiaoqu['zyktgzsj']."]=>[".I('zyktgzsj')."]；";
                        }
                        if ($xiaoqu['zyktjsf'] != I('zyktjsf') && ($xiaoqu['zyktjsf'] || I('zyktjsf'))) {
                            $xiugai .= "中央空调加时费：[".$xiaoqu['zyktjsf']."]=>[".I('zyktjsf')."]；";
                        }
                        if ($xiaoqu['xfsjgyl'] != $xfsjgyl && ($xiaoqu['xfsjgyl'] || $xfsjgyl)) {
                            $xiugai .= "新风设计供应量：[".$xiaoqu['xfsjgyl']."m³ / 人 / 小时]=>[".$xfsjgyl."m³ / 人 / 小时]；";
                        }
                        break;
                    default:
                        $condition['gongsiid'] = session('gongsiid');
                        $condition['id'] = array('neq',$id);
                        $ssxzq = I('ssxzq');
                        $sspianqu = I('sspianqu');
                        $xiaoqum = I('xiaoqum');
                        $condition['ssxzq'] = $ssxzq;
                        $condition['sspianqu'] = $sspianqu;
                        $condition['xiaoqum'] = $xiaoqum;
                        $cfxq = M('xiaoqu')->where($condition)->find();
                        if($cfxq){
                            $this->error('楼盘已存在');
                        }
                        $whrid = I('whrid');
                        $yhbm = yhbm($whrid,1);
                        $yh = _rbac_btn_show(176,0,$whrid);
                        if (!$yh || !$whrid) {
                            $this->error('异常错误！');
                        }
                        $lpleixing = I('lpleixing');
                        $rongjilv = I('rongjilv');
                        $lvhualv = I('lvhualv');
                        $zhandimj = I('zhandimj');
                        $jianzhumj = I('jianzhumj');
                        $jianzaond = I('jianzaond');
                        $csjunjia = I('csjunjia');
                        $czjunjia = I('czjunjia');
                        $chewei = I('chewei');
                        if ($chewei) {
                            $dshangtcwsl = I('dshangtcwsl');
                            $dxiatcwsl = I('dxiatcwsl');
                            $dshangtcwsj = I('dshangtcwsj');
                            $dxiatcwsj = I('dxiatcwsj');
                            $dshangtcwzl = I('dshangtcwzl');
                            $dxiatcwzl = I('dxiatcwzl');
                            $ceweizldw = I('ceweizldw');
                            $cheweiyzj = I('cheweiyzj');
                        }
                        $dianti = I('dianti');
                        if ($dianti) {
                            $diantifq = I('diantifq');
                        }
                        $youzheng = I('youzheng');
                        $wuyefei = I('wuyefei');
                        $wuyedh = I('wuyedh');
                        $lplxs = "1,2,3,4";
                        $lplxs1 = explode(",",$lplxs);
                        if (in_array($lpleixing,$lplxs1)) {
                            $lpleixing = $lpleixing;
                        } else {
                            $lpleixing = 4;
                        }
                        if ($rongjilv) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$rongjilv)) {
                                $this->error('容积率请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($lvhualv) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,1})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{2})(\.[0][0]{0,1})?$/",$lvhualv)) {
                                $this->error('绿化率请输入＞0且≤100的数字（限两位小数）！');
                            }
                        }
                        if ($zhandimj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$zhandimj)) {
                                $this->error('占地面积请输入＞0且≤一百万的数字（限两位小数）！');
                            }
                        }
                        if ($jianzhumj) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,6})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{7})(\.[0][0]{0,1})?$/",$jianzhumj)) {
                                $this->error('建筑面积请输入＞0且≤一千万的数字（限两位小数）！');
                            }
                        }
                        if ($jianzaond) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$jianzaond)) {
                                $this->error('建造年代请输入＞0且≤一万的整数！');
                            }
                        }
                        if ($csjunjia) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$csjunjia)) {
                                $this->error('出售均价请输入＞0且≤十亿的数字（限六位小数）！');
                            }
                        }
                        if ($czjunjia) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$czjunjia)) {
                                $this->error('出租均价请输入＞0且≤一百万的数字（限两位小数）！');
                            }
                        }
                        if ($chewei) {
                            $chewei = 1;
                            if ($dshangtcwsl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dshangtcwsl)) {
                                    $this->error('地上车位数请输入＞0且≤一万的整数！');
                                }
                            }
                            if ($dxiatcwsl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,3})$|^(1[0]{4})$/",$dxiatcwsl)) {
                                    $this->error('地下车位数请输入＞0且≤一万的整数！');
                                }
                            }
                            if ($dshangtcwsj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$dshangtcwsj)) {
                                    $this->error('地上车位售价请输入＞0且≤十亿的数字（限六位小数）！');
                                }
                            }
                            if ($dxiatcwsj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,6})?$|^([0]\.[1-9][0-9]{0,5})$|^([0]\.[0][0-9]{0,4}[1-9]{1})$|^([0]\.[0]{2}[0-9]{0,3}[1-9]{1})$|^([0]\.[0]{3}[0-9]{0,2}[1-9]{1})$|^([0]\.[0]{4}[0-9]{0,1}[1-9]{1})$|^([0]\.[0]{5}[1-9]{1})$|^(1[0]{5})(\.[0][0]{0,5})?$/",$dxiatcwsj)) {
                                    $this->error('地下车位售价请输入＞0且≤十亿的数字（限六位小数）！');
                                }
                            }
                            if ($dshangtcwzl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$dshangtcwzl)) {
                                    $this->error('地上车位租价请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                                if (!$ceweizldw) {
                                    $this->error('请输入车位租赁单位！');
                                }
                            }
                            if ($dxiatcwzl) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$dxiatcwzl)) {
                                    $this->error('地下车位租价请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                                if (!$ceweizldw) {
                                    $this->error('请输入车位租赁单位！');
                                }
                            }
                            if ($cheweiyzj) {
                                if (!preg_match("/^$|^([1-9][0-9]{0,5})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{6})(\.[0][0]{0,1})?$/",$cheweiyzj)) {
                                    $this->error('车位月租金请输入＞0且≤一百万的数字（限两位小数）！');
                                }
                            }
                        } else {
                            $chewei = 0;
                        }
                        if ($dianti) {
                            $dianti = 1;
                            if ($diantifq) {
                                $diantifq = 1;
                            } else {
                                $diantifq = 0;
                            }
                        } else {
                            $dianti = 0;
                        }
                        if ($youzheng) {
                            if (!preg_match("/^$|^[0-9]{6}$/",$youzheng)) {
                                $this->error('请输入正确的邮政编码！');
                            }
                        }
                        if ($wuyefei) {
                            if (!preg_match("/^$|^([1-9][0-9]{0,4})(\.[0-9]{1,2})?$|^([0]\.[1-9][0-9]{0,1})$|^([0]\.[0][1-9]{1})$|^(1[0]{5})(\.[0][0]{0,1})?$/",$wuyefei)) {
                                $this->error('物业费请输入＞0且≤十万的数字（限两位小数）！');
                            }
                        }
                        if ($wuyedh) {
                            if (strstr($wuyedh,'；')) {
                                $wuyedh1 = explode("；",$wuyedh);
                                foreach ($wuyedh1 as $key => $value) {
                                    if (!preg_match("/^$|^0\d{2,3}-?\d{7,8}$/",$value)) {
                                        $this->error('物业电话请输入正确的电话号码！');
                                    }
                                }
                            } else {
                                if (!preg_match("/^$|^0\d{2,3}-?\d{7,8}$/",$wuyedh)) {
                                    $this->error('物业电话请输入正确的电话号码！');
                                }
                            }
                        }
                        $data['xiaoqum'] = $xiaoqum;
                        $data['lpleixing'] = $lpleixing;
                        $data['ssxzq'] = $ssxzq;
                        $data['sspianqu'] = $sspianqu;
                        $data['whrid'] = $whrid;
                        $data['bumen'] = $yhbm;
                        $data['pinyinjs'] = I('pinyinjs');
                        $data['xiaoqubm'] = I('xiaoqubm');
                        $data['rongjilv'] = $rongjilv;
                        $data['lvhualv'] = $lvhualv;
                        $data['zhandimj'] = $zhandimj;
                        $data['jianzhumj'] = $jianzhumj;
                        $data['jianzaond'] = $jianzaond;
                        $data['csjunjia'] = $csjunjia;
                        $data['czjunjia'] = $czjunjia;
                        $data['gongdianlx'] = I('gongdianlx');
                        $data['gongshuilx'] = I('gongshuilx');
                        $data['gongqifs'] = I('gongqifs');
                        $data['chewei'] = $chewei;
                        if ($chewei) {
                            $data['dshangtcwsl'] = $dshangtcwsl;
                            $data['dxiatcwsl'] = $dxiatcwsl;
                            $data['dshangtcwsj'] = $dshangtcwsj;
                            $data['dxiatcwsj'] = $dxiatcwsj;
                            $data['dshangtcwzl'] = $dshangtcwzl;
                            $data['dxiatcwzl'] = $dxiatcwzl;
                            $data['ceweizldw'] = $ceweizldw;
                            $data['cheweiyzj'] = $cheweiyzj;
                        }
                        $data['dianti'] = $dianti;
                        if ($dianti) {
                            $data['diantifq'] = $diantifq;
                            $data['diantipp'] = I('diantipp');
                            $data['diantixq'] = I('diantixq');
                        }
                        $data['youzheng'] = $youzheng;
                        $data['wuyefei'] = $wuyefei;
                        $data['wuyedh'] = $wuyedh;
                        $data['wuyemc'] = I('wuyemc');
                        $data['wuyedz'] = I('wuyedz');
                        $data['jiedao'] = I('jiedao');
                        $data['xiaoqudz'] = I('xiaoqudz');
                        $data['jianjie'] = I('jianjie');
                        $data['beizhu'] = I('beizhu');
                        if ($xiaoqu['xiaoqum'] != $xiaoqum && ($xiaoqu['xiaoqum'] || $xiaoqum)) {
                            $xiugai .= "楼盘名称：[".$xiaoqu['xiaoqum']."]=>[".$xiaoqum."]；";
                        }
                        if ($xiaoqu['lpleixing'] != $lpleixing && ($xiaoqu['lpleixing'] || $lpleixing)) {
                            switch ($xiaoqu['lpleixing']) {
                                case '1':
                                    $xgqlplx = "写字楼";
                                    break;
                                case '2':
                                    $xgqlplx = "商铺";
                                    break;
                                case '3':
                                    $xgqlplx = "住宅";
                                    break;
                                case '4':
                                    $xgqlplx = "混合型";
                                    break;
                                default:
                                    $xgqlplx = "混合型";
                                    break;
                            }
                            switch ($lpleixing) {
                                case '1':
                                    $xghlplx = "写字楼";
                                    break;
                                case '2':
                                    $xghlplx = "商铺";
                                    break;
                                case '3':
                                    $xghlplx = "住宅";
                                    break;
                                case '4':
                                    $lxbd = 1;
                                    $xghlplx = "混合型";
                                    break;
                                default:
                                    $lxbd = 1;
                                    $xghlplx = "混合型";
                                    break;
                            }
                            if ($lxbd != 1) {
                                $xghlxbg = "，（楼盘下所有座栋、房间的类型均更改为".$xghlplx."）；";
                            }
                            $xiugai .= "物业类型：[".$xgqlplx."]=>[".$xghlplx."]".$xghlxbg."；";
                        }
                        if ($xiaoqu['ssxzq'] != $ssxzq && ($xiaoqu['ssxzq'] || $ssxzq)) {
                            $xiugai .= "所属行政区：[".zym($xiaoqu['ssxzq'],1)."]=>[".zym($ssxzq,1)."]；";
                        }
                        if ($xiaoqu['sspianqu'] != $sspianqu && ($xiaoqu['sspianqu'] || $sspianqu)) {
                            $xiugai .= "所属商圈：[".zym($xiaoqu['sspianqu'],2)."]=>[".zym($sspianqu,2)."]；";
                        }
                        if ($xiaoqu['whrid'] != $whrid && ($xiaoqu['whrid'] || $whrid)) {
                            $xiugai .= "维护人：[".zym($xiaoqu['whrid'],5)."]=>[".zym($whrid,5)."]；";
                            $xiugai .= "维护部门：[".yhbm($xiaoqu['whrid'],3)."]=>[".yhbm($whrid,3)."]；";
                        }
                        if ($xiaoqu['pinyinjs'] != I('pinyinjs') && ($xiaoqu['pinyinjs'] || I('pinyinjs'))) {
                            $xiugai .= "拼音检索：[".$xiaoqu['pinyinjs']."]=>[".I('pinyinjs')."]；";
                        }
                        if ($xiaoqu['xiaoqubm'] != I('xiaoqubm') && ($xiaoqu['xiaoqubm'] || I('xiaoqubm'))) {
                            $xiugai .= "楼盘别名：[".$xiaoqu['xiaoqubm']."]=>[".I('xiaoqubm')."]；";
                        }
                        if ($xiaoqu['rongjilv'] != $rongjilv && ($xiaoqu['rongjilv'] || $rongjilv)) {
                            $xiugai .= "容积率：[".$xiaoqu['rongjilv']."%]=>[".$rongjilv."%]；";
                        }
                        if ($xiaoqu['lvhualv'] != $lvhualv && ($xiaoqu['lvhualv'] || $lvhualv)) {
                            $xiugai .= "绿化率：[".$xiaoqu['lvhualv']."%]=>[".$lvhualv."%]；";
                        }
                        if ($xiaoqu['zhandimj'] != $zhandimj && ($xiaoqu['zhandimj'] || $zhandimj)) {
                            $xiugai .= "占地面积：[".$xiaoqu['zhandimj']."m²]=>[".$zhandimj."m²]；";
                        }
                        if ($xiaoqu['jianzhumj'] != $jianzhumj && ($xiaoqu['jianzhumj'] || $jianzhumj)) {
                            $xiugai .= "建筑面积：[".$xiaoqu['jianzhumj']."m²]=>[".$jianzhumj."m²]；";
                        }
                        if ($xiaoqu['jianzaond'] != $jianzaond && ($xiaoqu['jianzaond'] || $jianzaond)) {
                            $xiugai .= "建造年代：[".$xiaoqu['jianzaond']."年]=>[".$jianzaond."年]；";
                        }
                        if ($xiaoqu['csjunjia'] != $csjunjia && ($xiaoqu['csjunjia'] || $csjunjia)) {
                            $xiugai .= "出售均价：[".$xiaoqu['csjunjia']."元 / m²]=>[".$csjunjia."元 / m²]；";
                        }
                        if ($xiaoqu['czjunjia'] != $czjunjia && ($xiaoqu['czjunjia'] || $czjunjia)) {
                            $xiugai .= "出租均价：[".$xiaoqu['czjunjia']."元 / 月]=>[".$czjunjia."元 / 月]；";
                        }
                        if ($xiaoqu['gongdianlx'] != I('gongdianlx') && ($xiaoqu['gongdianlx'] || I('gongdianlx'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongdianlx'],I('gongdianlx'),'gongdianlx');
                        }
                        if ($xiaoqu['gongshuilx'] != I('gongshuilx') && ($xiaoqu['gongshuilx'] || I('gongshuilx'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongshuilx'],I('gongshuilx'),'gongshuilx');
                        }
                        if ($xiaoqu['gongqifs'] != I('gongqifs') && ($xiaoqu['gongqifs'] || I('gongqifs'))) {
                            $xiugai .= get_xiugai($xiaoqu['gongqifs'],I('gongqifs'),'gongqifs');
                        }
                        if ($xiaoqu['chewei'] != $chewei && ($xiaoqu['chewei'] || $chewei)) {
                            if ($xiaoqu['chewei'] == 1) {
                                $xgqdt = "有车位";
                            } else {
                                $xgqdt = "无车位";
                            }
                            if ($chewei == 1) {
                                $xghdt = "有车位";
                            } else {
                                $xghdt = "无车位";
                            }
                            $xiugai .= "车位：[".$xgqdt."]=>[".$xghdt."]；";
                            if ($chewei) {
                                if ($xiaoqu['dshangtcwsl'] != $dshangtcwsl && ($xiaoqu['dshangtcwsl'] || $dshangtcwsl)) {
                                    $xiugai .= "地上车位数量：[".$xiaoqu['dshangtcwsl']."个]=>[".$dshangtcwsl."个]；";
                                }
                                if ($xiaoqu['dxiatcwsl'] != $dxiatcwsl && ($xiaoqu['dxiatcwsl'] || $dxiatcwsl)) {
                                    $xiugai .= "地下车位数量：[".$xiaoqu['dxiatcwsl']."个]=>[".$dxiatcwsl."个]；";
                                }
                                if ($xiaoqu['dshangtcwsj'] != $dshangtcwsj && ($xiaoqu['dshangtcwsj'] || $dshangtcwsj)) {
                                    $xiugai .= "地上车位售价：[".$xiaoqu['dshangtcwsj']."万]=>[".$dshangtcwsj."万]；";
                                }
                                if ($xiaoqu['dxiatcwsj'] != $dxiatcwsj && ($xiaoqu['dxiatcwsj'] || $dxiatcwsj)) {
                                    $xiugai .= "地下车位售价：[".$xiaoqu['dxiatcwsj']."万]=>[".$dxiatcwsj."万]；";
                                }
                                if ($xiaoqu['ceweizldw'] != $ceweizldw && ($xiaoqu['ceweizldw'] || $ceweizldw)) {
                                    $xgqdw = get_peizhi('ceweizldw',$xiaoqu['ceweizldw'],3);
                                    $xghdw = get_peizhi('ceweizldw',I('ceweizldw'),3);
                                    $zldwbd = 1;
                                }
                                if ($xiaoqu['dshangtcwzl'] != $dshangtcwzl && ($xiaoqu['dshangtcwzl'] || $dshangtcwzl) || $zldwbd) {
                                    $xiugai .= "地上车位租赁：[".$xiaoqu['dshangtcwzl'].$xgqdw."]=>[".$dshangtcwzl.$xghdw."]；";
                                }
                                if ($xiaoqu['dxiatcwzl'] != $dxiatcwzl && ($xiaoqu['dxiatcwzl'] || $dxiatcwzl) || $zldwbd) {
                                    $xiugai .= "地下车位租赁：[".$xiaoqu['dxiatcwzl'].$xgqdw."]=>[".$dxiatcwzl.$xghdw."]；";
                                }
                                if ($xiaoqu['cheweiyzj'] != $cheweiyzj && ($xiaoqu['cheweiyzj'] || $cheweiyzj)) {
                                    $xiugai .= "车位月租金：[".$xiaoqu['cheweiyzj']."元 / 月]=>[".$cheweiyzj."元 / 月]；";
                                }
                            }
                        }
                        if ($xiaoqu['dianti'] != $dianti && ($xiaoqu['dianti'] || $dianti)) {
                            if ($xiaoqu['dianti'] == 1) {
                                $xgqdt = "有电梯";
                            } else {
                                $xgqdt = "无电梯";
                            }
                            if ($dianti == 1) {
                                $xghdt = "有电梯";
                            } else {
                                $xghdt = "无电梯";
                            }
                            $xiugai .= "电梯：[".$xgqdt."]=>[".$xghdt."]；";
                            if ($dianti) {
                                if ($xiaoqu['diantifq']) {
                                    $xgqfq = "是";
                                } else {
                                    $xgqfq = "否";
                                }
                                if ($diantifq) {
                                    $xghfq = "是";
                                } else {
                                    $xghfq = "否";
                                }
                                if ($xiaoqu['diantifq'] != $diantifq && ($xiaoqu['diantifq'] || $diantifq)) {
                                    $xiugai .= "电梯是否分区：[".$xgqfq."]=>[".$xghfq."]；";
                                }
                                if ($xiaoqu['diantipp'] != I('diantipp') && ($xiaoqu['diantipp'] || I('diantipp'))) {
                                    $xiugai .= "电梯品牌：[".$xiaoqu['diantipp']."]=>[".I('diantipp')."]；";
                                }
                                if ($xiaoqu['diantixq'] != I('diantixq') && ($xiaoqu['diantixq'] || I('diantixq'))) {
                                    $xiugai .= "电梯详情：[".$xiaoqu['diantixq']."]=>[".I('diantixq')."]；";
                                }
                            }
                        }
                        if ($xiaoqu['youzheng'] != $youzheng && ($xiaoqu['youzheng'] || $youzheng)) {
                            $xiugai .= "邮政编码：[".$xiaoqu['youzheng']."]=>[".$youzheng."]；";
                        }
                        if ($xiaoqu['wuyefei'] != $wuyefei && ($xiaoqu['wuyefei'] || $wuyefei)) {
                            $xiugai .= "物业费：[".$xiaoqu['wuyefei']."元 / 平米 · 月]=>[".$wuyefei."元 / 平米 · 月]；";
                        }
                        if ($xiaoqu['wuyedh'] != $wuyedh && ($xiaoqu['wuyedh'] || $wuyedh)) {
                            $xiugai .= "物业电话：[".$xiaoqu['wuyedh']."]=>[".$wuyedh."]；";
                        }
                        if ($xiaoqu['wuyemc'] != I('wuyemc') && ($xiaoqu['wuyemc'] || I('wuyemc'))) {
                            $xiugai .= "物业公司：[".$xiaoqu['wuyemc']."]=>[".I('wuyemc')."]；";
                        }
                        if ($xiaoqu['wuyedz'] != I('wuyedz') && ($xiaoqu['wuyedz'] || I('wuyedz'))) {
                            $xiugai .= "物业地址：[".$xiaoqu['wuyedz']."]=>[".I('wuyedz')."]；";
                        }
                        if ($xiaoqu['jiedao'] != I('jiedao') && ($xiaoqu['jiedao'] || I('jiedao'))) {
                            $xiugai .= "街道：[".$xiaoqu['jiedao']."]=>[".I('jiedao')."]；";
                        }
                        if ($xiaoqu['xiaoqudz'] != I('xiaoqudz') && ($xiaoqu['xiaoqudz'] || I('xiaoqudz'))) {
                            $xiugai .= "楼盘地址：[".$xiaoqu['xiaoqudz']."]=>[".I('xiaoqudz')."]；";
                        }
                        if ($xiaoqu['jianjie'] != I('jianjie') && ($xiaoqu['jianjie'] || I('jianjie'))) {
                            $xiugai .= "楼盘简介：[".$xiaoqu['jianjie']."]=>[".I('jianjie')."]；";
                        }
                        if ($xiaoqu['beizhu'] != I('beizhu') && ($xiaoqu['beizhu'] || I('beizhu'))) {
                            $xiugai .= "楼盘备注：[".$xiaoqu['beizhu']."]=>[".I('beizhu')."]；";
                        }
                        break;
                }
                $isok = M('xiaoqu')->where(array('id'=>$id))->save($data);
                if ($isok === 1) {
                    data_rizhi(3,2,$id,$xiaoqu['bianhao'],$xiugai,U('ziyuan/xiaoqurr',array('id'=>$id)),"楼盘");
                    if ($xiaoqu['shtype'] == 2) {
                        M("xiaoqu")->where(array('id'=>$id))->setField('shtype',3);
                        $this->success('已更新，请等待审核！');
                    } else {
                        if ($lxbd != 1) {
                            M('zdxinxi')->where(array('xqid'=>$id))->setField('zdleixing',$lpleixing);
                            M('fjxinxi')->where(array('xqid'=>$id))->setField('fjleixing',$lpleixing);
                            M('fjhbxx')->where(array('xqid'=>$id))->setField('fjleixing',$lpleixing);
                        }
                        $this->success('更新成功');
                    }
                } elseif ($isok === 0) {
                    $this->error('数据无变动！');
                } else {
                    $this->error('更新失败！');
                }
            } else {
                switch ($bjlpxq) {
                    case '1':
                        $this->user=zym($xiaoqu['whrid'],5);
                        $this->gongqifs = get_peizhi('gongqifs',0,1);
                        $this->ceweizldw = get_peizhi('ceweizldw',0,1);
                        $this->gongdianlx = get_peizhi('gongdianlx',0,1);
                        $this->gongshuilx = get_peizhi('gongshuilx',0,1);
                        $this->ssxzq = M('xingzhengqu')->where(array('gongsiid'=>session('gongsiid')))->select();
                        $this->pianqu = M('pianqu')->where(array('gongsiid'=>session('gongsiid'),'ssxzq'=>$xiaoqu['ssxzq']))->select();
                        break;
                    case '2':
                        $this->lptype = get_peizhi('lptype',0,1);
                        $this->xmjibie = get_peizhi('xmjibie',0,1);
                        break;
                    case '3':
                        $this->ktlx = get_peizhi('ktlx',0,1);
                        $this->tongxun = get_peizhi('tongxun',0,1);
                        $this->lrpeitao = get_peizhi('lrpeitao',0,1);
                        $this->sqanquan = get_peizhi('sqanquan',0,1);
                        $tongxun1 = M('xiaoqu')->where(array('id'=>$id))->getField('tongxun');
                        $this->tongxun2 = explode(",", $tongxun1);
                        $lrpeitao1 = M('xiaoqu')->where(array('id'=>$id))->getField('lrpeitao');
                        $this->lrpeitao2 = explode(",", $lrpeitao1);
                        $sqanquan1 = M('xiaoqu')->where(array('id'=>$id))->getField('sqanquan');
                        $this->sqanquan2 = explode(",", $sqanquan1);
                        break;
                    case '4':
                        $this->waiqiang = get_peizhi('waiqiang',0,1);
                        break;
                    case '5':
                        $this->ssxuexiao = zym($xiaoqu['ssxuexiao'],4);
                        break;
                    case '6':
                        $this->jiegou = get_peizhi('jiegou',0,1);
                        $this->yongtu = get_peizhi('yongtu',0,1);
                        $this->chanquan = get_peizhi('chanquan',0,1);
                        $this->fwleixing = get_peizhi('fwleixing',0,1);
                        $jiegou1 = M('xiaoqu')->where(array('id'=>$id))->getField('jiegou');
                        $this->jiegou2 = explode(",", $jiegou1);
                        $yongtu1 = M('xiaoqu')->where(array('id'=>$id))->getField('yongtu');
                        $this->yongtu2 = explode(",", $yongtu1);
                        $chanquan1 = M('xiaoqu')->where(array('id'=>$id))->getField('chanquan');
                        $this->chanquan2 = explode(",", $chanquan1);
                        $fwleixing1 = M('xiaoqu')->where(array('id'=>$id))->getField('fwleixing');
                        $this->fwleixing2 = explode(",", $fwleixing1);
                        break;
                    case '7':
                        $this->wuyelx = get_peizhi('wuyelx',0,1);
                        $this->wuyezz = get_peizhi('wuyezz',0,1);
                        $this->dianshi = get_peizhi('dianshi',0,1);
                        $this->tongxun = get_peizhi('tongxun',0,1);
                        $this->gongqifs = get_peizhi('gongqifs',0,1);
                        $this->sqanquan = get_peizhi('sqanquan',0,1);
                        $this->cainuanfs = get_peizhi('cainuanfs',0,1);
                        $this->ceweizldw = get_peizhi('ceweizldw',0,1);
                        $this->gongdianlx = get_peizhi('gongdianlx',0,1);
                        $this->gongshuifs = get_peizhi('gongshuifs',0,1);
                        $this->gongshuilx = get_peizhi('gongshuilx',0,1);
                        $dianshi1 = M('xiaoqu')->where(array('id'=>$id))->getField('dianshi');
                        $this->dianshi2 = explode(",", $dianshi1);
                        $tongxun1 = M('xiaoqu')->where(array('id'=>$id))->getField('tongxun');
                        $this->tongxun2 = explode(",", $tongxun1);
                        $sqanquan1 = M('xiaoqu')->where(array('id'=>$id))->getField('sqanquan');
                        $this->sqanquan2 = explode(",", $sqanquan1);
                        $cainuanfs1 = M('xiaoqu')->where(array('id'=>$id))->getField('cainuanfs');
                        $this->cainuanfs2 = explode(",", $cainuanfs1);
                        $gongshuifs1 = M('xiaoqu')->where(array('id'=>$id))->getField('gongshuifs');
                        $this->gongshuifs2 = explode(",", $gongshuifs1);
                        break;
                    case '8':
                        $this->xmjibie = get_peizhi('xmjibie',0,1);
                        $this->kangzhen = get_peizhi('kangzhen',0,1);
                        $this->spjzleixing = get_peizhi('spjzleixing',0,1);
                        break;
                    case '9':
                        $this->wldibanlx = get_peizhi('wldibanlx',0,1);
                        $wldibanlx1 = M('xiaoqu')->where(array('id'=>$id))->getField('wldibanlx');
                        $this->wldibanlx2 = explode(",", $wldibanlx1);
                        break;
                    default:
                        $bjlpxq = 1;
                        $this->user = zym($xiaoqu['whrid'],5);
                        $this->gongqifs = get_peizhi('gongqifs',0,1);
                        $this->ceweizldw = get_peizhi('ceweizldw',0,1);
                        $this->gongdianlx = get_peizhi('gongdianlx',0,1);
                        $this->gongshuilx = get_peizhi('gongshuilx',0,1);
                        $this->ssxzq = M('xingzhengqu')->where(array('gongsiid'=>session('gongsiid')))->select();
                        $this->pianqu = M('pianqu')->where(array('gongsiid'=>session('gongsiid'),'ssxzq'=>$xiaoqu['ssxzq']))->select();
                        break;
                }
                $this->bjlpxq = $bjlpxq;
                $this->xiaoqu = $xiaoqu;
                $this->display();
            }
        }
        // 调整坐标
        public function tzdtzb(){
            $id=I('id');
            $xiaoqu = M('xiaoqu')->where(array('id'=>$id))->field('whrid,shtype,bianhao')->find();
            $is_rbac = _rbac_btn_show(180,0,$xiaoqu['whrid']);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if ($xiaoqu['shtype'] == 3) {
                $this->assign("error","楼盘待审核！");
                $this->display('ajax/error');
                die;
            }
            if (IS_POST) {
                $isok = M("xiaoqu")->where(array('id'=>$id))->setField('dituzb',I('dituzb'));
                if ($isok===1){
                    data_rizhi(3,2,$id,$xiaoqu['bianhao'],"调整楼盘坐标",U('ziyuan/xiaoqurr',array('id'=>$id)),"楼盘");
                    if ($xiaoqu['shtype'] == 2) {
                        M("xiaoqu")->where(array('id'=>$id))->setField('shtype',3);
                        $this->success('已更新，请等待审核！');
                    } else {
                        $this->success('更新成功');
                    }
                }elseif ($isok===0){
                    $this->error('数据无变动！');
                }else{
                    $this->error('更新失败！');
                }
            } else {
                $this->xiaoqu=M('xiaoqu')->where(array('id'=>$id))->find();
                $this->display();
            }
        }
        /**
        * webuploader 图片上传
        */
        function scxqtp() {
            $xqid=I('xqid');
            $xiaoqu = M('xiaoqu')->where(array('id'=>$xqid))->field('whrid,shtype')->find();
            $is_rbac = _rbac_btn_show(185,0,$xiaoqu['whrid']);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if ($xiaoqu['shtype'] == 2) {
                $this->assign("error","楼盘已驳回！");
                $this->display('ajax/error');
                die;
            }
            if ($xiaoqu['shtype'] == 3) {
                $this->assign("error","楼盘待审核！");
                $this->display('ajax/error');
                die;
            }
            if (IS_POST) {
                // 根据自己的业务调整上传路径、允许的格式、文件大小
                $path = "/Upload/".session('gongsiid')."/xiaoqu/".$xqid;
                ajax_upload_xq($path);
            } else {
                $this->display();
            }
        }
        /**
        * [xq_pic_setfengmian 异步楼盘图片为封面]
        * @return [json] [description]
        */
        public function xq_pic_setfengmian(){
            $id=I('xq_pic_id');
            //根据图片id查找楼盘图片的楼盘id号xqid
            $xqid = M('xqphoto')->where(array('id'=>$id))->getField('xqid');
            $xiaoqu = M('xiaoqu')->where(array('id'=>$xqid))->field('bianhao,shtype')->find();
            if ($xiaoqu['shtype'] == 2) {
                $this->error('楼盘已驳回！');
            }
            if ($xiaoqu['shtype'] == 3) {
                $this->error('楼盘待审核！');
                die;
            }
            $adduid=M('xqphoto')->where(array('id'=>$id))->getField('uid');
            $is_rbac = _rbac_btn_show(485,0,$adduid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            M('xqphoto')->where(array('xqid'=>$xqid,'fengmian'=>1))->setField(array('fengmian'=>0));
            $r = M('xqphoto')->where(array('id'=>$id))->setField(array('fengmian'=>1));
            if ($r) {
                data_rizhi(3,30,$xqid,$xiaoqu['bianhao'],"设置图片封面",U('ziyuan/xiaoqurr',array('id'=>$xqid)),"楼盘");
                $this->success('设置成功');
            }else{
                $this->error('设置失败');
            }
        }
        /**
        * [xq_pic_del 异步删除图片]
        * @return [json] [description]
        */
        public function xq_pic_del(){
            $id=I('xq_pic_id');
            //根据图片id查看当前是否还有当前楼盘的图片
            $xqid = M('xqphoto')->where(array('id'=>$id))->getField('xqid');
            $adduid=M('xqphoto')->where(array('id'=>$id))->getField('uid');
            $is_rbac = _rbac_btn_show(188,0,$adduid);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $piccount = M('xqphoto')->where(array('xqid'=>$xqid))->count();
            $dp=M('xqphoto');
            if($id){    //删除当前图片
                $plist = $dp->where(array('id'=>$id))->find();
                if ($plist){
                    unlink('./Upload/'.$plist['gongsiid'].'/xiaoqu/'.$plist['xqid'].'/'.$plist['image']);
                    unlink('./Upload/'.$plist['gongsiid'].'/xiaoqu/'.$plist['xqid'].'/t_'.$plist['image']);
                    $dp->where(array('id'=>$id))->delete();
                    $xqbh = M('xiaoqu')->where(array('id'=>$xqid))->getField('bianhao');
                    data_rizhi(3,13,$xqid,$xqbh,"删除图片",U('ziyuan/xiaoqurr',array('id'=>$xqid)),"楼盘");
                    $data=array('pics'=>$plist);
                    //删除最后一个楼盘图片后给xiaoqu表的tupian字段置 0
                    if ($piccount==1) {
                        M('xiaoqu')->where(array('id'=>$xqid))->setField('tupian',0);
                    }
                }else{
                    $data=array('pics'=>$plist);
                }
            }
            //返回值
            header("Content-type: application/json");
            exit(json_encode($data));
        }
        //批量删除楼盘图片
        public function xq_pic_dels(){
            $is_rbac = _rbac_node_show(486);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $ids=I('xq_pic_ids');
            foreach ($ids as $key => $value) {
                $adduid=M('xqphoto')->where(array('id'=>$value))->getField('uid');
                $is_rbac = _rbac_btn_show(486,0,$adduid);
                if (!$is_rbac) {
                    $this->error("您选择了权限范围之外的图片！");
                }
            }
            $xqid = M('xqphoto')->where(array('id'=>$ids[0]))->getField('xqid');
            if(is_array($ids)){
                $where = 'id in('.implode(',',$ids).')';//p($where);die;
                //获取当前图片的楼盘id
                $dp=M('xqphoto');
                foreach ($ids as $value) {//删除楼盘图片文件
                    $plist = $dp->where(array('id'=>$value))->find();
                    unlink('./Upload/'.$plist['gongsiid'].'/xiaoqu/'.$plist['xqid'].'/'.$plist['image']);
                    unlink('./Upload/'.$plist['gongsiid'].'/xiaoqu/'.$plist['xqid'].'/t_'.$plist['image']);
                }
                $dp->where($where)->delete();
                $xqbh = M('xiaoqu')->where(array('id'=>$xqid))->getField('bianhao');
                data_rizhi(3,13,$xqid,$xqbh,"删除了".count($ids)."张图片",U('ziyuan/xiaoqurr',array('id'=>$xqid)),"楼盘");
                //删除最后一个楼盘图片后给xiaoqu表的tupian字段置 0
                $nopic = M('xqphoto')->where(array('xqid'=>$xqid))->count();
                if ($nopic<=0) {
                    M('xiaoqu')->where(array('id'=>$xqid))->setField('tupian',0);
                }
                $this->success('删除成功');
            }else{
                $this->error('删除失败'); 
            }
        }
        //批量下载楼盘图片
        public function xq_pic_downloads(){
            $is_rbac = _rbac_node_show(487);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $ids=I('xq_pic_ids');
            foreach ($ids as $key => $value) {
                $adduid=M('xqphoto')->where(array('id'=>$value))->getField('uid');
                $is_rbac = _rbac_btn_show(487,0,$adduid);
                if (!$is_rbac) {
                    $this->error("您选择了权限范围之外的图片！");
                }
            }
            $where = 'id in('.implode(',',$ids).')';
            $dp=M('xqphoto');
            $plist = $dp->where($where)->field('id,gongsiid,xqid,image')->select();
            $zip = new \ZipArchive; 
            if ($plist) {
                //压缩文件名(临时文件)
                $filename = './Upload/'.$plist[0]['gongsiid'].'/xiaoqu/'.$plist[0]['xqid'].'/'.md5($plist[0]['xqid']).'.zip';
                $downname = I("server.HTTP_HOST").'/Upload/'.$plist[0]['gongsiid'].'/xiaoqu/'.$plist[0]['xqid'].'/'.md5($plist[0]['xqid']).'.zip';
                //p($downname);die;
            }
            //新建zip压缩包
            $zip->open($filename,\ZipArchive::OVERWRITE | \ZipArchive::CREATE);
            //把图片一张一张加进去压缩
            foreach ($plist as $value) {
                $zip->addFile('./Upload/'.$value['gongsiid'].'/xiaoqu/'.$value['xqid'].'/'.$value['image']);
                $zip->renameName('./Upload/'.$value['gongsiid'].'/xiaoqu/'.$value['xqid'].'/'.$value['image'],$value['image']);
            }
            //打包zip
            $zip->close();
            $xqid = M('xqphoto')->where(array('id'=>$ids[0]))->getField('xqid');
            $xqbh = M('xiaoqu')->where(array('id'=>$xqid))->getField('bianhao');
            data_rizhi(3,20,$xqid,$xqbh,"下载了".count($ids)."张图片",U('ziyuan/xiaoqurr',array('id'=>$xqid)),"楼盘");
            //可以直接重定向下载
            //header('Location:'.$downname);
            $this->success($downname);
        }
        //设置图片类型
        public function settupianleixing(){
            $is_rbac = _rbac_node_show(488);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $ids=explode(",",I('xq_pic_ids'));
                foreach ($ids as $key => $value) {
                    $adduid=M('xqphoto')->where(array('id'=>$value))->getField('uid');
                    $is_rbac = _rbac_btn_show(488,0,$adduid);
                    if (!$is_rbac) {
                        $this->error("您选择了权限范围之外的图片！");
                    }
                }
                $ids1=I('xq_pic_ids');
                $tpleixing = I('tpleixing');
                if ($tpleixing=="") {
                    $this->error("请选择图片类型");
                }
                $where = 'id in('.$ids1.')';
                $dp=M('xqphoto');
                $plist = $dp->where($where)->setField(array('leixing' => $tpleixing ));
                if ($plist) {
                    $xqid = M('xqphoto')->where(array('id'=>$ids[0]))->getField('xqid');
                    $xqbh=M('xiaoqu')->where(array('id'=>$xqid))->getField('bianhao');
                    $xiugai = "设置".count($ids)."张楼盘图片的类型为".get_peizhi('xqtplx',$tpleixing,3);
                    data_rizhi(3,25,$xqid,$xqbh,$xiugai,U('ziyuan/xiaoqurr',array('id'=>$xqid)),"楼盘");
                    $this->success("设置成功");
                }else{
                    $this->error("设置失败");
                }
            } else {
                $this->tpleixing = get_peizhi('xqtplx',0,1);
                $this->display();// 输出模板
            }
        }
        //行政区、商圈、楼盘信息转移
        public function xxzhuanyi(){
            $xzqid=I('xzqid');
            $pqid=I('pqid');
            $xqid=I('xqid');
            if ($xzqid) {
                $whrid=M('xingzhengqu')->where(array('id'=>$xzqid))->getField('whrid');
            } elseif ($pqid) {
                $whrid=M('pianqu')->where(array('id'=>$pqid))->getField('whrid');
            } elseif ($xqid) {
                $whrid=M('xiaoqu')->where(array('id'=>$xqid))->getField('whrid');
            }
            $is_rbac = _rbac_btn_show(533,0,$whrid);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if ($xzqid) {
                $pqshu = M('pianqu')->where(array('ssxzq'=>$xzqid))->count();
                $xqshu = M('xiaoqu')->where(array('ssxzq'=>$xzqid))->count();
                $xfshu = M('ysfangyuan')->where(array('quyu'=>$xzqid))->count();
                $zzshu = M('fangyuan')->where(array('xingzhengqu'=>$xzqid))->count();
                $spshu = M('fyshangpu')->where(array('xingzhengqu'=>$xzqid))->count();
                $xzlshu = M('fyxiezilou')->where(array('xingzhengqu'=>$xzqid))->count();
            } elseif ($pqid) {
                $xqshu = M('xiaoqu')->where(array('sspianqu'=>$pqid))->count();
                $zzshu = M('fangyuan')->where(array('pianqu'=>$pqid))->count();
                $spshu = M('fyshangpu')->where(array('pianqu'=>$pqid))->count();
                $xzlshu = M('fyxiezilou')->where(array('pianqu'=>$pqid))->count();
            } elseif ($xqid) {
                $zdshu = M('zdxinxi')->where(array('xqid'=>$xqid))->count();
                $zzshu = M('fangyuan')->where(array('xiaoqu'=>$xqid))->count();
                $spshu = M('fyshangpu')->where(array('xiaoqu'=>$xqid))->count();
                $xzlshu = M('fyxiezilou')->where(array('xiaoqu'=>$xqid))->count();
            }
            if (IS_POST) {
                $xxzqid = I('xxzqid');
                $xpqid = I('xpqid');
                $xxqid = I('xxqid');
                if ($xxzqid && $xzqid) {
                    if($xxzqid == $xzqid){
                        $this->error("不能转移给自己！");
                    }
                    if(($pqshu == 0) && ($xqshu == 0) && ($xfshu == 0) && ($zzshu == 0) && ($spshu == 0) && ($xzlshu == 0)){
                        $this->error("行政区下无数据！");
                    }
                    M('pianqu')->where(array('ssxzq'=>$xzqid))->setField('ssxzq',$xxzqid);
                    M('xiaoqu')->where(array('ssxzq'=>$xzqid))->setField('ssxzq',$xxzqid);
                    M('ysfangyuan')->where(array('quyu'=>$xzqid))->setField('quyu',$xxzqid);
                    M('fangyuan')->where(array('xingzhengqu'=>$xzqid))->setField('xingzhengqu',$xxzqid);
                    M('fyshangpu')->where(array('xingzhengqu'=>$xzqid))->setField('xingzhengqu',$xxzqid);
                    M('fyxiezilou')->where(array('xingzhengqu'=>$xzqid))->setField('xingzhengqu',$xxzqid);
                    $xiugai = "将".zym($xzqid,1)."下的";
                    if ($pqshu > 0) {
                        $xiugai .= $pqshu."个商圈、";
                    }
                    if ($xqshu > 0) {
                        $xiugai .= $xqshu."个楼盘、";
                    }
                    if ($xzlshu > 0) {
                        $xiugai .= $xzlshu."个写字楼、";
                    }
                    if ($spshu > 0) {
                        $xiugai .= $spshu."个商铺、";
                    }
                    if ($zzshu > 0) {
                        $xiugai .= $zzshu."个住宅、";
                    }
                    if ($xfshu > 0) {
                        $xiugai .= $xfshu."个新楼盘";
                    }
                    $xiugai .= "转移给".zym($xxzqid,1);
                    data_rizhi(3,23,$xzqid,"",$xiugai,"","行政区");
                } elseif ($xpqid && $pqid) {
                    if($xpqid == $pqid){
                        $this->error("不能转移给自己！");
                    }
                    if(($xqshu == 0) && ($zzshu == 0) && ($spshu == 0) && ($xzlshu == 0)){
                        $this->error("商圈下无数据！");
                    }
                    $zyqxzq=M('pianqu')->where(array('id'=>$pqid))->getField('ssxzq');
                    $zyhxzq=M('pianqu')->where(array('id'=>$xpqid))->getField('ssxzq');
                    if($zyqxzq != $zyhxzq){
                        $this->error("只能转移给".zym($zyqxzq,1)."下的商圈！");
                    }
                    M('xiaoqu')->where(array('sspianqu'=>$pqid))->setField('sspianqu',$xpqid);
                    M('fangyuan')->where(array('pianqu'=>$pqid))->setField('pianqu',$xpqid);
                    M('fyshangpu')->where(array('pianqu'=>$pqid))->setField('pianqu',$xpqid);
                    M('fyxiezilou')->where(array('pianqu'=>$pqid))->setField('pianqu',$xpqid);
                    $xiugai = "将".zym($pqid,2)."下的";
                    if ($xqshu > 0) {
                        $xiugai .= $xqshu."个楼盘、";
                    }
                    if ($xzlshu > 0) {
                        $xiugai .= $xzlshu."个写字楼、";
                    }
                    if ($spshu > 0) {
                        $xiugai .= $spshu."个商铺、";
                    }
                    if ($zzshu > 0) {
                        $xiugai .= $zzshu."个住宅";
                    }
                    $xiugai .= "转移给".zym($xpqid,2);
                    data_rizhi(3,23,$pqid,"",$xiugai,"","商圈");
                } elseif ($xxqid && $xqid) {
                    if($xxqid == $xqid){
                        $this->error("不能转移给自己！");
                    }
                    if(($zdshu == 0) && ($zzshu == 0) && ($spshu == 0) && ($xzlshu == 0)){
                        $this->error("楼盘下无数据！");
                    }
                    $zyqpq=M('xiaoqu')->where(array('id'=>$xqid))->getField('sspianqu');
                    $zyhpq=M('xiaoqu')->where(array('id'=>$xxqid))->getField('sspianqu');
                    if($zyqpq != $zyhpq){
                        $this->error("只能转移给".zym($pqid,2)."下的楼盘！");
                    }
                    M('zdxinxi')->where(array('xqid'=>$xqid))->setField('xqid',$xxqid);
                    M('dyxinxi')->where(array('xqid'=>$xqid))->setField('xqid',$xxqid);
                    M('lcxinxi')->where(array('xqid'=>$xqid))->setField('xqid',$xxqid);
                    M('fjxinxi')->where(array('xqid'=>$xqid))->setField('xqid',$xxqid);
                    M('fjphoto')->where(array('xqid'=>$xqid))->setField('xqid',$xxqid);
                    M('fjgenjin')->where(array('xqid'=>$xqid))->setField('xqid',$xxqid);
                    M('fjtixing')->where(array('xqid'=>$xqid))->setField('xqid',$xxqid);
                    M('fangyuan')->where(array('xiaoqu'=>$xqid))->setField('xiaoqu',$xxqid);
                    M('fyshangpu')->where(array('xiaoqu'=>$xqid))->setField('xiaoqu',$xxqid);
                    M('fyxiezilou')->where(array('xiaoqu'=>$xqid))->setField('xiaoqu',$xxqid);
                    $xiugai = "将".zym($xqid,3)."下的";
                    if ($zdshu > 0) {
                        $xiugai .= $zdshu."个座栋、";
                    }
                    if ($xzlshu > 0) {
                        $xiugai .= $xzlshu."个写字楼、";
                    }
                    if ($spshu > 0) {
                        $xiugai .= $spshu."个商铺、";
                    }
                    if ($zzshu > 0) {
                        $xiugai .= $zzshu."个住宅";
                    }
                    $xiugai .= "转移给".zym($xxqid,3);
                    data_rizhi(3,23,$xqid,"",$xiugai,U('ziyuan/xiaoqurr',array('id'=>$xqid)),"楼盘");
                }
                $this->success('转移成功');
            }else{
                if ($xzqid) {
                    $this->pqshu=$pqshu;
                    $this->xqshu=$xqshu;
                    $this->xfshu=$xfshu;
                    $this->zzshu=$zzshu;
                    $this->spshu=$spshu;
                    $this->xzlshu=$xzlshu;
                    $this->xingzhengqu=M('xingzhengqu')->where(array('gongsiid'=>session('gongsiid'),'id'=>array('neq',$xzqid)))->order('shijian asc')->select();
                } elseif ($pqid) {
                    $this->xqshu=$xqshu;
                    $this->zzshu=$zzshu;
                    $this->spshu=$spshu;
                    $this->xzlshu=$xzlshu;
                    $ssxzq=M('pianqu')->where(array('id'=>$pqid))->getField('ssxzq');
                    $this->pianqu=M('pianqu')->where(array('gongsiid'=>session('gongsiid'),'ssxzq'=>$ssxzq,'id'=>array('neq',$pqid)))->order('ssxzq asc')->select();
                } elseif ($xqid) {
                    $this->zdshu=$zdshu;
                    $this->zzshu=$zzshu;
                    $this->spshu=$spshu;
                    $this->xzlshu=$xzlshu;
                    $sspianqu=M('xiaoqu')->where(array('id'=>$xqid))->getField('sspianqu');
                    $this->xiaoqu=M('xiaoqu')->where(array('gongsiid'=>session('gongsiid'),'sspianqu'=>$sspianqu,'id'=>array('neq',$xqid)))->order('ssxzq asc,sspianqu')->select();
                }
                $this->display();
            }
        }
        //楼盘视频
        public function shipin(){
            $id=I('id');
            $xiaoqu = M('xiaoqu')->where(array('id'=>$id))->field('whrid,shtype,bianhao')->find();
            $is_rbac = _rbac_btn_show(534,0,$xiaoqu['whrid']);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if ($xiaoqu['shtype'] == 2) {
                $this->assign("error","楼盘已驳回！");
                $this->display('ajax/error');
                die;
            }
            if ($xiaoqu['shtype'] == 3) {
                $this->assign("error","楼盘待审核！");
                $this->display('ajax/error');
                die;
            }
            if (IS_POST) {
                if (preg_match_all('/src=&quot;(.*?)&quot;/', I('shipin_url'), $matches)) {
                    $s1 = $matches[1][0];
                    $shipin_url='<iframe src="'.$s1.'" frameborder="0" allowfullscreen="true" width="100%" height="100%"></iframe>';
                }elseif (preg_match_all('/src=\'(.*?)\'/', I('shipin_url'), $matches)) {
                    $s1 = $matches[1][0];
                    $shipin_url='<iframe src="'.$s1.'" frameborder="0" allowfullscreen="true" width="100%" height="100%"></iframe>';
                }else{
                    $this->error('视频地址格式不正确!');
                }
                $isok=M('xiaoqu')->where(array('id'=>$id))->setField('shipin_url',$shipin_url);
                if ($isok===1){
                    data_rizhi(3,31,$id,$xiaoqu['bianhao'],"设置楼盘视频",U('ziyuan/xiaoqurr',array('id'=>$id)),"楼盘");
                    $this->success('更新成功！');
                }elseif ($isok===0){
                    $this->error('数据无变动！');
                }else{
                    $this->error('更新失败！');
                }
            }else{
                $this->shipin_url=M('xiaoqu')->where(array('id'=>$id))->getField('shipin_url');
                $this->display();
            }
        }
        //地铁站
        public function ditie(){
            $is_rbac = _rbac_node_show(946);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            $result=M('ditie')->where(array('gongsiid'=>session('gongsiid')))->order(array("sort" => "ASC"))->select();
            $tree = new \Org\Util\Tree();
            $tree->icon = array('&nbsp;&nbsp;&nbsp;│ ', '&nbsp;&nbsp;&nbsp;├─ ', '&nbsp;&nbsp;&nbsp;└─ ');
            $tree->nbsp = '&nbsp;&nbsp;&nbsp;';
            $newmenus=array();
            foreach ($result as $m){
                $newmenus[$m['id']]=$m;
            }
            foreach ($result as $n=> $r) {
                $result[$n]['dtlb'] = $r['pid'] ? "站点" : "线路";
                $result[$n]['tjr'] = zym($r['adduid'],5);
                $result[$n]['tjsj'] = date('Y-m-d',$r['addtime']);
                $result[$n]['parentid'] = $r['pid'];
                $result[$n]['str_manage'] = "";
                if (_rbac_node_show(947) && $r['pid'] == 0) {
                    $result[$n]['str_manage'] .= '<a href="javascript:;" class="layui-btn layui-btn-normal layui-btn-mini" onclick="layer_show(\'添加站点\',\''.U('addditie',array('pid'=>$r['id'])).'\',\'480\',\'480\')" style="text-decoration:none"><i class="Hui-iconfont">&#xe604;</i> 添加</a>';
                }
                if (_rbac_node_show(948)) {
                    $result[$n]['str_manage'] .= '<a href="javascript:;" class="layui-btn layui-btn-warm layui-btn-mini" onclick="layer_show(\'更新部门\',\''.U('editditie',array('id'=>$r['id'])).'\',\'480\',\'480\')" style="text-decoration:none;margin-left: 5px;"><i class="Hui-iconfont">&#xe6df;</i> 编辑</a>';
                }
                if (_rbac_node_show(949)) {
                    $result[$n]['str_manage'] .= '<a href="javascript:;" class="layui-btn layui-btn-warm layui-btn-mini" onclick="admin_ditie_del(this,\''.$r['id'].'\')" style="text-decoration:none;background: red;margin-left: 5px;"><i class="Hui-iconfont">&#xe6df;</i> 删除</a>';
                }
            }
            $tree->init($result);
            $str = "<tr id='node-\$id' \$parentid_node style='\$style'>
                <td style='padding-left:20px;'>\$id</td>
                <td>\$dtlb</td>
                <td>\$spacer\$dtming</td>
                <td>\$tjr</td>
                <td>\$tjsj</td>
                <td>\$str_manage</td>
            </tr>";
            $categorys = $tree->get_tree(0, $str);
            $this->assign("categorys", $categorys);
            $this->display();
        }
        //添加地铁站
        public function addditie(){
            $is_rbac = _rbac_node_show(947);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $data['pid']=I('pid');
                $pid = M('ditie')->where(array('id'=>$data['pid']))->getField('pid');
                if ($pid != 0) {
                    $this->error('线路异常！');
                }
                $data['dtming']=I('dtming');
                $data['sort']=I('sort');
                $data['addtime']=time();
                $data['adduid']=session('uid');
                $data['gongsiid']=session('gongsiid');
                $isok=M('ditie')->add($data);
                if($isok){
                    data_rizhi(3,1,$isok,"","添加地铁站","","地铁站");
                    $this->success('添加成功');
                }else{
                    $this->error('添加失败');
                }
            } else {
                $this->pid=I('pid');
                $this->ditie=M('ditie')->where(array('pid'=>0))->select();
                $this->display();
            }
        }
        //更新地铁站
        public function editditie(){
            $is_rbac = _rbac_node_show(948);
            if (!$is_rbac) {
                $this->redirect('Index/error');
            }
            if (IS_POST) {
                $id=I('id');
                $data['pid']=I('pid');
                $pid = M('ditie')->where(array('id'=>$data['pid']))->getField('pid');
                if ($pid != 0) {
                    $this->error('线路异常！');
                }
                $data['dtming']=I('dtming');
                $data['sort']=I('sort');
                $xiugai = "";
                $ditie=M('ditie')->where(array('id'=>$id))->find();
                if ($ditie['pid'] != I('pid') && ($ditie['pid'] || I('pid'))) {
                    $xiugai .= "父级线路：[".ditiezhan($ditie['pid'],0)."]=>[".ditiezhan(I('pid'),0)."]；";
                }
                if ($ditie['dtming'] != I('dtming') && ($ditie['dtming'] || I('dtming'))) {
                    $xiugai .= "名称：[".$ditie['dtming']."]=>[".I('dtming')."]；";
                }
                if ($ditie['sort'] != I('sort') && ($ditie['sort'] || I('sort'))) {
                    $xiugai .= "排序：[".$ditie['sort']."]=>[".I('sort')."]；";
                }
                $isok=M('ditie')->where(array('id'=>$id,'gongsiid'=>session('gongsiid')))->save($data);
                if ($isok) {
                    data_rizhi(3,2,$id,"",$xiugai,"","地铁站");
                    $this->success('修改成功'); 
                }else{
                    $this->error('修改失败');
                }
            } else {
                $id=I('id');
                $this->dtz=M('ditie')->where(array('id'=>$id))->find();
                $this->ditie=M('ditie')->where(array('pid'=>0))->select();
                $this->display();
            }
        }
        //删除地铁站
        public function delditie(){
            $is_rbac = _rbac_node_show(949);
            if (!$is_rbac) {
                $this->error('异常错误！');
            }
            $id=I('id');
            $pid = M('ditie')->where(array('id'=>$id))->getField('pid');
            $isok=M('ditie')->where(array('id'=>$id))->delete();
            if ($isok) {
                if ($pid == 0) {
                    M('ditie')->where(array('pid'=>$id))->delete();
                }
                data_rizhi(3,8,$id,"","删除地铁站","","地铁站");
                $this->success('删除成功'); 
            }else{
                $this->error('删除失败');
            }
        }
        //意向日志
        public function rizhi(){
            if (I('is_ajax')) {
                /*权限控制开始*/
                $condition = "e.gongsiid=".session('gongsiid');
                $x = _rbac_lists_where(1046,0);
                if ($x && $x != "all" && $x != "me") {
                    $condition .= " and e.bumen in ({$x})";
                } elseif ($x == "me") {
                    $condition .= " and e.id=".session('uid');
                } elseif ($x == false) {
                    $condition .= " and e.id=0";
                }
                /*权限控制结束*/
                $sousuo = I('sousuo');
                $condition .= " and a.zy_type = 3";
                $shijian = I('shijian');
                if ($shijian) {
                    $time_s = explode(' - ',$shijian);
                    $time_s1 = strtotime($time_s[0]);
                    $time_s2 = strtotime($time_s[1])+86400;
                    $condition .= " and a.addtime>=".$time_s1." and a.addtime<".$time_s2;
                }
                if ($sousuo) {
                    $condition .= " and (a.zy_bianhao like '%$sousuo%' or e.pinyinjs like '%$sousuo%' or e.ygmingcheng like '%$sousuo%' or a.zy_remark like '%$sousuo%')";
                }
                $field = I('field'); //排序字段名
                $order = I('order'); //排序方式
                $limit = I('limit',30,'int'); //每页条数
                $limit = $limit > 150 ? 150 : $limit;
                if ($field && $order) {
                    $rzpx = "order by a.".$field." ".$order;
                } else {
                    $rzpx = "order by a.addtime desc";
                }
                $Model = new \Think\Model();
                $count = $Model->query("select count(*) from __RIZHI__ a join __YONGHU__ e on a.uid=e.id where {$condition}");
                $Page = new \Think\Page($count['0']['count(*)'],$limit);
                $list = "select a.*,e.ygmingcheng,e.bumen from __RIZHI__ a join __YONGHU__ e on a.uid=e.id where {$condition} ".$rzpx." limit ".$Page->firstRow.','.$Page->listRows;
                $data = $Model->query($list);
                foreach ($data as $key => $value) {
                    if ($value['zy_url']) {
                        $whrid = M('xiaoqu')->where(array('id'=>$value['zy_id']))->getField('whrid');
                        $data[$key]['lpxqqx'] = _rbac_btn_show(175,0,$whrid) == true ? '1' : '0';
                    }
                    $data[$key]['zy_bianhao'] = $value['zy_bianhao'] ? $value['zy_bianhao'] : '——';
                    switch ($value['cz_type']) {
                        case '1':
                            $data[$key]['cz_type'] = "新增";
                            break;
                        case '2':
                            $data[$key]['cz_type'] = "基础修改";
                            break;
                        case '5':
                            $data[$key]['cz_type'] = "写跟进";
                            break;
                        case '8':
                            $data[$key]['cz_type'] = "删除";
                            break;
                        case '9':
                            $data[$key]['cz_type'] = "变更成交人";
                            break;
                        case '16':
                            $data[$key]['cz_type'] = "写提醒";
                            break;
                        case '18':
                            $data[$key]['cz_type'] = "审核";
                            break;
                        case '19':
                            $data[$key]['cz_type'] = "佣金分配";
                            break;
                        case '22':
                            $data[$key]['cz_type'] = "收取定金";
                            break;
                        case '24':
                            $data[$key]['cz_type'] = "变更状态";
                            break;
                        case '26':
                            $data[$key]['cz_type'] = "转为合同";
                            break;
                        default:
                            $data[$key]['cz_type'] = "——";
                            break;
                    }
                    $data[$key]['bumen'] = zym($value['bumen'],6);
                    $data[$key]['addtime'] = date('Y-m-d H:i:s',$value['addtime']);
                }
                $return_data = array(
                    'code'=>0,
                    'count'=>$count['0']['count(*)'],
                    'data'=>$data
                );
                $this->ajaxReturn($return_data);
            } else {
                $this->display();// 输出模板
            }
        }
    }