Add: session storage manager - maestroAccountType, playerAccountType
This commit is contained in:
@@ -32,8 +32,10 @@ let sessionStorageManager = new SessionStorageManager();
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
console.log("maestroID : " + sessionStorageManager.maestroID);
|
console.log("maestroID : " + sessionStorageManager.maestroID);
|
||||||
|
console.log("maestroAccountType : " + sessionStorageManager.maestroAccountType);
|
||||||
console.log("playerName : " + sessionStorageManager.playerName);
|
console.log("playerName : " + sessionStorageManager.playerName);
|
||||||
console.log("playerID : " + sessionStorageManager.playerID);
|
console.log("playerID : " + sessionStorageManager.playerID);
|
||||||
|
console.log("playerAccountType : " + sessionStorageManager.playerAccountType);
|
||||||
console.log("playingAppID : " + sessionStorageManager.playingAppID);
|
console.log("playingAppID : " + sessionStorageManager.playingAppID);
|
||||||
console.log("playingAppName : " + sessionStorageManager.playingAppName);
|
console.log("playingAppName : " + sessionStorageManager.playingAppName);
|
||||||
console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
|
console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ class SessionStorageManager {
|
|||||||
return sessionStorage.getItem("maestroID");
|
return sessionStorage.getItem("maestroID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maestro account type
|
||||||
|
set maestroAccountType(value) {
|
||||||
|
sessionStorage.setItem("maestroAccountType", value);
|
||||||
|
}
|
||||||
|
get maestroAccountType() {
|
||||||
|
return sessionStorage.getItem("maestroAccountType");
|
||||||
|
}
|
||||||
|
|
||||||
// player name
|
// player name
|
||||||
set playerName(value) {
|
set playerName(value) {
|
||||||
sessionStorage.setItem("playerName", value);
|
sessionStorage.setItem("playerName", value);
|
||||||
@@ -35,6 +43,14 @@ class SessionStorageManager {
|
|||||||
return sessionStorage.getItem("playerID");
|
return sessionStorage.getItem("playerID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// player account type
|
||||||
|
set playerAccountType(value) {
|
||||||
|
sessionStorage.setItem("playerAccountType", value);
|
||||||
|
}
|
||||||
|
get playerAccountType() {
|
||||||
|
return sessionStorage.getItem("playerAccountType");
|
||||||
|
}
|
||||||
|
|
||||||
// playing app id
|
// playing app id
|
||||||
set playingAppID(value) {
|
set playingAppID(value) {
|
||||||
sessionStorage.setItem("playingAppID", value);
|
sessionStorage.setItem("playingAppID", value);
|
||||||
|
|||||||
@@ -101,7 +101,9 @@ class Login {
|
|||||||
|
|
||||||
loginSucceeded(jsonData) {
|
loginSucceeded(jsonData) {
|
||||||
sessionStorageManager.maestroID = jsonData['MaestroID'];
|
sessionStorageManager.maestroID = jsonData['MaestroID'];
|
||||||
|
sessionStorageManager.maestroAccountType = jsonData['MaestroAccountType'];
|
||||||
sessionStorageManager.playerID = jsonData['PlayerID'];
|
sessionStorageManager.playerID = jsonData['PlayerID'];
|
||||||
|
sessionStorageManager.playerAccountType = jsonData['PlayerAccountType'];
|
||||||
|
|
||||||
sessionStorageManager.playingAppName = "menu";
|
sessionStorageManager.playingAppName = "menu";
|
||||||
location.href = '../../web/client/menu_app.html';
|
location.href = '../../web/client/menu_app.html';
|
||||||
|
|||||||
@@ -18,16 +18,17 @@
|
|||||||
"maestro_id=" + maestroID,
|
"maestro_id=" + maestroID,
|
||||||
|
|
||||||
(jsonData) => {
|
(jsonData) => {
|
||||||
let playerID = jsonData["playerID"];
|
console.log("maestroAccountType : " + jsonData["maestroAccountType"]);
|
||||||
let playerName = jsonData["playerName"];
|
console.log("playerName : " + jsonData["playerName"]);
|
||||||
|
console.log("playerID : " + jsonData["playerID"]);
|
||||||
|
console.log("playerAccountType : " + jsonData["playerAccountType"]);
|
||||||
|
|
||||||
console.log("playerID : " + playerID);
|
sessionStorage.setItem("maestroAccountType", jsonData["maestroAccountType"]);
|
||||||
console.log("playerName : " + playerName);
|
sessionStorage.setItem("playerID", jsonData["playerID"]);
|
||||||
|
sessionStorage.setItem("playerName", jsonData["playerName"]);
|
||||||
|
sessionStorage.setItem("playerAccountType", jsonData["playerAccountType"]);
|
||||||
|
|
||||||
sessionStorage.setItem("playerID", playerID);
|
// location.href='./../client/menu_app.html';
|
||||||
sessionStorage.setItem("playerName", playerName);
|
|
||||||
|
|
||||||
location.href='./../client/menu_app.html';
|
|
||||||
},
|
},
|
||||||
|
|
||||||
(errorMessage, errorCode) => {
|
(errorMessage, errorCode) => {
|
||||||
|
|||||||
@@ -6,14 +6,10 @@ function loadMaestroTestAccountInfo() {
|
|||||||
"maestro_id=" + maestroID,
|
"maestro_id=" + maestroID,
|
||||||
|
|
||||||
(jsonData) => {
|
(jsonData) => {
|
||||||
let playerID = jsonData["playerID"];
|
// console.log("playerID : " + jsonData["playerID"]);
|
||||||
let playerName = jsonData["playerName"];
|
// console.log("playerName : " + jsonData["playerName"]);
|
||||||
|
sessionStorage.setItem("playerID", jsonData["playerID"]);
|
||||||
console.log("playerID : " + playerID);
|
sessionStorage.setItem("playerName", jsonData["playerName"]);
|
||||||
console.log("playerName : " + playerName);
|
|
||||||
|
|
||||||
sessionStorage.setItem("playerID", playerID);
|
|
||||||
sessionStorage.setItem("playerName", playerName);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
(errorMessage, errorCode) => {
|
(errorMessage, errorCode) => {
|
||||||
@@ -27,8 +23,6 @@ function loadMaestroTestAccountInfo() {
|
|||||||
|
|
||||||
function runMaestroAccountApp() {
|
function runMaestroAccountApp() {
|
||||||
loadMaestroTestAccountInfo();
|
loadMaestroTestAccountInfo();
|
||||||
// window.open("./../client/menu_app.html", "_blank");
|
|
||||||
// menu_app_test_player
|
|
||||||
window.open("./../client/menu_app_test_player.html", "_blank");
|
window.open("./../client/menu_app_test_player.html", "_blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ function login() {
|
|||||||
"maestro_name=" + name + "&password=" + password,
|
"maestro_name=" + name + "&password=" + password,
|
||||||
|
|
||||||
(jsonData) => {
|
(jsonData) => {
|
||||||
maestroID = jsonData["maestroID"];
|
sessionStorage.setItem("maestroID", jsonData["maestroID"]);
|
||||||
sessionStorage.setItem("maestroID", maestroID);
|
sessionStorage.setItem("maestroAccountType", jsonData["maestroAccountType"]);
|
||||||
|
|
||||||
location.href = './../maestro/main_menu.html';
|
location.href = './../maestro/main_menu.html';
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ if($loginData === null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_data("maestroID", $loginData[maestroID]);
|
set_data("maestroID", $loginData[maestroID]);
|
||||||
|
set_data("maestroAccountType", $loginData[accountType]);
|
||||||
set_data("activateStatus", $loginData[activateStatus]);
|
set_data("activateStatus", $loginData[activateStatus]);
|
||||||
set_data("availableActivateDateTime", $loginData[availableActivateDateTime]);
|
set_data("availableActivateDateTime", $loginData[availableActivateDateTime]);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
@@ -76,19 +77,20 @@ function login($maestroName, $password) {
|
|||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
SELECT MaestroID, ActivateStatus, AvailableActivateDateTime
|
SELECT MaestroID, AccountType, ActivateStatus, AvailableActivateDateTime
|
||||||
FROM moty_maestro
|
FROM moty_maestro
|
||||||
WHERE Name = ? AND Password = PASSWORD(?)
|
WHERE Name = ? AND Password = PASSWORD(?)
|
||||||
";
|
";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param("ss", $maestroName, $password);
|
$stmt->bind_param("ss", $maestroName, $password);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($maestroID, $activateStatus, $availableActivateDateTime);
|
$stmt->bind_result($maestroID, $accountType, $activateStatus, $availableActivateDateTime);
|
||||||
// while($stmt->fetch())
|
// while($stmt->fetch())
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
$result["maestroID"] = $maestroID;
|
$result["maestroID"] = $maestroID;
|
||||||
|
$result["maestroAccountType"] = $accountType;
|
||||||
$result["activateStatus"] = $activateStatus;
|
$result["activateStatus"] = $activateStatus;
|
||||||
$result["availableActivateDateTime"] = $availableActivateDateTime;
|
$result["availableActivateDateTime"] = $availableActivateDateTime;
|
||||||
return $result;
|
return $result;
|
||||||
|
|||||||
@@ -7,17 +7,19 @@ include "./../setup/connect_db.php";
|
|||||||
$maestro_id = $_POST["maestro_id"];
|
$maestro_id = $_POST["maestro_id"];
|
||||||
|
|
||||||
|
|
||||||
$maestro_test_player_id = get_maestro_test_player_id($maestro_id);
|
$maestroInfo = get_maestro_test_player_id($maestro_id);
|
||||||
if($maestro_test_player_id === null) {
|
if($maestroInfo === null) {
|
||||||
set_error_message("등록된 마에스트로 테스트 계정이 없습니다");
|
set_error_message("등록된 마에스트로 테스트 계정이 없습니다");
|
||||||
send_result_fail();
|
send_result_fail();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$maestro_test_player_name = get_maestro_test_player_name($maestro_test_player_id);
|
$maestroTestPlayerInfo = get_maestro_test_player_info($maestroInfo["maestroTestID"]);
|
||||||
|
|
||||||
set_data("playerID", $maestro_test_player_id);
|
set_data("maestroAccountType", $maestroInfo["accountType"]);
|
||||||
set_data("playerName", $maestro_test_player_name);
|
set_data("playerID", $maestroInfo["maestroTestID"]);
|
||||||
|
set_data("playerName", $maestroTestPlayerInfo["Name"]);
|
||||||
|
set_data("playerAccountType", $maestroTestPlayerInfo["AccountType"]);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@@ -27,38 +29,46 @@ function get_maestro_test_player_id($maestro_id) {
|
|||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
SELECT MaestroTestID
|
SELECT AccountType, MaestroTestID
|
||||||
FROM moty_maestro
|
FROM moty_maestro
|
||||||
WHERE MaestroID = ?
|
WHERE MaestroID = ?
|
||||||
";
|
";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param("i", $maestro_id);
|
$stmt->bind_param("i", $maestro_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($maestro_test_player_id);
|
$stmt->bind_result($accountType, $maestroTestID);
|
||||||
// while($stmt->fetch()) {
|
// while($stmt->fetch()) {
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
return $maestro_test_player_id;
|
$result["accountType"] = $accountType;
|
||||||
|
$result["maestroTestID"] = $maestroTestID;
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_maestro_test_player_name($player_id) {
|
function get_maestro_test_player_info($player_id) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "SELECT Name FROM moty_player WHERE PlayerID=?";
|
$query = "
|
||||||
|
SELECT Name, AccountType
|
||||||
|
FROM moty_player
|
||||||
|
WHERE PlayerID = ?
|
||||||
|
";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param("i", $player_id);
|
$stmt->bind_param("i", $player_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($maestro_test_player_name);
|
$stmt->bind_result($name, $accountType);
|
||||||
// while($stmt->fetch()) {
|
// while($stmt->fetch()) {
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
return $maestro_test_player_name;
|
$result["Name"] = $name;
|
||||||
|
$result["AccountType"] = $accountType;
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -9,23 +9,31 @@ $name = $_POST["name"];
|
|||||||
$enterCode = $_POST["enter_code"];
|
$enterCode = $_POST["enter_code"];
|
||||||
|
|
||||||
|
|
||||||
$maestroID = get_maestro_id($maestroName);
|
$maestroInfo = get_maestro_id($maestroName);
|
||||||
if($maestroID === null) {
|
if($maestroInfo === null) {
|
||||||
send_error_message($replyJSON, "입력한 마에스트로 계정이 없습니다");
|
send_error_message($replyJSON, "입력한 마에스트로 계정이 없습니다");
|
||||||
$db_conn->close();
|
$db_conn->close();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$playerID = get_login_data($maestroID, $name, $enterCode);
|
$maestroID = $maestroInfo["maestroID"];
|
||||||
if($playerID === null) {
|
$maestroAccountType = $maestroInfo["accountType"];
|
||||||
|
|
||||||
|
$playerInfo = get_login_data($maestroID, $name, $enterCode);
|
||||||
|
if($playerInfo === null) {
|
||||||
send_error_message($replyJSON, "입력한 이름/입장번호와 일치하는 계정이 없습니다");
|
send_error_message($replyJSON, "입력한 이름/입장번호와 일치하는 계정이 없습니다");
|
||||||
$db_conn->close();
|
$db_conn->close();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$playerID = $playerInfo["playerID"];
|
||||||
|
$playerAccountType = $playerInfo["accountType"];
|
||||||
|
|
||||||
|
|
||||||
set_data("MaestroID", $maestroID);
|
set_data("MaestroID", $maestroID);
|
||||||
|
set_data("MaestroAccountType", $maestroAccountType);
|
||||||
set_data("PlayerID", $playerID);
|
set_data("PlayerID", $playerID);
|
||||||
|
set_data("PlayerAccountType", $playerAccountType);
|
||||||
send_result_success();
|
send_result_success();
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@@ -34,43 +42,44 @@ function get_maestro_id($maestroName) {
|
|||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
SELECT MaestroID
|
SELECT MaestroID, AccountType
|
||||||
FROM moty_maestro
|
FROM moty_maestro
|
||||||
WHERE Name = ?
|
WHERE Name = ?
|
||||||
";
|
";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param('s', $maestroName);
|
$stmt->bind_param('s', $maestroName);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($maestroID);
|
$stmt->bind_result($maestroID, $accountType);
|
||||||
// while($stmt->fetch()) {
|
// while($stmt->fetch()) {
|
||||||
// ;
|
// ;
|
||||||
// }
|
// }
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
return $maestroID;
|
$result["maestroID"] = $maestroID;
|
||||||
|
$result["accountType"] = $accountType;
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_login_data($maestroID, $name, $enterCode) {
|
function get_login_data($maestroID, $name, $enterCode) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
SELECT PlayerID
|
SELECT PlayerID, AccountType
|
||||||
FROM moty_player
|
FROM moty_player
|
||||||
WHERE MaestroID = ? AND Name = ? AND EnterCode = ?
|
WHERE MaestroID = ? AND Name = ? AND EnterCode = ?
|
||||||
";
|
";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param('iss', $maestroID, $name, $enterCode);
|
$stmt->bind_param('iss', $maestroID, $name, $enterCode);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($playerID);
|
$stmt->bind_result($playerID, $accountType);
|
||||||
// while($stmt->fetch())
|
// while($stmt->fetch())
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
// $replyJSON["MaestroID"] = $maestroID;
|
$result["playerID"] = $playerID;
|
||||||
// $replyJSON["PlayerID"] = $playerID;
|
$result["accountType"] = $accountType;
|
||||||
|
return $result;
|
||||||
return $playerID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user