選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

backthrough.php 1.6 KiB

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