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.
 
 
 
 

59 lines
2.0 KiB

  1. <?php
  2. require_once '../st-xm/Common/Mysql.php';
  3. header("Access-Control-Allow-Origin:*");
  4. $pdo=conn1();
  5. //取得所有的站点信息
  6. $sql3 = " SELECT * FROM base_resource WHERE RES_TYPE_ID=69 ";
  7. $result=$pdo->query($sql3);
  8. $result_array=$result->fetchAll();
  9. $result->closeCursor();
  10. $res_array = array();
  11. $res_id_array = array();
  12. foreach( $result_array as $res_info ) {
  13. $res_array[$res_info["RES_ID"]] = $res_info;
  14. $res_id_array[] = $res_info["RES_ID"];
  15. }
  16. $sql4 = " SELECT * FROM base_resource_matrix WHERE RES_ID IN (".implode(",",$res_id_array).") AND cancel_flag = 0 ";
  17. $result=$pdo->query($sql4);
  18. $result_array=$result->fetchAll();
  19. $result->closeCursor();
  20. $bus_array = array();
  21. $bus_max_line = array();
  22. foreach( $result_array as $seat_info ) {
  23. if( !isset($bus_max_line[$seat_info["RES_ID"]]) ) {
  24. $bus_max_line[$seat_info["RES_ID"]] = 0;
  25. }
  26. if( !isset($bus_array[$seat_info["RES_ID"]]) ) {
  27. $bus_array[$seat_info["RES_ID"]] = array();
  28. }
  29. if( !isset($bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]]) ) {
  30. $bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]] = array();
  31. }
  32. $bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]][$seat_info["POS_X"]] = $seat_info;
  33. $bus_max_line[$seat_info["RES_ID"]] = $bus_max_line[$seat_info["RES_ID"]] < $seat_info["POS_X"] ? $seat_info["POS_X"] : $bus_max_line[$seat_info["RES_ID"]];
  34. }
  35. foreach( $bus_array as $res_id => $bus_info ) {
  36. $bus_info = $bus_array[$res_id];
  37. echo "<B><hr />RES_ID:{$res_id} => {$res_array[$res_id]["RES_NAME"]}<hr /></B>";
  38. echo "<br /><table border='1'>";
  39. foreach( $bus_info as $pos_y => $seat_line ) {
  40. echo "<tr>";
  41. $max_line_seat = $bus_max_line[$res_id];
  42. for( $index_temp = 1;$index_temp <= $max_line_seat; $index_temp++ ) {
  43. $seat_info = isset($seat_line[$index_temp]) ? $seat_line[$index_temp] : array("POS_NAME" => "&#160;&#160;");
  44. echo "<td style='text-align: center;'>".$seat_info["POS_NAME"]."</td>";
  45. }
  46. echo "</tr>";
  47. }
  48. echo "</table>";
  49. echo "<br />";
  50. }
  51. exit();