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.
 
 
 
 

159 regels
4.9 KiB

  1. <?php
  2. /*
  3. Author:LB
  4. Compeny:Spiders Travel
  5. */
  6. require_once '../Common/Mysql.php';
  7. if (ALLOW_ORIGIN)
  8. header("Access-Control-Allow-Origin:*");
  9. $method=isset($_GET['method'])?$_GET['method']:'';
  10. $USER_ID=getUserId();
  11. if (!$USER_ID){
  12. echo json_encode(array("code"=>1,"info"=>"用户未登录"));
  13. exit;
  14. }
  15. $pdo=conn();
  16. switch ($method){
  17. case 'getRunInfo':
  18. $RUN_ID=isset($_GET['run_id'])?$_GET['run_id']:'';
  19. $sql1="CALL SP_GET_RUN_INFO('".$USER_ID."','".$RUN_ID."')";
  20. $sql2="CALL SP_GET_STATION_LIST('".$USER_ID."','".$RUN_ID."')";
  21. $sql4="CALL SP_GET_BUS_INFO('".$USER_ID."','".$RUN_ID."')";
  22. $sql5="CALL SP_GET_TICKET_TYPE('".$USER_ID."','".$RUN_ID."')";
  23. if(is_object($pdo)){
  24. $result1=$pdo->query($sql1);
  25. $json1=$result1->fetchAll(PDO::FETCH_ASSOC);
  26. $result1->closeCursor();
  27. $result2=$pdo->query($sql2);
  28. $json2=$result2->fetchAll(PDO::FETCH_ASSOC);
  29. $result2->closeCursor();
  30. $result4=$pdo->query($sql4);
  31. $json4=$result4->fetchAll(PDO::FETCH_ASSOC);
  32. $result4->closeCursor();
  33. $result5=$pdo->query($sql5);
  34. $json5=$result5->fetchAll(PDO::FETCH_ASSOC);
  35. $result5->closeCursor();
  36. }
  37. $data['code']='0';
  38. $data['info']='';
  39. if(count($json1)>0){
  40. $data['property']=$json1[0]['property'];
  41. $data['prod_name']=$json1[0]['prod_name'];
  42. $data['run_date']=$json1[0]['run_date'];
  43. $data['run_time']=$json1[0]['run_time'];
  44. $data['run_status']=$json1[0]['run_status'];
  45. $data['receiving']=$json1[0]['receiving'];
  46. $data['pre_sale_day']=$json1[0]['pre_sale_day'];
  47. // $data['bus_type']=$json2[0]['bus_type'];
  48. $data['station_list']=$json2;
  49. }
  50. if(count($json4)>0){
  51. $data['bus_info']=$json4;
  52. }
  53. if(count($json5)>0){
  54. $data['ticket_type']=$json5;
  55. }
  56. $sql7="CALL SP_GET_RUN_TICKET_INFO('".$USER_ID."','".$RUN_ID."')";
  57. if(is_object($pdo)){
  58. $stmt=$pdo->query($sql7);
  59. $i = 1;
  60. do{
  61. $rowset = $stmt->fetchAll(PDO::FETCH_ASSOC);
  62. if($i==1){
  63. $data['order_ticket_info_list']=$rowset;
  64. }else if ($i==2){
  65. $data['not_in_order_ticket_info_list']=$rowset;
  66. }else{
  67. }
  68. $i++;
  69. }while ($stmt->nextRowset());
  70. }
  71. $stmt->closeCursor();
  72. break;
  73. case 'getRunList':
  74. $PAGE=isset($_GET['currpage'])?$_GET['currpage']:1;
  75. $PAGE_SIZE=isset($_GET['page_size'])?$_GET['page_size']:20;
  76. $START_AREA=isset($_GET['start_area'])?$_GET['start_area']:'';
  77. $END_AREA=isset($_GET['end_area'])?$_GET['end_area']:'';
  78. $LINE=isset($_GET['line'])?$_GET['line']:'';
  79. $START_DATE=isset($_GET['start_date'])?$_GET['start_date']:'';
  80. $END_DATE=isset($_GET['end_date'])?$_GET['end_date']:'';
  81. $RUN_STATUS=isset($_GET['run_status'])?$_GET['run_status']:'';
  82. $BUS_TYPE=isset($_GET['bus_type'])?$_GET['bus_type']:'0';
  83. $BUS_GROUP=isset($_GET['bus_group'])?$_GET['bus_group']:'0';
  84. $PROD_START_LIST = "";
  85. if( $BUS_GROUP != "0" ) {
  86. $sql = " SELECT id,group_name,prod_list,start_time_list FROM line_group_common WHERE id={$BUS_GROUP} ";
  87. $pdo1 = conn();
  88. $stmt1=$pdo1->query($sql);
  89. if( $stmt1 ) {
  90. $rowset = $stmt1->fetchAll(PDO::FETCH_ASSOC);
  91. if( $rowset ) {
  92. $bus_group_info = $rowset[0];
  93. $prod_array = explode("_", $bus_group_info["prod_list"]);
  94. $start_array = explode("_", $bus_group_info["start_time_list"]);
  95. $prod_start_array = array();
  96. foreach( $prod_array as $key => $prod_id) {
  97. $PROD_START_LIST .= $prod_id.",".$start_array[$key]."|";
  98. }
  99. }
  100. $stmt1->closeCursor();
  101. }
  102. }
  103. // $sql6="CALL SP_GET_RUN_LIST(".$USER_ID.",".$PAGE.",".$PAGE_SIZE.",'".$START_AREA."'
  104. // ,'".$END_AREA."','".$LINE."','".$START_DATE."','".$END_DATE.",".$RUN_STATUS.")";
  105. $sql6="CALL SP_GET_RUN_LIST(".$USER_ID.",".$PAGE.",".$PAGE_SIZE.",'".$START_AREA."'
  106. ,'".$END_AREA."','".$LINE."','".$START_DATE."','".$END_DATE."',".$RUN_STATUS.",".$BUS_TYPE.",'".$PROD_START_LIST."')";
  107. if(is_object($pdo)){
  108. $stmt=$pdo->query($sql6);
  109. if($stmt){
  110. $data['code']='0';
  111. $data['info']='';
  112. $data['run_list']= array();
  113. $i = 1;
  114. do{
  115. $rowset = $stmt->fetchAll(PDO::FETCH_ASSOC);
  116. if($i==1){
  117. $data['currpage']=$rowset[0]['currpage'];
  118. $data['total_page']=$rowset[0]['total_page'];
  119. $data['total']=$rowset[0]['total'];
  120. $data['page_size']=$rowset[0]['page_size'];
  121. }else if ($i==2){
  122. $data['run_list']=$rowset;
  123. }else{
  124. }
  125. $i++;
  126. }while ($stmt->nextRowset());
  127. }else{
  128. $data['code']='1';
  129. $data['info']=$sql6;
  130. }
  131. if($stmt){
  132. $stmt->closeCursor();
  133. }
  134. }
  135. $sql = " SELECT id as group_id,group_name from line_group_common WHERE cancel_flag = 0 ";
  136. if(is_object($pdo)){
  137. $stmt=$pdo->query($sql);
  138. $line_group=$stmt->fetchAll(PDO::FETCH_ASSOC);
  139. $stmt->closeCursor();
  140. if(count($line_group)>0){
  141. $data['bus_group_list']=$line_group;
  142. }else{
  143. $data['bus_group_list']=array();
  144. }
  145. }
  146. break;
  147. default:
  148. break;
  149. }
  150. if(is_array($data)){
  151. echo json_encode($data);
  152. }
  153. //$sql1 = "CALL SP_REFRESH_RUN_BUS_STATUS()";
  154. //$result = $pdo->query($sql1);
  155. exit;