No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

195 líneas
6.1 KiB

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