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.
 
 
 
 

47 lines
1.7 KiB

  1. <?php
  2. /*
  3. Author:XM
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../Common/Mysql.php';
  7. if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. writeLog(json_encode($_GET));
  10. $startarea=isset($_GET['startarea'])?$_GET['startarea']:'';
  11. $endarea=isset($_GET['endarea'])?$_GET['endarea']:'';
  12. $starttime=isset($_GET['starttime'])?$_GET['starttime']:'';
  13. $line=isset($_GET['line'])?$_GET['line']:'';
  14. $carNo=isset($_GET['carNo'])?(empty($_GET['carNo'])?0:$_GET['carNo']):0;
  15. $seatNo=isset($_GET['seatNo'])?$_GET['seatNo']:'';
  16. $name=isset($_GET['name'])?$_GET['name']:'';
  17. $currpage=isset($_GET['currpage'])?(empty($_GET['currpage'])?1:$_GET['currpage']):1;
  18. $pagesize=isset($_GET['pagesize'])?(empty($_GET['pagesize'])?10:$_GET['pagesize']):10;
  19. /* if ($startarea=='' && $endarea=='' && $starttime =='' && $line==''){
  20. echo json_encode(array("code"=>-1,"info"=>"前四项不能全部为空"));
  21. exit;
  22. } */
  23. $pdo=conn();
  24. $sql="CALL XM_ORDER_GET_CAR_LIST(1,'".$startarea."','".$endarea."','".$line."','".$starttime."',".$carNo.",'".$seatNo."','".$name."',".$currpage.",".$pagesize.")";
  25. writeLog('search_ticket---sql=='.$sql);
  26. $result=$pdo->query($sql);
  27. $data=array();
  28. do{
  29. $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
  30. if($rowset){
  31. $data[]=$rowset;
  32. }
  33. }while ($result->nextRowset());
  34. $count=count($data);
  35. $final_data=array();
  36. if($count==1 && isset($data[0][0]['code']) && $data[0][0]['code']!=0){
  37. echo json_encode($data[0][0]);
  38. }else if($count==2){
  39. $json=array("code"=>0,"info"=>"");
  40. $json['totalTickets']= (isset($data[1][0]['num'])) ? $data[1][0]['num'] : 0;
  41. $json['totalPages']= (isset($data[1][0]['pagecount'])) ? $data[1][0]['pagecount'] : 0;
  42. $json['searchInfo']=$data[0];
  43. echo json_encode($json);
  44. }else{
  45. echo json_encode(array("code"=>0,"info"=>"","searchInfo"=>array()));
  46. }
  47. exit();