|
- <?php
- /*
- Author:XM
- Compeny:Spiders Travel
- */
- require_once '../Common/Mysql.php';
- if (ALLOW_ORIGIN)
- header("Access-Control-Allow-Origin:*");
- writeLog(json_encode($_GET));
- $startarea=isset($_GET['startarea'])?$_GET['startarea']:'';
- $endarea=isset($_GET['endarea'])?$_GET['endarea']:'';
- $starttime=isset($_GET['starttime'])?$_GET['starttime']:'';
- $line=isset($_GET['line'])?$_GET['line']:'';
- $carNo=isset($_GET['carNo'])?(empty($_GET['carNo'])?0:$_GET['carNo']):0;
- $seatNo=isset($_GET['seatNo'])?$_GET['seatNo']:'';
- $name=isset($_GET['name'])?$_GET['name']:'';
- $currpage=isset($_GET['currpage'])?(empty($_GET['currpage'])?1:$_GET['currpage']):1;
- $pagesize=isset($_GET['pagesize'])?(empty($_GET['pagesize'])?10:$_GET['pagesize']):10;
- /* if ($startarea=='' && $endarea=='' && $starttime =='' && $line==''){
- echo json_encode(array("code"=>-1,"info"=>"前四项不能全部为空"));
- exit;
- } */
- $pdo=conn();
- $sql="CALL XM_ORDER_GET_CAR_LIST(1,'".$startarea."','".$endarea."','".$line."','".$starttime."',".$carNo.",'".$seatNo."','".$name."',".$currpage.",".$pagesize.")";
- writeLog('search_ticket---sql=='.$sql);
- $result=$pdo->query($sql);
- $data=array();
- do{
- $rowset=$result->fetchAll(PDO::FETCH_ASSOC);
- if($rowset){
- $data[]=$rowset;
- }
- }while ($result->nextRowset());
- $count=count($data);
- $final_data=array();
- if($count==1 && isset($data[0][0]['code']) && $data[0][0]['code']!=0){
- echo json_encode($data[0][0]);
- }else if($count==2){
- $json=array("code"=>0,"info"=>"");
- $json['totalTickets']= (isset($data[1][0]['num'])) ? $data[1][0]['num'] : 0;
- $json['totalPages']= (isset($data[1][0]['pagecount'])) ? $data[1][0]['pagecount'] : 0;
- $json['searchInfo']=$data[0];
- echo json_encode($json);
- }else{
- echo json_encode(array("code"=>0,"info"=>"","searchInfo"=>array()));
- }
- exit();
|