当前位置:Gxlcms > PHP教程 > javascript-百度地图ajax获取数据

javascript-百度地图ajax获取数据

时间:2021-07-01 10:21:17 帮助过:39人阅读

出问题的网站链接

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

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);
        }
}
?>

Controller/DituController.class.php

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();
    }


}
?>

View/ditu/ditu_header.html



[title]


 

   


<

script type="text/javascript">
function secBoard(elementID,listName,n) {
 var elem = document.getElementById(elementID);
 var elemlist = elem.getElementsByTagName("li");
 for (var i=0; i


























 
    登录 注册
    {$_SESSION['user_name']} 退出

    中心首页

    看房记录

    关注房源

    我的经纪人

    我的提问

    浏览房源

    会员提醒

    个性定制

    贷款查询

地图

View/ditu/index.html










  
找到0套房源

价格(万元):

价格不限
20以下
20-30
30-50
50-100
100-300
300-500
500-1000
1000以上
  1. -
  2. 确定

户型:

房型不限
1室
2室
3室
4室
5室
5室以上

面积(平米):

面积不限
50以下
50-70
70-90
90-110
110-130
130-150
150-200
200以上
  • 重置条件
  • 不限
  • 朝东
  • 朝南
  • 朝西
  • 朝北
  • 南北
  • 不限
  • 5年内
  • 10年内
  • 10-20年
  • 20年以上
  • 不限
  • 低楼层
  • 中楼层
  • 高楼层
  • 地下室
  • 不限
  • 新上
  • 急售
  • 学区
  • 独家
  • 降价
  • 满5年
  • 唯一住房
  • 随时可看
  • 高性价比

0

0

回复内容:

出问题的网站链接

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

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);
        }
}
?>

Controller/DituController.class.php

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();
    }


}
?>

View/ditu/ditu_header.html



[title]


 

   


<

script type="text/javascript">
function secBoard(elementID,listName,n) {
 var elem = document.getElementById(elementID);
 var elemlist = elem.getElementsByTagName("li");
 for (var i=0; i


























 
    登录 注册
    {$_SESSION['user_name']} 退出

    中心首页

    看房记录

    关注房源

    我的经纪人

    我的提问

    浏览房源

    会员提醒

    个性定制

    贷款查询

地图

View/ditu/index.html










  
找到0套房源

价格(万元):

价格不限
20以下
20-30
30-50
50-100
100-300
300-500
500-1000
1000以上
  1. -
  2. 确定

户型:

房型不限
1室
2室
3室
4室
5室
5室以上

面积(平米):

面积不限
50以下
50-70
70-90
90-110
110-130
130-150
150-200
200以上
  • 重置条件
  • 不限
  • 朝东
  • 朝南
  • 朝西
  • 朝北
  • 南北
  • 不限
  • 5年内
  • 10年内
  • 10-20年
  • 20年以上
  • 不限
  • 低楼层
  • 中楼层
  • 高楼层
  • 地下室
  • 不限
  • 新上
  • 急售
  • 学区
  • 独家
  • 降价
  • 满5年
  • 唯一住房
  • 随时可看
  • 高性价比

0

0

人气教程排行