|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- header("Access-Control-Allow-Origin:*");
- //载入配置文件和连接数据库
- $pdo=conn();
-
- //区分是普通乘客还是分销员 0普通,1分销
- $user_type = 0;
-
-
-
- //判断出发地 目的地 时间是否为空
- $start_area = empty($_POST['start_id'])?"":$_POST['start_id'];
- $end_area = empty($_POST['end_id'])?"":$_POST['end_id'];
- $time = empty($_POST['back_time'])?date("Y-m-d",time()+24*3600):$_POST['back_time'];
- $bus_type = $_POST['bus_type'];
- if($bus_type == 255){
- $bus_type = "255,0";
- }
- $current_day = date("Y-m-d");
- $limit_time = date("H:i", strtotime("+30 minutes"));
- $run_time_sql = "";
- if( $current_day == $time ) { $run_time_sql = " and c.run_time > '{$limit_time}' "; }
-
- $sql = "select a.run_id, min(a.start_time) as start_time FROM run_station a, run_station b, run_main c, opera_product d WHERE a.run_id = b.run_id AND a.run_id = c.run_id AND a.PROD_ID = d.prod_id AND a.area_id = " . $start_area . " AND b.area_id = " . $end_area . " AND c.run_date = '" . $time . "' {$run_time_sql} AND c.RUN_STATUS=138 AND a.station_inout_type in (108,109) and b.station_inout_type in (109,110) AND d.bus_type IN (" . $bus_type . ") GROUP BY run_id";
-
- $result = $pdo->query($sql);
- $run_time = $result->fetchAll(PDO::FETCH_ASSOC);
-
- if(count($run_time) > 0){
-
- $code = 0;
- $info = $CODE[0];
- $list = $run_time;
-
- }else{
- $code = 0;
- $info = $CODE[7];
- $list = "";
- }
-
- $json = array();
- $json['code'] = $code;
- $json['info'] = $info;
- $json['list'] = $list;
- //print_r($json);
-
- echo json_encode($json);
- ?>
|