|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- //显示线路信息
- header("Access-Control-Allow-Origin:*");
- $id = $_POST['id'];
- //$id = 152987;
- $sql = "CALL SP_GET_LINE_BY_ID(".$id.")";
- $result = $pdo->query($sql);
-
- $data = array();
-
- do{
- $rowset = $result->fetchAll(PDO::FETCH_ASSOC);
- if($rowset){
- $data[] = $rowset;
- }
- }while ($result->nextRowset());
-
- $json['code'] = 0;
- $json['info'] = "";
- $json['cominfo'] = $data[0][0];
- foreach($data[2] as $k => $v){
- foreach($data[1] as $kk => $vv){
- if($v['station_res_id'] == $vv['res_id']){
- if($data[1][$kk]['parent_area_name_list'] != ""){
- $area_name_id = explode("}{",$data[1][$kk]['parent_area_id_list']);
- $area_name_list = explode("}{",$data[1][$kk]['parent_area_name_list']);
- $area_name_id = str_replace('{','',$area_name_id);
- $area_name_id = str_replace('}','',$area_name_id);
- $area_name_list = str_replace('{','',$area_name_list);
- $area_name_list = str_replace('}','',$area_name_list);
-
- foreach($area_name_list as $kkk => $vvv){
- if(isset($area_name_id[$kkk]) && $area_name_id[$kkk] != $v['area_id']){
- $data[2][$k]['poi_name'][$kkk]['area_name_id'] = $area_name_id[$kkk];
- $data[2][$k]['poi_name'][$kkk]['area_name_list'] = $area_name_list[$kkk];
- }
- }
- sort($data[2][$k]['poi_name']);
- }else{
- $data[2][$k]['poi_name'] = "";
- }
- if($data[1][$kk]['checkport_res_name'] != ""){
- $checkport_res_name = explode(",",$data[1][$kk]['checkport_res_name']);
- $checkport_res_id = explode(",",$data[1][$kk]['checkport_res_id']);
-
- foreach($checkport_res_name as $kkk => $vvv){
- if(isset($checkport_res_id[$kkk]) && $checkport_res_id[$kkk] != $v['checkport_res_id']){
- $data[2][$k]['checkport_res'][$kkk]['checkport_res_id'] = $checkport_res_id[$kkk];
- $data[2][$k]['checkport_res'][$kkk]['checkport_res_name'] = $checkport_res_name[$kkk];
- }
- }
- sort($data[2][$k]['checkport_res']);
- }else{
- $data[2][$k]['checkport_res'] = "";
- }
- }
- }
-
- }
- $json['list'] = $data[2];
-
- echo json_encode($json);
- //print_r($json['list']);
-
- ?>
|