You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

50 lines
1.5 KiB

  1. <?php
  2. header("Access-Control-Allow-Origin:*");
  3. //载入配置文件和连接数据库
  4. $pdo=conn();
  5. $user_id=$_COOKIE['user_id'];
  6. //$user_id = getUserId();
  7. if (!$user_id) {
  8. echo json_encode(array("code" => 1,"iflogin"=>1, "info" => "用户未登录"));
  9. exit ;
  10. }
  11. //区分是普通乘客还是分销员 0普通,1分销
  12. $user_type = 0;
  13. //判断出发地 目的地 时间是否为空
  14. $start_area = empty($_POST['start_id'])?"":$_POST['start_id'];
  15. $end_area = empty($_POST['end_id'])?"":$_POST['end_id'];
  16. $time = empty($_POST['back_time'])?date("Y-m-d",time()+24*3600):$_POST['back_time'];
  17. $bus_type = $_POST['bus_type'];
  18. if($bus_type == 255){
  19. $bus_type = "255,0";
  20. }
  21. $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 . "' AND a.station_inout_type = 108 AND d.bus_type IN (" . $bus_type . ") GROUP BY run_id";
  22. $result = $pdo->query($sql);
  23. $run_time = $result->fetchAll(PDO::FETCH_ASSOC);
  24. if(count($run_time) > 0){
  25. $code = 0;
  26. $info = $CODE[0];
  27. $list = $run_time;
  28. }else{
  29. $code = 0;
  30. $info = $CODE[7];
  31. $list = "";
  32. }
  33. $json = array();
  34. $json['code'] = $code;
  35. $json['info'] = $info;
  36. $json['list'] = $list;
  37. //print_r($json);
  38. echo json_encode($json);
  39. ?>