|
- <?php
- require_once '../st-xm/Common/Mysql.php';
- header("Access-Control-Allow-Origin:*");
-
- $pdo=conn1();
- //取得所有的站点信息
- $sql3 = " SELECT * FROM base_resource WHERE RES_TYPE_ID=69 ";
- $result=$pdo->query($sql3);
- $result_array=$result->fetchAll();
- $result->closeCursor();
- $res_array = array();
- $res_id_array = array();
- foreach( $result_array as $res_info ) {
- $res_array[$res_info["RES_ID"]] = $res_info;
- $res_id_array[] = $res_info["RES_ID"];
- }
-
- $sql4 = " SELECT * FROM base_resource_matrix WHERE RES_ID IN (".implode(",",$res_id_array).") AND cancel_flag = 0 ";
- $result=$pdo->query($sql4);
- $result_array=$result->fetchAll();
- $result->closeCursor();
- $bus_array = array();
-
- $bus_max_line = array();
- foreach( $result_array as $seat_info ) {
- if( !isset($bus_max_line[$seat_info["RES_ID"]]) ) {
- $bus_max_line[$seat_info["RES_ID"]] = 0;
- }
- if( !isset($bus_array[$seat_info["RES_ID"]]) ) {
- $bus_array[$seat_info["RES_ID"]] = array();
- }
- if( !isset($bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]]) ) {
- $bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]] = array();
- }
- $bus_array[$seat_info["RES_ID"]][$seat_info["POS_Y"]][$seat_info["POS_X"]] = $seat_info;
- $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"]];
- }
-
- foreach( $bus_array as $res_id => $bus_info ) {
- $bus_info = $bus_array[$res_id];
- echo "<B><hr />RES_ID:{$res_id} => {$res_array[$res_id]["RES_NAME"]}<hr /></B>";
- echo "<br /><table border='1'>";
- foreach( $bus_info as $pos_y => $seat_line ) {
-
- echo "<tr>";
- $max_line_seat = $bus_max_line[$res_id];
- for( $index_temp = 1;$index_temp <= $max_line_seat; $index_temp++ ) {
- $seat_info = isset($seat_line[$index_temp]) ? $seat_line[$index_temp] : array("POS_NAME" => "  ");
- echo "<td style='text-align: center;'>".$seat_info["POS_NAME"]."</td>";
- }
- echo "</tr>";
- }
- echo "</table>";
- echo "<br />";
- }
-
-
-
- exit();
|