欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

javascript - 百度地图 ajax获取数据

程序员文章站 2022-04-14 17:53:27
...
出问题的网站链接

使用的是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]


function secBoard(elementID,listName,n) {
 var elem = document.getElementById(elementID);
 var elemlist = elem.getElementsByTagName("li");
 for (var i=0; i










地图
value="{$zufangkey}" >

View/ditu/index.html






回复内容:

出问题的网站链接

使用的是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]


function secBoard(elementID,listName,n) {
 var elem = document.getElementById(elementID);
 var elemlist = elem.getElementsByTagName("li");
 for (var i=0; i










地图
value="{$zufangkey}" >

View/ditu/index.html