javascript - 百度地图 ajax获取数据

WBOY
Lepaskan: 2016-06-06 20:35:37
asal
1047 orang telah melayarinya

出问题的网站链接

使用的是thinkphp的框架,自从改了URL重写之后点击地图上的房子的链接就出错了。我找来找去也没有发现生成链接的代码在哪里。希望对这块比较熟的大神可以帮我找一下错误出在哪里,谢谢!
Controller/AjaxController.class.php:

<code><?php namespace Home\Controller;
use Think\Controller;
use Think\Image;
class AjaxController extends HomeController {
    public function extlist($tid)
    {
        $e=M("extinfo");
        $extlist=$e->where(" exttypeid=$tid")->select();
        $this->assign('extlist',$extlist);
        $this->display('house/ajax/extlist');
    }
    public function getHouseList($h_tp='',$totalPrice='',$h_rn='',$h_o='',$h_fy='',$h_fs='',$h_l='',$h_a='',$key='')
    {
            $condition['house_map_position']=array('neq','');
        if(!empty($h_tp)){
                switch($h_tp)
                {
                    case 1:
                        $condition['house_price']=array('lt',20);
                        break;  
                    case 2:
                        $condition['house_price']=array(array('egt',20),array('lt',30), 'and') ;
                        break;  
                    case 3:
                        $condition['house_price']=array(array('egt',30),array('lt',50), 'and') ;
                        break;  
                    case 4:
                        $condition['house_price']=array(array('egt',50),array('lt',100), 'and') ;
                        break;  
                    case 5:
                        $condition['house_price']=array(array('egt',100),array('lt',300), 'and') ;
                        break;  
                    case 6:
                        $condition['house_price']=array(array('egt',300),array('lt',500), 'and') ;
                        break;  
                    case 7:
                        $condition['house_price']=array(array('egt',500),array('elt',1000), 'and') ;
                        break;  
                    case 8:
                        $condition['house_price']=array('gt',1000);
                        break;  
                }
            }

        if(!empty($totalPrice)){
                $arrprice=explode(",",$totalPrice);
                if(count($arrprice)==2){
                        if(is_numeric($arrprice[0])&&is_numeric($arrprice[1])){
                                $condition['house_price']=array(array('egt',$arrprice[0]),array('elt',$arrprice[1]), 'and') ;
                            }
                    }
            }
        if(!empty($h_rn)){
                switch($h_rn)
                {
                    case 1:
                        $condition['house_model']=array('like','%1室%');
                        break;  
                    case 2:
                        $condition['house_model']=array('like','%2室%');
                        break;  
                    case 3:
                        $condition['house_model']=array('like','%3室%');
                        break;  
                    case 4:
                        $condition['house_model']=array('like','%4室%');
                        break;  
                    case 5:
                        $condition['house_model']=array('like','%5室%');
                        break;  
                }
            }
        if(!empty($h_o)){
                switch($h_o){
                        case 1:
                            $condition['house_direction']=array('like','%朝东%');
                            break;
                        case 2:
                            $condition['house_direction']=array('like','%朝南%');
                            break;
                        case 3:
                            $condition['house_direction']=array('like','%朝西%');
                            break;
                        case 4:
                            $condition['house_direction']=array('like','%朝北%');
                            break;
                        case 4:
                            $condition['house_direction']=array('like','%南北%');
                            break;
                    }
            }
        if(!empty($h_fy)){
                switch($h_fy){
                        case 1:
                            $condition['house_age']=array('lt',5);
                            break;
                        case 2:
                            $condition['house_age']=array('lt',10);
                            break;
                        case 3:
                            $condition['house_age']=array(array('egt',10),array('elt',20), 'and') ;
                            break;
                        case 4:
                            $condition['house_age']=array('gt',20) ;
                            break;
                    }
            }
        if(!empty($h_fs)){
                switch($h_fs)
                {
                        case 1:
                            $condition['house_floor'] = array(array('egt',1),array('elt',5));
                            break;
                        case 2:
                            $condition['house_floor'] = array(array('egt',6),array('elt',12));
                            break;
                        case 3:
                            $condition['house_floor'] = array(array('egt',13));
                            break;
                        case 4:
                            $condition['house_floor'] = array(array('elt',0));
                            break;
                        default:

                            break;
                }   
            }
        if(!empty($h_l)){
                switch($h_l)
                {
                  case 1:
                      $condition['house_keyword'] = array('like',"%新上%");
                      break;
                  case 2:
                      $condition['house_keyword'] = array('like',"%急售%");
                      break;
                  case 3:
                      $condition['house_keyword'] = array('like',"%学区%");
                      break;
                  case 4:
                      $condition['house_keyword'] = array('like',"%独家%");
                      break;
                  case 5:
                      $condition['house_keyword'] = array('like',"%降价%");
                      break;
                  case 6:
                      $condition['house_keyword'] = array('like',"%满五年%");
                      break;
                  case 7:
                      $condition['house_keyword'] = array('like',"%唯一住房%");
                      break;
                  case 8:
                      $condition['house_keyword'] = array('like',"%随时可看%");
                      break;
                  case 9:
                      $condition['house_keyword'] = array('like',"%高性价比%");
                      break;
                }
            }
        if(!empty($h_a)){
                switch($h_a)
                {
                    case 1:
                        $condition['house_area']=array('lt',50);
                        break;
                    case 2:
                        $condition['house_area']=array(array('gt',50),array('lt',70));
                        break;
                    case 3:
                        $condition['house_area']=array(array('gt',70),array('lt',90));
                        break;
                    case 4:
                        $condition['house_area']=array(array('gt',90),array('lt',110));
                        break;
                    case 5:
                        $condition['house_area']=array(array('gt',110),array('lt',130));
                        break;
                    case 6:
                        $condition['house_area']=array(array('gt',130),array('lt',150));
                        break;
                    case 7:
                        $condition['house_area']=array(array('gt',150),array('lt',200));
                        break;
                    case 8:
                        $condition['house_area']=array('gt',200);
                        break;
                    default:
                        $condition['house_area']=array('gt',0);
                        break;
                }
            }
        if(!empty($key)){
                $conkey['house_title']=array('like','%'.$key.'%');
                $conkey['house_model']=array('like','%'.$key.'%');
                $conkey['house_direction']=array('like','%'.$key.'%');
                $conkey['house_keyword']=array('like','%'.$key.'%');
                $conkey['village_title']=array('like','%'.$key.'%');
                $conkey['village_dizhi']=array('like','%'.$key.'%');
                $conkey['_logic'] = 'or';
                $condition['_complex'] = $conkey;
            }
            //print_r($condition);
        $house=M("HouseView",null);
        $data = $house->where($condition)->field('id,house_id,house_title,house_price,house_map_position,house_direction')->select();
        $arrdata['total']=count($data);
        if(!empty($key)){
                $arrdata['iskey']='yes';
            }else{
                $arrdata['iskey']='no';
                }
        $arrdata['result']=$data;
        $this->ajaxReturn($arrdata,'JSON');
    }
    public function getHousePicture($houseid){
            $house=M("house_pictures");
            $data=$house->where(" houseid=$houseid")->order('id desc')->limit(1)->select();
            $this->ajaxReturn($data,'JSON');
        }
    public function getText($key){
            print_r($key);
            $this->ajaxReturn($key);
        }
}
?>
</code>
Salin selepas log masuk
Salin selepas log masuk

