Add: active_app.php

This commit is contained in:
2018-05-29 17:13:12 +09:00
parent dbc19572a7
commit 72ea114cc8
12 changed files with 223 additions and 144 deletions
+1
View File
@@ -21,6 +21,7 @@
<script src="../../game/lib/fullscreen_button.js"></script>
<script src="../../game/lib/app_button.js"></script>
<script src="../../game/lib/screen_bottom.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script>
<!-- source files -->
<script src="../../game/menu/menu_app.js"></script>
+46
View File
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>메뉴</title>
<!-- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script> -->
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.2/phaser.js"></script> -->
<script src="../../../resources/js/phaser.min.js"></script>
<!-- global source files -->
<script src="../../game/lib/app_info_manager.js"></script>
<script src="../../game/lib/session_storage_manager.js"></script>
<script src="../../game/global/global_variables.js"></script>
<!-- library source files -->
<script src="../../game/lib/input_type_text.js"></script>
<script src="../../game/lib/round_rect_button.js"></script>
<script src="../../game/lib/back_button.js"></script>
<script src="../../game/lib/fullscreen_button.js"></script>
<script src="../../game/lib/app_button.js"></script>
<script src="../../game/lib/screen_bottom.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script>
<!-- source files -->
<script src="../../game/menu/menu_app.js"></script>
<script src="../../game/menu/main_menu_app.js"></script>
<style>
body{
padding: 0;
margin: 0;
}
canvas{
margin: 0 auto;
}
</style>
</head>
<body>
<div id="MenuApp" style="text-align:center;" />
</body>
</html>
@@ -1,38 +0,0 @@
<?php
header('Content-Type: application/json');
include "send_error_code.php";
include "connect_db.php";
$return_array = array();
$query = "SELECT * FROM afterschool_activated_stage";
$result = mysqli_query($db_conn, $query);
$return_array = array();
if ( $result ) {
// echo "조회된 행의 수 : ".mysqli_num_rows($result)."<br />";
if($result) {
$rows = array();
while($row = mysqli_fetch_assoc($result)) {
// $row_array['Language'] = $row['Language'];
$row_array['StageName'] = $row['StageName'];
$row_array['Activated'] = $row['Activated'];
array_push($return_array, $row_array);
}
}
} else {
send_error_code("Error : ".mysqli_error($db_conn));
}
echo json_encode($return_array, JSON_UNESCAPED_UNICODE);
// 결과 해제
mysqli_free_result($result);
$db_conn->close();
?>
+72
View File
@@ -0,0 +1,72 @@
<?php
header('Content-Type: application/json');
include "./../send_error_code.php";
$maestro_id = $_POST["maestro_id"];
include "./../setup/connect_db.php";
$replyJSON = get_active_app_list($maestro_id);
if($replyJSON.length === 0) {
send_error_message($replyJSON, "앱 목록 가져오기 실패");
exit;
}
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
function get_active_app_list($maestro_id) {
global $db_conn;
$return_array = array();
$query = "
SELECT A.AppName, A.AppType
FROM moty_app AS A
INNER JOIN moty_active_app AS AA ON A.AppID = AA.AppID AND AA.MaestroID=?";
$stmt = $db_conn->prepare($query);
$stmt->bind_param('i', $maestro_id);
$stmt->execute();
$stmt->bind_result($app_name, $app_type);
while($stmt->fetch()) {
$row_array['AppName'] = $app_name;
$row_array['AppType'] = $app_type;
array_push($return_array, $row_array);
}
$stmt->close();
return $return_array;
/*
$result = mysqli_query($db_conn, $query);
if ( $result ) {
// echo "조회된 행의 수 : ".mysqli_num_rows($result)."<br />";
if($result) {
$rows = array();
while($row = mysqli_fetch_assoc($result)) {
// $row_array['Language'] = $row['Language'];
$row_array['AppName'] = $row['AppName'];
$row_array['AppType'] = $row['AppType'];
array_push($return_array, $row_array);
}
}
} else {
send_error_code("Error : ".mysqli_error($db_conn));
}
$db_conn->close();
mysqli_free_result($result);
return $return_array;
*/
}
?>
+1
View File
@@ -24,6 +24,7 @@ $result = mysqli_query($db_conn, $query);
function send_error_message($replyJSON, $error_message) {
$replyJSON["ERROR"] = $error_message;
$db_conn->close();
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
}
+1 -2
View File
@@ -31,7 +31,7 @@ if($replyJSON["UserID"] == null) {
}
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
$db_conn->close();
function get_maestro_id($maestro_name) {
@@ -62,7 +62,6 @@ function get_login_data($maestro_id, $name, $enterCode) {
// while($stmt->fetch())
$stmt->fetch();
$stmt->close();
$db_conn->close();
$replyJSON["MaestroID"] = $maestro_id;
$replyJSON["UserID"] = $user_id;
+1 -1
View File
@@ -26,7 +26,7 @@ INSERT INTO moty_app VALUES
INSERT INTO moty_activate_app VALUES
INSERT INTO moty_active_app VALUES
(1, 1, 1),
(2, 1, 9),
(3, 1, 10),
+2 -2
View File
@@ -27,8 +27,8 @@ CREATE TABLE moty_app (
AppType INT UNSIGNED NOT NULL
);
CREATE TABLE moty_activate_app (
ActivateAppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
CREATE TABLE moty_active_app (
ActiveAppID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
MaestroID INT UNSIGNED NOT NULL,
AppID INT UNSIGNED NOT NULL,