|
- <?php
- /*
- Author:XM
- Compeny:Spiders Travel
- */
- require_once '../Common/Mysql.php';
- if (ALLOW_ORIGIN)
- header("Access-Control-Allow-Origin:*");
- $method=isset($_GET['method'])?$_GET['method']:'';
- $pdo=conn();
- switch ($method){
- case 'getRunInfo' :
- $USER_ID=isset($_GET['user_id'])?$_GET['user_id']:'';
- $RUN_ID=isset($_GET['run_id'])?$_GET['run_id']:'';
- $sql1="CALL SP_GET_RUN_LINE_INFO('".$USER_ID."','".$RUN_ID."')";
- $sql2="CALL SP_GET_RUN_STATION('".$USER_ID."','".$RUN_ID."')";
- $sql3="CALL XM_PRO_GET_LINE_CAR_TYPE('".$USER_ID."','".$RUN_ID."')";
- $sql4="CALL SP_GET_RUN_HAS_CAR('".$USER_ID."','".$RUN_ID."')";
- $sql5="CALL SP_GET_RUN_TICKETS_TYPE('".$USER_ID."','".$RUN_ID."')";
- $sql6="CALL SP_GET_RUN_START_DATE('".$USER_ID."','".$RUN_ID."')";
- if(is_object($pdo)){
- $result1=$pdo->query($sql1);
- $json1=$result1->fetchAll(PDO::FETCH_ASSOC);
- $result1->closeCursor();
-
- $result2=$pdo->query($sql2);
- $json2=$result2->fetchAll(PDO::FETCH_ASSOC);
- $result2->closeCursor();
-
- $result3=$pdo->query($sql3);
- $json3=$result3->fetchAll(PDO::FETCH_ASSOC);
- $result3->closeCursor();
-
- $result4=$pdo->query($sql4);
- $json4=$result4->fetchAll(PDO::FETCH_ASSOC);
- $result4->closeCursor();
-
- $result5=$pdo->query($sql5);
- $json5=$result5->fetchAll(PDO::FETCH_ASSOC);
- $result5->closeCursor();
-
- $result6=$pdo->query($sql6);
- $json6=$result6->fetchAll(PDO::FETCH_ASSOC);
- $result6->closeCursor();
- }
- $data = array();
- if(count($json1)>0){
- $data["line"] = array("name" => $json1[0]['name'], "lineid" => $json1[0]['lineid']);
- $data['sellday']= $json1[0]['pre_sale_day'];
- $data['time']= $json6[0]["time"];
- $data['station']=array();
- foreach( $json2 as $temp_info ) {
- $ticket_gate_ary = explode( ",", $temp_info["TICKET_GATE"]);
- if( strpos($temp_info["TICKET_GATE"], ":") != false && count($ticket_gate_ary) > 0 ) {
- $ticket_gate = array();
- foreach ($ticket_gate_ary as $ticket_simple) {
- $ticket_info = explode(":",$ticket_simple);
- $ticket_gate[] = array( $ticket_info[0] => $ticket_info[1]);
- }
- } else {
- $ticket_gate = "";
- }
- $temp_info_insert = $temp_info;
- $temp_info_insert["TICKET_GATE"] = $ticket_gate;
- $data['station'][] = $temp_info_insert;
- }
- }
-
- if(count($json3)>0){
- $data['cartype']=$json3;
- }
-
- if(count($json4)>0){
- $data['hascar']=$json4;
- }
- if(count($json5)>0){
- $data['ticket']=$json5;
- }
- $sql11 = "select
- s.id as supplier_id,s.supplier_name as bus_team
- from
- base_supplier as s,base_supplier_purchase as p
- where
- s.id = p.supplier_id
- and s.cancel_flag = 0
- and s.supplier_type = 187
- and p.cancel_flag = 0
- and p.product_type = 259
- group by s.id";
- $result11 = $pdo->query($sql11);
- $json11 = $result11->fetchAll(PDO::FETCH_ASSOC);
- $data['supplier_list']=$json11;
- $data['cost_type']=array(array('type_id' => 477, 'type_name' => '包车计价'), array('type_id' => 478, 'type_name' => '车座计价'));
-
- $sql12 = "select supplier_id,bus_res_id, base_cost from base_bus_cost where id > 0 ";
- $result12 = $pdo->query($sql12);
- $json12 = $result12->fetchAll(PDO::FETCH_ASSOC);
- $base_cost = array();
- foreach( $json12 as $base_cost_info ) {
- $supplier_id = $base_cost_info["supplier_id"];
- $bus_res_id = $base_cost_info["bus_res_id"];
- if( !isset($base_cost[$supplier_id]) ) {
- $base_cost[$supplier_id] = array();
- }
- $base_cost[$supplier_id][$bus_res_id] = $base_cost_info["base_cost"];
- }
- $data['base_cost'] = $base_cost;
- $sql13 = "select SUM(DISTANCE) as line_distance from opera_station where line_id = {$json1[0]['lineid']} ";
- $result13 = $pdo->query($sql13);
- $json13 = $result13->fetchAll(PDO::FETCH_ASSOC);
- $data['line_distance'] = $json13[0]["line_distance"];
- /*
- echo "jason1=<br />";print_r($json1);echo "<hr />";
- echo "jason2=<br />";print_r($json2);echo "<hr />";
- echo "jason3=<br />";print_r($json3);echo "<hr />";
- echo "jason4=<br />";print_r($json4);echo "<hr />";
- echo "jason5=<br />";print_r($json5);echo "<hr />";
- echo "jason6=<br />";print_r($json6);echo "<hr />";
- echo "data=<br />";print_r($data);echo "<hr />";
- */
- $sql7="CALL SP_GET_RUN_TICKET_INFO('".$USER_ID."','".$RUN_ID."')";
- if(is_object($pdo)){
- $stmt=$pdo->query($sql7);
- $i = 1;
- do{
- $rowset = $stmt->fetchAll(PDO::FETCH_ASSOC);
- if($i==1){
- $data['order_ticket_info_list']=$rowset;
- }else if ($i==2){
- $data['not_in_order_ticket_info_list']=$rowset;
-
- }else{
- }
- $i++;
- }while ($stmt->nextRowset());
- }
- $stmt->closeCursor();
- break;
-
- }
- if (is_array($data)){
- echo json_encode($data);
- }
- exit;
- //require_once '../Common/Config.php';
|