Controller/DituController.class.php

<code><?php namespace Home\Controller;
use Think\Controller;
class DituController extends HomeController {
    public function Index()
    {

        $id=$_GET['ditu'];      
        $this->display();
    }



    public function wangzhandutu()
    {


        $wenfen=M("wenfen");
        $wenfen1 =$wenfen->where("1=1")->select();
        $this->assign('wenda',$wenfen1);

        $regions=M("regions");
        $regions1 =$regions->where("region_level=6")->select();
        $this->assign('mendianc',$regions1);

        $jinrong_news_class=M("jinrong_news_class");
        $jinrong_news_classa =$jinrong_news_class->where("1=1")->select();
        $this->assign('jinrong',$jinrong_news_classa);

        $information_fl=M("information_fl");
        $information_fla =$information_fl->where("1=1")->select();
        $this->assign('zixunc',$information_fla);

        $regions2 =$regions->where("region_level=3")->select();
        $this->assign('quyu',$regions2);

        $remen=M("remen");
        $remena =$remen->where("rg=1")->select();
        $this->assign('remen',$remena);






        $this->display();
    }


}
?>
</code>
Salin selepas log masuk
Salin selepas log masuk

View/ditu/ditu_header.html

<code>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>[title]</title>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Css/css/Public.css">
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Css/css/ditu.css">
<script type="text/javascript" src="__PUBLIC__/js/xqxc1.js"></script> 
<script type="text/javascript" src="__PUBLIC__/js/xqxc2.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/gundong.js"></script>   



function secBoard(elementID,listName,n) {
 var elem = document.getElementById(elementID);
 var elemlist = elem.getElementsByTagName("li");
 for (var i=0; i<elemlist.length i elemlist var m="i+1;" document.getelementbyid>


<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?78017cacc0a925d339c240ab6b7dcfc6";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>




<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?0cd7b0a8e086bea285f3735c29a0d564";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>








<div id="box"></div>


<!--header-->
<link href="/lian.ico" rel="Shortcut Icon">


<div class="nav_bg">
<div class="public total">
<ul id="menu">
<li><a href="%7B:U('Home/Index/index')%7D">首页</a></li>
<li><a href="%7B:U('Home/Finance/index')%7D" class="">金融</a></li>
<li><a href="%7B:U('Home/house/index')%7D">二手房<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/housezu/index')%7D">租房<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/Village/index')%7D">小区<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/broker/index')%7D">经纪人<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/store/index')%7D">门店<i class="Navico"></i></a></li>

<li class="curr"><a href="%7B:U('Home/ditu/index')%7D">地图<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/estimate/index')%7D">评估<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/wenda/index')%7D">问答<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/information/index')%7D">资讯<i class="Navico"></i></a></li>

</ul>
<if condition="$_SESSION['user_id'] eq ''"> 
<ol>
<a href="%7B:U('home/login/login')%7D"><i class="Navico loIco"></i>登录</a>
<a href="%7B:U('home/login/register')%7D"><i class="Navico regIco"></i>注册</a>

