if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && isset($_SERVER['HTTP_REFERER']) &&$_SERVER['HTTP_REFERER'] == site_url("car_setup")){//判断请求地址以及判断是否为ajax提交
$id=$this->input->get('id');
$level=$this->input->get('level');
if($level== 2){
$array=array();
$array[] =array('id'=>'','name'=>'国产','first_letter'=>'');
$level_two_guochan_list=$this->db->from("car_setup")->where("father_id",$id)->where("country",0)->order_by("first_letter ASC,name ASC")->get();
$level_two_jinkou_list=$this->db->from("car_setup")->where("father_id",$id)->where("country",1)->order_by("first_letter ASC,name ASC")->get();
if($level_two_guochan_list->num_rows() > 0){
foreach($level_two_guochan_list->result()as$level_two_obj){
$array[] =array(
'id' =>$level_two_obj->id,
'name' =>$level_two_obj->name,
'first_letter' =>$level_two_obj->first_letter
);
}
$level_two_guochan_list->free_result();
}
$array[] =array('id'=>'','name'=>'进口','first_letter'=>'');
if($level_two_jinkou_list->num_rows() > 0){
foreach($level_two_jinkou_list->result()as$level_two_obj){
$array[] =array(
'id' =>$level_two_obj->id,
'name' =>$level_two_obj->name,
'first_letter' =>$level_two_obj->first_letter,
'sort_order' =>$level_two_obj->sort_order
);
}
$level_two_jinkou_list->free_result();
}
echojson_encode($array);
exit;
}elseif($level== 3 ||$level== 4){
$array=array();
$level_three_list=$this->db->from("car_setup")->where("father_id",$id)->order_by("sort_order ASC")->get();
if($level_three_list->num_rows() > 0){
foreach($level_three_list->result()as$level_two_obj){
$array[] =array(
'id' =>$level_two_obj->id,
'name' =>$level_two_obj->name,
'first_letter' =>$level_two_obj->first_letter,
'sort_order' =>$level_two_obj->sort_order
);
}
$level_three_list->free_result();
}
echojson_encode($array);
exit;
}
}else{
echo"哈哈~非ajax请求都被拒绝!";
}
目前有 0 条留言 其中:访客:0 条, 博主:0 条