</ol>
<else></else>
<ol>
<style>
.yingcang{ display:none;}
.xianshi{ display:block;}
.tcdyysb{ background:#0c53cf; width:87px; overflow:hidden;}
.tcdyysb p{ display:block;}
.tcdyysb p a { font-size:13px; color:#FFF; display:block; clear:both; width:87px; padding:0; margin:0; text-align:center; line-height:30px;}
.tcdyysb p a:hover{ background:#003591;}
</style>
<a href="%7B:U('home/geren/index')%7D" onmouseover="Showss();" onmouseout="Hiddenss();">{$_SESSION['user_name']} </a><i class="Navico"></i><a href="%7B:U('home/Logout/index')%7D">退出</a> 
<div id="yonghu" style="   position:fixed; z-index:999;  " class=" yingcang tcdyysb " onmouseover="Showss();" onmouseout="Hiddenss();">
<p><a href="%7B:U('Home/geren/index')%7D" target="_blank">中心首页</a></p>
<p><a href="%7B:U('Home/geren/kfjl')%7D" target="_blank">看房记录</a></p>
<p><a href="%7B:U('Home/geren/gzh')%7D" target="_blank">关注房源</a></p>
<p><a href="%7B:U('Home/geren/jjr')%7D" target="_blank">我的经纪人</a></p>
<p><a href="%7B:U('Home/geren/wdtw')%7D" target="_blank">我的提问</a></p>
<p><a href="%7B:U('Home/geren/tuijian')%7D" target="_blank">浏览房源</a></p>
<p><a href="%7B:U('Home/geren/xinxi')%7D" target="_blank">会员提醒</a></p>
<p><a href="%7B:U('Home/geren/gexing')%7D" target="_blank">个性定制</a></p>
<p><a href="%7B:U('Home/geren/chaxun')%7D" target="_blank">贷款查询</a></p>
</div>



<script type="text/javascript">
function Showss() {
    //alert("1");
$("#yonghu").removeClass('yingcang');
$("#yonghu").addClass('xianshi');   
}
function Hiddenss() {
    //alert("2");
    $("#yonghu").removeClass('xianshi');
    $("#yonghu").addClass('yingcang');  
}

</script>
</ol>

</if>
</div>    
</div>


<span style="position:relative" id="dengluspan"></span>


<div class="header_bg">
<div class="public header">
<a title="我爱我家" href="%7B:U('Home/Index/index')%7D"><img  src="__PUBLIC__/images/logo.png" class="logo" alt="javascript - 百度地图 ajax获取数据" ></a>

<samp>
<a href="%7B:U('Home/ditu/index')%7D">地图</a>
</samp>
<div class="serch">
<div class="Sertxt">
<form action="%7B:U('Home/house/index')%7D" id="subform" name="subform" method="get">
<input type="text" placeholder="请输入房源特征,地点或小区名..." id="zufangkey" name="zufangkey" class="ac_input" condition="$zufangkey!=''"> value="{$zufangkey}" ></form>
</div>
<div class="SerBtn"><a href="javascript:;" onclick="document.getElementById('subform').submit();">搜索</a></div>

</div>
</div>

</div>


</elemlist.length></code>
Salin selepas log masuk
Salin selepas log masuk

View/ditu/index.html

<code><include file="ditu/ditu_header" title="地图找房-赤峰我爱我家"></include>
<link rel="stylesheet" href="__PUBLIC__/ditu/css/jquery.autocomplete.css">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=9M8Cdykql4eAsH8kGY15AXd5"></script>
<script type="text/javascript" src="http://map.soso.com/api/v2/main.js?key=d84d6d83e0e51e481e50454ccbe8986b"></script>
<script type="text/javascript" src="__PUBLIC__/ditu/js/jquery.pack.js"></script>
<script type="text/javascript" src="__PUBLIC__/ditu/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="__PUBLIC__/ditu/js/map.js?v=20131216"></script>
<!--navigation-->
<div class="m_navigation">
  <ul>
    <li><a href="#" id="redirect_rsf"></a></li>
    <li><a href="#"><img  src="__PUBLIC__/ditu/images/m_navigation.png" alt="javascript - 百度地图 ajax获取数据" ></a></li>
  </ul>
</div>
<!--left-->
<div class="m_nav"> 
  <!--房源量-->
  <div id="result_total" class="amount_housing">找到<span id="houseNum">0</span>套房源</div>
  <!--价格-->
  <div class="m_price">
    <p><strong>价格(万元):</strong></p>
    <dl id="h_tp" class="clearfix">
      <dd><a href="#" class="bg">价格不限</a></dd>
      <dd><a href="#" data-item="1">20以下</a></dd>
      <dd><a href="#" data-item="2">20-30</a></dd>
      <dd><a href="#" data-item="3">30-50</a></dd>
      <dd><a href="#" data-item="4">50-100</a></dd>
      <dd><a href="#" data-item="5">100-300</a></dd>
      <dd><a href="#" data-item="6">300-500</a></dd>
      <dd><a href="#" data-item="7">500-1000</a></dd>
      <dd><a href="#" data-item="8">1000以上</a></dd>
    </dl>
    <ol id="totalPrice" class="clearfix">
      <li>
        <input name="" type="text" onkeyup="value=value.replace(/[^\d]/g,'')">
      </li>
      <li class="one">-</li>
      <li>
        <input name="" type="text" onkeyup="value=value.replace(/[^\d]/g,'')">
      </li>
      <li><a href="#" class="confirm">确定</a></li>
    </ol>
    <div class="clear"></div>
    <ul>
    </ul>
    <p><strong>户型:</strong></p>
    <dl id="h_rn" class="huxing clearfix">
      <dd><a href="#" class="bg">房型不限</a></dd>
      <dd><a href="#" data-item="1">1室</a></dd>
      <dd><a href="#" data-item="2">2室</a></dd>
      <dd class="one"><a href="#" data-item="3">3室</a></dd>
      <dd><a href="#" data-item="4">4室</a></dd>
      <dd><a href="#" data-item="5">5室</a></dd>
      <dd><a href="#" data-item="6">5室以上</a></dd>
    </dl>
    <div class="clear"></div>
    <ul>
    </ul>
    <p><strong>面积(平米):</strong></p>
    <dl id="h_a" class="huxing clearfix">
      <dd><a href="#" class="bg">面积不限</a></dd>
      <dd><a href="#" data-item="1">50以下</a></dd>
      <dd><a href="#" data-item="2">50-70</a></dd>
      <dd><a href="#" data-item="3">70-90</a></dd>
      <dd><a href="#" data-item="4">90-110</a></dd>
      <dd><a href="#" data-item="5">110-130</a></dd>
      <dd><a href="#" data-item="6">130-150</a></dd>
      <dd><a href="#" data-item="7">150-200</a></dd>
      <dd><a href="#" data-item="8">200以上</a></dd>
    </dl>
    <div class="clear"></div>
    <ul class="two">
    </ul>
  </div>
  <!--更多筛选-->
  <div class="m_more">
    <ul class="clearfix">
      <li><img  src="__PUBLIC__/ditu/images/m_more.png" id="j_more" class="shou" alt="javascript - 百度地图 ajax获取数据" ></li>
      <li class="one"><img  src="__PUBLIC__/ditu/images/m_mores.png" alt="javascript - 百度地图 ajax获取数据" ></li>
      <li><a href="#" id="h_reset">重置条件</a></li>
    </ul>
  </div>
  <div class="mod-menu" id="j_more_menu" style="display:none;">
    <ul class="menu-item">
      <li id="h_o_select"><a href="#">选择朝向</a></li>
      <li id="h_fy_select"><a href="#">选择楼龄</a></li>
      <li id="h_fs_select"><a href="#">选择楼层</a></li>
      <li id="h_l_select"><a href="#">选择标签</a></li>
    </ul>
    <!--级菜单列表-->
    <div class="menu-cont" style="display:none;top:241px;">
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_o">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">朝东</a></li>
          <li><a href="#" data-item="2">朝南</a></li>
          <li><a href="#" data-item="3">朝西</a></li>
          <li><a href="#" data-item="4">朝北</a></li>
          <li><a href="#" data-item="5">南北</a></li>
        </ul>
      </div>
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_fy">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">5年内</a></li>
          <li><a href="#" data-item="2">10年内</a></li>
          <li><a href="#" data-item="3">10-20年</a></li>
          <li><a href="#" data-item="4">20年以上</a></li>
        </ul>
      </div>
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_fs">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">低楼层</a></li>
          <li><a href="#" data-item="2">中楼层</a></li>
          <li><a href="#" data-item="3">高楼层</a></li>
          <li><a href="#" data-item="4">地下室</a></li>
        </ul>
      </div>
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_l">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">新上</a></li>
          <li><a href="#" data-item="2">急售</a></li>
          <li><a href="#" data-item="3">学区</a></li>
          <li><a href="#" data-item="4">独家</a></li>
          <li><a href="#" data-item="5">降价</a></li>
          <li><a href="#" data-item="6">满5年</a></li>
          <li><a href="#" data-item="7">唯一住房</a></li>
          <li><a href="#" data-item="8">随时可看</a></li>
          <li><a href="#" data-item="9">高性价比</a></li>
        </ul>
      </div>
    </div>
  </div>
</div>
<!--right-->
<div class="m_map"> 
  <!--门店 公交 学校-->
  <div id="mapToolBox" class="map_nav" style="display:none">
    <ul>
      <li id="j_switch_store">
        <div class="outlet"></div>
        <div class="no_outlet"></div>
      </li>
      <li id="j_switch_bus">
        <div class="m_bus"></div>
        <div class="no_m_bus"></div>
      </li>
      <li id="j_switch_school">
        <div class="m_school"></div>
        <div class="no_m_school"></div>
        <div class="no_choose" style="display:none">
          <dl class="clearfix j_school_yey">
            <dd class="three"></dd>
          </dl>
          <dl class="clearfix j_school_xx one">
            <dd class="one"></dd>
          </dl>
          <ol class="j_school_grade">
            <li data-item="" class="arrow">
            <li data-item="1">
            <li data-item="2">
            <li data-item="0">
          </ol>
        </div>
      </li>
    </ul>
  </div>
  <div id="j_heatmap_bar" class="thermodynamic" style="display:none">
    <p class="max">0</p>
    <p class="one min">0</p>
  </div>
  <div class="map_wrap" id="map_canvas"></div>
  <div class="map_wrap_load" id="map_canvas_load" style="display:none"> <img  src="__PUBLIC__/ditu/images/loading_37.gif" alt="javascript - 百度地图 ajax获取数据" > </div>
  <div class="map_jiejing" id="sosoMap" style="display:none;">
    <div class="jiejing_warp" id="sosoMap_canvas"></div>
    <div class="close_vista" id="sosoMap_close"><a href="javascript:void();"></a></div>
  </div>
</div>
<div id="j_heatmap_dialog" class="heatmap_dialog">
<a href="#" class="close"></a><a href="#" class="iknown"></a>
</div>
<div class="trace_wrap" style="display:none">
  <input type="text" name="" value="" id="demo">
</div>
<style type="text/css">    
    .rlt_hint{position:absolute;top:170px;left:554px;width:242px;height:156px; no-repeat;z-index:999999;display:none;}
    .rlt_hint a:link,.rlt_hint a:hover,.rlt_hint a:visited,.rlt_hint a:active{display:inline-block;width:30px;height:30px;margin:17px 0 0 203px;}
    .rlt_hint2{position:absolute;bottom:35px;left:290px;width:242px;height:156px;z-index:999999;display:none;}
    .rlt_hint2 a:link,.rlt_hint2 a:hover,.rlt_hint2 a:visited,.rlt_hint2 a:active{display:inline-block;width:30px;height:30px;margin:3px 0 0 207px;}
</style>
<div id="j_map_guide_newfunction" class="rlt_hint2"><a href="#"></a></div>
<script type="text/javascript" src="__PUBLIC__/ditu/js/jquery.cookie.js"></script> 
<script type="text/javascript">
var j_map_guide_newfunction = $('#j_map_guide_newfunction');if(!$.cookie('j_map_guide_newfunction')){j_map_guide_newfunction.show();}
j_map_guide_newfunction.find('a').click(function(){alert("我是提示文s字!");$.cookie('j_map_guide_newfunction', 'yes', {expires:1000});j_map_guide_newfunction.hide();});
</script>

</code>
Salin selepas log masuk
Salin selepas log masuk

回复内容:

出问题的网站链接

使用的是thinkphp的框架,自从改了URL重写之后点击地图上的房子的链接就出错了。我找来找去也没有发现生成链接的代码在哪里。希望对这块比较熟的大神可以帮我找一下错误出在哪里,谢谢!
Controller/AjaxController.class.php:

<code><?php namespace Home\Controller;
use Think\Controller;
use Think\Image;
class AjaxController extends HomeController {
    public function extlist($tid)
    {
        $e=M("extinfo");
        $extlist=$e->where(" exttypeid=$tid")->select();
        $this->assign('extlist',$extlist);
        $this->display('house/ajax/extlist');
    }
    public function getHouseList($h_tp='',$totalPrice='',$h_rn='',$h_o='',$h_fy='',$h_fs='',$h_l='',$h_a='',$key='')
    {
            $condition['house_map_position']=array('neq','');
        if(!empty($h_tp)){
                switch($h_tp)
                {
                    case 1:
                        $condition['house_price']=array('lt',20);
                        break;  
                    case 2:
                        $condition['house_price']=array(array('egt',20),array('lt',30), 'and') ;
                        break;  
                    case 3:
                        $condition['house_price']=array(array('egt',30),array('lt',50), 'and') ;
                        break;  
                    case 4:
                        $condition['house_price']=array(array('egt',50),array('lt',100), 'and') ;
                        break;  
                    case 5:
                        $condition['house_price']=array(array('egt',100),array('lt',300), 'and') ;
                        break;  
                    case 6:
                        $condition['house_price']=array(array('egt',300),array('lt',500), 'and') ;
                        break;  
                    case 7:
                        $condition['house_price']=array(array('egt',500),array('elt',1000), 'and') ;
                        break;  
                    case 8:
                        $condition['house_price']=array('gt',1000);
                        break;  
                }
            }

        if(!empty($totalPrice)){
                $arrprice=explode(",",$totalPrice);
                if(count($arrprice)==2){
                        if(is_numeric($arrprice[0])&&is_numeric($arrprice[1])){
                                $condition['house_price']=array(array('egt',$arrprice[0]),array('elt',$arrprice[1]), 'and') ;
                            }
                    }
            }
        if(!empty($h_rn)){
                switch($h_rn)
                {
                    case 1:
                        $condition['house_model']=array('like','%1室%');
                        break;  
                    case 2:
                        $condition['house_model']=array('like','%2室%');
                        break;  
                    case 3:
                        $condition['house_model']=array('like','%3室%');
                        break;  
                    case 4:
                        $condition['house_model']=array('like','%4室%');
                        break;  
                    case 5:
                        $condition['house_model']=array('like','%5室%');
                        break;  
                }
            }
        if(!empty($h_o)){
                switch($h_o){
                        case 1:
                            $condition['house_direction']=array('like','%朝东%');
                            break;
                        case 2:
                            $condition['house_direction']=array('like','%朝南%');
                            break;
                        case 3:
                            $condition['house_direction']=array('like','%朝西%');
                            break;
                        case 4:
                            $condition['house_direction']=array('like','%朝北%');
                            break;
                        case 4:
                            $condition['house_direction']=array('like','%南北%');
                            break;
                    }
            }
        if(!empty($h_fy)){
                switch($h_fy){
                        case 1:
                            $condition['house_age']=array('lt',5);
                            break;
                        case 2:
                            $condition['house_age']=array('lt',10);
                            break;
                        case 3:
                            $condition['house_age']=array(array('egt',10),array('elt',20), 'and') ;
                            break;
                        case 4:
                            $condition['house_age']=array('gt',20) ;
                            break;
                    }
            }
        if(!empty($h_fs)){
                switch($h_fs)
                {
                        case 1:
                            $condition['house_floor'] = array(array('egt',1),array('elt',5));
                            break;
                        case 2:
                            $condition['house_floor'] = array(array('egt',6),array('elt',12));
                            break;
                        case 3:
                            $condition['house_floor'] = array(array('egt',13));
                            break;
                        case 4:
                            $condition['house_floor'] = array(array('elt',0));
                            break;
                        default:

                            break;
                }   
            }
        if(!empty($h_l)){
                switch($h_l)
                {
                  case 1:
                      $condition['house_keyword'] = array('like',"%新上%");
                      break;
                  case 2:
                      $condition['house_keyword'] = array('like',"%急售%");
                      break;
                  case 3:
                      $condition['house_keyword'] = array('like',"%学区%");
                      break;
                  case 4:
                      $condition['house_keyword'] = array('like',"%独家%");
                      break;
                  case 5:
                      $condition['house_keyword'] = array('like',"%降价%");
                      break;
                  case 6:
                      $condition['house_keyword'] = array('like',"%满五年%");
                      break;
                  case 7:
                      $condition['house_keyword'] = array('like',"%唯一住房%");
                      break;
                  case 8:
                      $condition['house_keyword'] = array('like',"%随时可看%");
                      break;
                  case 9:
                      $condition['house_keyword'] = array('like',"%高性价比%");
                      break;
                }
            }
        if(!empty($h_a)){
                switch($h_a)
                {
                    case 1:
                        $condition['house_area']=array('lt',50);
                        break;
                    case 2:
                        $condition['house_area']=array(array('gt',50),array('lt',70));
                        break;
                    case 3:
                        $condition['house_area']=array(array('gt',70),array('lt',90));
                        break;
                    case 4:
                        $condition['house_area']=array(array('gt',90),array('lt',110));
                        break;
                    case 5:
                        $condition['house_area']=array(array('gt',110),array('lt',130));
                        break;
                    case 6:
                        $condition['house_area']=array(array('gt',130),array('lt',150));
                        break;
                    case 7:
                        $condition['house_area']=array(array('gt',150),array('lt',200));
                        break;
                    case 8:
                        $condition['house_area']=array('gt',200);
                        break;
                    default:
                        $condition['house_area']=array('gt',0);
                        break;
                }
            }
        if(!empty($key)){
                $conkey['house_title']=array('like','%'.$key.'%');
                $conkey['house_model']=array('like','%'.$key.'%');
                $conkey['house_direction']=array('like','%'.$key.'%');
                $conkey['house_keyword']=array('like','%'.$key.'%');
                $conkey['village_title']=array('like','%'.$key.'%');
                $conkey['village_dizhi']=array('like','%'.$key.'%');
                $conkey['_logic'] = 'or';
                $condition['_complex'] = $conkey;
            }
            //print_r($condition);
        $house=M("HouseView",null);
        $data = $house->where($condition)->field('id,house_id,house_title,house_price,house_map_position,house_direction')->select();
        $arrdata['total']=count($data);
        if(!empty($key)){
                $arrdata['iskey']='yes';
            }else{
                $arrdata['iskey']='no';
                }
        $arrdata['result']=$data;
        $this->ajaxReturn($arrdata,'JSON');
    }
    public function getHousePicture($houseid){
            $house=M("house_pictures");
            $data=$house->where(" houseid=$houseid")->order('id desc')->limit(1)->select();
            $this->ajaxReturn($data,'JSON');
        }
    public function getText($key){
            print_r($key);
            $this->ajaxReturn($key);
        }
}
?>
</code>
Salin selepas log masuk
Salin selepas log masuk

Controller/DituController.class.php

<code><?php namespace Home\Controller;
use Think\Controller;
class DituController extends HomeController {
    public function Index()
    {

        $id=$_GET['ditu'];      
        $this->display();
    }



    public function wangzhandutu()
    {


        $wenfen=M("wenfen");
        $wenfen1 =$wenfen->where("1=1")->select();
        $this->assign('wenda',$wenfen1);

        $regions=M("regions");
        $regions1 =$regions->where("region_level=6")->select();
        $this->assign('mendianc',$regions1);

        $jinrong_news_class=M("jinrong_news_class");
        $jinrong_news_classa =$jinrong_news_class->where("1=1")->select();
        $this->assign('jinrong',$jinrong_news_classa);

        $information_fl=M("information_fl");
        $information_fla =$information_fl->where("1=1")->select();
        $this->assign('zixunc',$information_fla);

        $regions2 =$regions->where("region_level=3")->select();
        $this->assign('quyu',$regions2);

        $remen=M("remen");
        $remena =$remen->where("rg=1")->select();
        $this->assign('remen',$remena);






        $this->display();
    }


}
?>
</code>
Salin selepas log masuk
Salin selepas log masuk

View/ditu/ditu_header.html

<code>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>[title]</title>
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Css/css/Public.css">
<link type="text/css" rel="stylesheet" href="__PUBLIC__/Css/css/ditu.css">
<script type="text/javascript" src="__PUBLIC__/js/xqxc1.js"></script> 
<script type="text/javascript" src="__PUBLIC__/js/xqxc2.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/gundong.js"></script>   



function secBoard(elementID,listName,n) {
 var elem = document.getElementById(elementID);
 var elemlist = elem.getElementsByTagName("li");
 for (var i=0; i<elemlist.length i elemlist var m="i+1;" document.getelementbyid>


<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?78017cacc0a925d339c240ab6b7dcfc6";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>




<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?0cd7b0a8e086bea285f3735c29a0d564";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>








<div id="box"></div>


<!--header-->
<link href="/lian.ico" rel="Shortcut Icon">


<div class="nav_bg">
<div class="public total">
<ul id="menu">
<li><a href="%7B:U('Home/Index/index')%7D">首页</a></li>
<li><a href="%7B:U('Home/Finance/index')%7D" class="">金融</a></li>
<li><a href="%7B:U('Home/house/index')%7D">二手房<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/housezu/index')%7D">租房<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/Village/index')%7D">小区<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/broker/index')%7D">经纪人<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/store/index')%7D">门店<i class="Navico"></i></a></li>

<li class="curr"><a href="%7B:U('Home/ditu/index')%7D">地图<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/estimate/index')%7D">评估<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/wenda/index')%7D">问答<i class="Navico"></i></a></li>

<li><a href="%7B:U('Home/information/index')%7D">资讯<i class="Navico"></i></a></li>

</ul>
<if condition="$_SESSION['user_id'] eq ''"> 
<ol>
<a href="%7B:U('home/login/login')%7D"><i class="Navico loIco"></i>登录</a>
<a href="%7B:U('home/login/register')%7D"><i class="Navico regIco"></i>注册</a>

</ol>
<else></else>
<ol>
<style>
.yingcang{ display:none;}
.xianshi{ display:block;}
.tcdyysb{ background:#0c53cf; width:87px; overflow:hidden;}
.tcdyysb p{ display:block;}
.tcdyysb p a { font-size:13px; color:#FFF; display:block; clear:both; width:87px; padding:0; margin:0; text-align:center; line-height:30px;}
.tcdyysb p a:hover{ background:#003591;}
</style>
<a href="%7B:U('home/geren/index')%7D" onmouseover="Showss();" onmouseout="Hiddenss();">{$_SESSION['user_name']} </a><i class="Navico"></i><a href="%7B:U('home/Logout/index')%7D">退出</a> 
<div id="yonghu" style="   position:fixed; z-index:999;  " class=" yingcang tcdyysb " onmouseover="Showss();" onmouseout="Hiddenss();">
<p><a href="%7B:U('Home/geren/index')%7D" target="_blank">中心首页</a></p>
<p><a href="%7B:U('Home/geren/kfjl')%7D" target="_blank">看房记录</a></p>
<p><a href="%7B:U('Home/geren/gzh')%7D" target="_blank">关注房源</a></p>
<p><a href="%7B:U('Home/geren/jjr')%7D" target="_blank">我的经纪人</a></p>
<p><a href="%7B:U('Home/geren/wdtw')%7D" target="_blank">我的提问</a></p>
<p><a href="%7B:U('Home/geren/tuijian')%7D" target="_blank">浏览房源</a></p>
<p><a href="%7B:U('Home/geren/xinxi')%7D" target="_blank">会员提醒</a></p>
<p><a href="%7B:U('Home/geren/gexing')%7D" target="_blank">个性定制</a></p>
<p><a href="%7B:U('Home/geren/chaxun')%7D" target="_blank">贷款查询</a></p>
</div>



<script type="text/javascript">
function Showss() {
    //alert("1");
$("#yonghu").removeClass('yingcang');
$("#yonghu").addClass('xianshi');   
}
function Hiddenss() {
    //alert("2");
    $("#yonghu").removeClass('xianshi');
    $("#yonghu").addClass('yingcang');  
}

</script>
</ol>

</if>
</div>    
</div>


<span style="position:relative" id="dengluspan"></span>


<div class="header_bg">
<div class="public header">
<a title="我爱我家" href="%7B:U('Home/Index/index')%7D"><img  src="__PUBLIC__/images/logo.png" class="logo" alt="javascript - 百度地图 ajax获取数据" ></a>

<samp>
<a href="%7B:U('Home/ditu/index')%7D">地图</a>
</samp>
<div class="serch">
<div class="Sertxt">
<form action="%7B:U('Home/house/index')%7D" id="subform" name="subform" method="get">
<input type="text" placeholder="请输入房源特征,地点或小区名..." id="zufangkey" name="zufangkey" class="ac_input" condition="$zufangkey!=''"> value="{$zufangkey}" ></form>
</div>
<div class="SerBtn"><a href="javascript:;" onclick="document.getElementById('subform').submit();">搜索</a></div>

</div>
</div>

</div>


</elemlist.length></code>
Salin selepas log masuk
Salin selepas log masuk

View/ditu/index.html

<code><include file="ditu/ditu_header" title="地图找房-赤峰我爱我家"></include>
<link rel="stylesheet" href="__PUBLIC__/ditu/css/jquery.autocomplete.css">
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=9M8Cdykql4eAsH8kGY15AXd5"></script>
<script type="text/javascript" src="http://map.soso.com/api/v2/main.js?key=d84d6d83e0e51e481e50454ccbe8986b"></script>
<script type="text/javascript" src="__PUBLIC__/ditu/js/jquery.pack.js"></script>
<script type="text/javascript" src="__PUBLIC__/ditu/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="__PUBLIC__/ditu/js/map.js?v=20131216"></script>
<!--navigation-->
<div class="m_navigation">
  <ul>
    <li><a href="#" id="redirect_rsf"></a></li>
    <li><a href="#"><img  src="__PUBLIC__/ditu/images/m_navigation.png" alt="javascript - 百度地图 ajax获取数据" ></a></li>
  </ul>
</div>
<!--left-->
<div class="m_nav"> 
  <!--房源量-->
  <div id="result_total" class="amount_housing">找到<span id="houseNum">0</span>套房源</div>
  <!--价格-->
  <div class="m_price">
    <p><strong>价格(万元):</strong></p>
    <dl id="h_tp" class="clearfix">
      <dd><a href="#" class="bg">价格不限</a></dd>
      <dd><a href="#" data-item="1">20以下</a></dd>
      <dd><a href="#" data-item="2">20-30</a></dd>
      <dd><a href="#" data-item="3">30-50</a></dd>
      <dd><a href="#" data-item="4">50-100</a></dd>
      <dd><a href="#" data-item="5">100-300</a></dd>
      <dd><a href="#" data-item="6">300-500</a></dd>
      <dd><a href="#" data-item="7">500-1000</a></dd>
      <dd><a href="#" data-item="8">1000以上</a></dd>
    </dl>
    <ol id="totalPrice" class="clearfix">
      <li>
        <input name="" type="text" onkeyup="value=value.replace(/[^\d]/g,'')">
      </li>
      <li class="one">-</li>
      <li>
        <input name="" type="text" onkeyup="value=value.replace(/[^\d]/g,'')">
      </li>
      <li><a href="#" class="confirm">确定</a></li>
    </ol>
    <div class="clear"></div>
    <ul>
    </ul>
    <p><strong>户型:</strong></p>
    <dl id="h_rn" class="huxing clearfix">
      <dd><a href="#" class="bg">房型不限</a></dd>
      <dd><a href="#" data-item="1">1室</a></dd>
      <dd><a href="#" data-item="2">2室</a></dd>
      <dd class="one"><a href="#" data-item="3">3室</a></dd>
      <dd><a href="#" data-item="4">4室</a></dd>
      <dd><a href="#" data-item="5">5室</a></dd>
      <dd><a href="#" data-item="6">5室以上</a></dd>
    </dl>
    <div class="clear"></div>
    <ul>
    </ul>
    <p><strong>面积(平米):</strong></p>
    <dl id="h_a" class="huxing clearfix">
      <dd><a href="#" class="bg">面积不限</a></dd>
      <dd><a href="#" data-item="1">50以下</a></dd>
      <dd><a href="#" data-item="2">50-70</a></dd>
      <dd><a href="#" data-item="3">70-90</a></dd>
      <dd><a href="#" data-item="4">90-110</a></dd>
      <dd><a href="#" data-item="5">110-130</a></dd>
      <dd><a href="#" data-item="6">130-150</a></dd>
      <dd><a href="#" data-item="7">150-200</a></dd>
      <dd><a href="#" data-item="8">200以上</a></dd>
    </dl>
    <div class="clear"></div>
    <ul class="two">
    </ul>
  </div>
  <!--更多筛选-->
  <div class="m_more">
    <ul class="clearfix">
      <li><img  src="__PUBLIC__/ditu/images/m_more.png" id="j_more" class="shou" alt="javascript - 百度地图 ajax获取数据" ></li>
      <li class="one"><img  src="__PUBLIC__/ditu/images/m_mores.png" alt="javascript - 百度地图 ajax获取数据" ></li>
      <li><a href="#" id="h_reset">重置条件</a></li>
    </ul>
  </div>
  <div class="mod-menu" id="j_more_menu" style="display:none;">
    <ul class="menu-item">
      <li id="h_o_select"><a href="#">选择朝向</a></li>
      <li id="h_fy_select"><a href="#">选择楼龄</a></li>
      <li id="h_fs_select"><a href="#">选择楼层</a></li>
      <li id="h_l_select"><a href="#">选择标签</a></li>
    </ul>
    <!--级菜单列表-->
    <div class="menu-cont" style="display:none;top:241px;">
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_o">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">朝东</a></li>
          <li><a href="#" data-item="2">朝南</a></li>
          <li><a href="#" data-item="3">朝西</a></li>
          <li><a href="#" data-item="4">朝北</a></li>
          <li><a href="#" data-item="5">南北</a></li>
        </ul>
      </div>
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_fy">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">5年内</a></li>
          <li><a href="#" data-item="2">10年内</a></li>
          <li><a href="#" data-item="3">10-20年</a></li>
          <li><a href="#" data-item="4">20年以上</a></li>
        </ul>
      </div>
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_fs">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">低楼层</a></li>
          <li><a href="#" data-item="2">中楼层</a></li>
          <li><a href="#" data-item="3">高楼层</a></li>
          <li><a href="#" data-item="4">地下室</a></li>
        </ul>
      </div>
      <div class="menu-cont-list" style="display:none;">
        <ul id="h_l">
          <li><a href="#">不限</a></li>
          <li><a href="#" data-item="1">新上</a></li>
          <li><a href="#" data-item="2">急售</a></li>
          <li><a href="#" data-item="3">学区</a></li>
          <li><a href="#" data-item="4">独家</a></li>
          <li><a href="#" data-item="5">降价</a></li>
          <li><a href="#" data-item="6">满5年</a></li>
          <li><a href="#" data-item="7">唯一住房</a></li>
          <li><a href="#" data-item="8">随时可看</a></li>
          <li><a href="#" data-item="9">高性价比</a></li>
        </ul>
      </div>
    </div>
  </div>
</div>
<!--right-->
<div class="m_map"> 
  <!--门店 公交 学校-->
  <div id="mapToolBox" class="map_nav" style="display:none">
    <ul>
      <li id="j_switch_store">
        <div class="outlet"></div>
        <div class="no_outlet"></div>
      </li>
      <li id="j_switch_bus">
        <div class="m_bus"></div>
        <div class="no_m_bus"></div>
      </li>
      <li id="j_switch_school">
        <div class="m_school"></div>
        <div class="no_m_school"></div>
        <div class="no_choose" style="display:none">
          <dl class="clearfix j_school_yey">
            <dd class="three"></dd>
          </dl>
          <dl class="clearfix j_school_xx one">
            <dd class="one"></dd>
          </dl>
          <ol class="j_school_grade">
            <li data-item="" class="arrow">
            <li data-item="1">
            <li data-item="2">
            <li data-item="0">
          </ol>
        </div>
      </li>
    </ul>
  </div>
  <div id="j_heatmap_bar" class="thermodynamic" style="display:none">
    <p class="max">0</p>
    <p class="one min">0</p>
  </div>
  <div class="map_wrap" id="map_canvas"></div>
  <div class="map_wrap_load" id="map_canvas_load" style="display:none"> <img  src="__PUBLIC__/ditu/images/loading_37.gif" alt="javascript - 百度地图 ajax获取数据" > </div>
  <div class="map_jiejing" id="sosoMap" style="display:none;">
    <div class="jiejing_warp" id="sosoMap_canvas"></div>
    <div class="close_vista" id="sosoMap_close"><a href="javascript:void();"></a></div>
  </div>
</div>
<div id="j_heatmap_dialog" class="heatmap_dialog">
<a href="#" class="close"></a><a href="#" class="iknown"></a>
</div>
<div class="trace_wrap" style="display:none">
  <input type="text" name="" value="" id="demo">
</div>
<style type="text/css">    
    .rlt_hint{position:absolute;top:170px;left:554px;width:242px;height:156px; no-repeat;z-index:999999;display:none;}
    .rlt_hint a:link,.rlt_hint a:hover,.rlt_hint a:visited,.rlt_hint a:active{display:inline-block;width:30px;height:30px;margin:17px 0 0 203px;}
    .rlt_hint2{position:absolute;bottom:35px;left:290px;width:242px;height:156px;z-index:999999;display:none;}
    .rlt_hint2 a:link,.rlt_hint2 a:hover,.rlt_hint2 a:visited,.rlt_hint2 a:active{display:inline-block;width:30px;height:30px;margin:3px 0 0 207px;}
</style>
<div id="j_map_guide_newfunction" class="rlt_hint2"><a href="#"></a></div>
<script type="text/javascript" src="__PUBLIC__/ditu/js/jquery.cookie.js"></script> 
<script type="text/javascript">
var j_map_guide_newfunction = $('#j_map_guide_newfunction');if(!$.cookie('j_map_guide_newfunction')){j_map_guide_newfunction.show();}
j_map_guide_newfunction.find('a').click(function(){alert("我是提示文s字!");$.cookie('j_map_guide_newfunction', 'yes', {expires:1000});j_map_guide_newfunction.hide();});
</script>

</code>
Salin selepas log masuk
Salin selepas log masuk
Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan
Tentang kita Penafian Sitemap
Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!