From dc87390b8cd9458ecfbb2b19c96925684728edba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=A2=E1=84=91=E1=85=B3=E1=86=AF=20=E1=84=82?= =?UTF-8?q?=E1=85=A9=E1=84=90=E1=85=B3=E1=84=87=E1=85=AE=E1=86=A8?= Date: Wed, 4 Jul 2018 21:54:29 +0900 Subject: [PATCH] Fix: DB user column -> player --- src/game/global/global_variables.js | 4 +-- src/game/lib/db_connect_manager.js | 28 +++++++++---------- src/game/lib/ranking_record_manager.js | 14 +++++----- src/game/lib/session_storage_manager.js | 12 ++++---- src/game/login/login.js | 7 +++-- src/game/result/ranking_board.js | 10 +++---- src/game/result/result.js | 2 +- src/game/start/start.js | 2 +- src/web/js/player_list.js | 2 +- src/web/js/player_list_manager.js | 16 +++++------ .../module/maestro_section_add_player.html | 6 ++-- .../server/{user => player}/add_player.php | 9 +++--- .../server/{user => player}/delete_player.php | 16 +++++------ .../server/{user => player}/edit_player.php | 16 +++++------ src/web/server/{user => player}/login.php | 8 +++--- .../registered_player_count.php | 6 ++-- .../registered_player_list.php | 8 +++--- .../{user => player}/search_player_count.php | 6 ++-- .../{user => player}/search_player_list.php | 8 +++--- src/web/server/record/history_record.php | 10 +++---- src/web/server/record/ranking_record_day.php | 12 ++++---- src/web/server/record/ranking_record_hour.php | 12 ++++---- .../server/record/ranking_record_month.php | 12 ++++---- src/web/server/record/request_best_record.php | 10 +++---- src/web/server/record/update_best_record.php | 20 ++++++------- src/web/sql/make_db.sql | 8 +++--- 26 files changed, 132 insertions(+), 132 deletions(-) rename src/web/server/{user => player}/add_player.php (85%) rename src/web/server/{user => player}/delete_player.php (84%) rename src/web/server/{user => player}/edit_player.php (80%) rename src/web/server/{user => player}/login.php (88%) rename src/web/server/{user => player}/registered_player_count.php (87%) rename src/web/server/{user => player}/registered_player_list.php (85%) rename src/web/server/{user => player}/search_player_count.php (87%) rename src/web/server/{user => player}/search_player_list.php (86%) diff --git a/src/game/global/global_variables.js b/src/game/global/global_variables.js index 3b0e9cd..65ab000 100644 --- a/src/game/global/global_variables.js +++ b/src/game/global/global_variables.js @@ -24,7 +24,7 @@ let sessionStorageManager = new SessionStorageManager(); { // if(isDebugMode()) { // sessionStorageManager.playerName = "부현율"; - // sessionStorageManager.playerUserID = 8; + // sessionStorageManager.playerID = 8; // sessionStorageManager.playingAppID = 101; // sessionStorageManager.playingAppName = "space_invaders"; // sessionStorageManager.score = 1000; @@ -33,7 +33,7 @@ let sessionStorageManager = new SessionStorageManager(); console.log("maestroID : " + sessionStorageManager.maestroID); console.log("playerName : " + sessionStorageManager.playerName); - console.log("playerUserID : " + sessionStorageManager.playerUserID); + console.log("playerID : " + sessionStorageManager.playerID); console.log("playingAppID : " + sessionStorageManager.playingAppID); console.log("playingAppName : " + sessionStorageManager.playingAppName); console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName); diff --git a/src/game/lib/db_connect_manager.js b/src/game/lib/db_connect_manager.js index f2940e4..c496dba 100644 --- a/src/game/lib/db_connect_manager.js +++ b/src/game/lib/db_connect_manager.js @@ -6,7 +6,7 @@ class DBConnectManager { this.phpPath = this.getPHPPath(this.directoryName); this.maestroID = 0; - this.playerUserID = 0; + this.playerID = 0; this.appName = ""; this.dateAndTime = null; } @@ -15,8 +15,8 @@ class DBConnectManager { this.maestroID = maestroID; } - setPlayerID(userID) { - this.playerUserID = userID; + setPlayerID(playerID) { + this.playerID = playerID; } setAppName(appName) { @@ -47,21 +47,21 @@ class DBConnectManager { return "../"; } - requestCheckUserLogin(maestroName, userName, enterCode, onSucceededListener, onFailedListener) { + requestCheckPlayerLogin(maestroName, playerName, enterCode, onSucceededListener, onFailedListener) { let xhr = new XMLHttpRequest(); - xhr.open("POST", this.phpPath + "server/user/login.php", true); + xhr.open("POST", this.phpPath + "server/player/login.php", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200) { let replyJSON = JSON.parse(xhr.responseText); - if(replyJSON != null && replyJSON["UserID"] != null) + if(replyJSON != null && replyJSON["PlayerID"] != null) onSucceededListener(replyJSON); else onFailedListener(replyJSON); } }; - xhr.send("maestro_name=" + maestroName + "&name=" + userName + "&enter_code=" + enterCode); + xhr.send("maestro_name=" + maestroName + "&name=" + playerName + "&enter_code=" + enterCode); } /* @@ -182,7 +182,7 @@ class DBConnectManager { }; let params = "MaestroID=" + sessionStorageManager.maestroID + "&AppID=" + sessionStorageManager.playingAppID - + "&UserID=" + sessionStorageManager.playerUserID + + "&PlayerID=" + sessionStorageManager.playerID + "&Date=" + date; xhr.send(params); } @@ -321,7 +321,7 @@ class DBConnectManager { for(let i = 0; i < count; i++) { let record = new RankingRecord( i + 1, - replyJSON[i]["UserID"], + replyJSON[i]["PlayerID"], replyJSON[i]["Name"], replyJSON[i]["HighScore"] ); @@ -342,7 +342,7 @@ class DBConnectManager { if(xhr.readyState == 4 && xhr.status == 200) { let replyJSON = JSON.parse(xhr.responseText); - if(replyJSON != null && replyJSON["UserID"] != null) + if(replyJSON != null && replyJSON["PlayerID"] != null) onSucceededListener(replyJSON); else onFailedListener(replyJSON); @@ -369,19 +369,19 @@ class DBConnectManager { xhr.send("AppID=" + appID); } - updateTodayBestRecord(maestroID, userID, appID, record) { + updateTodayBestRecord(maestroID, playerID, appID, record) { let xhr = new XMLHttpRequest(); xhr.open("POST", this.phpPath + "server/record/update_best_record.php", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send( "MaestroID=" + maestroID - + "&UserID=" + userID + + "&PlayerID=" + playerID + "&AppID=" + appID + "&BestRecord=" + record ); } - requestTodayBestRecord(maestroID, userID, appID, onSucceededListener, onFailedListener) { + requestTodayBestRecord(maestroID, playerID, appID, onSucceededListener, onFailedListener) { let xhr = new XMLHttpRequest(); xhr.open("POST", this.phpPath + "server/record/request_best_record.php", true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); @@ -397,7 +397,7 @@ class DBConnectManager { }; xhr.send( "MaestroID=" + maestroID - + "&UserID=" + userID + + "&PlayerID=" + playerID + "&AppID=" + appID ); } diff --git a/src/game/lib/ranking_record_manager.js b/src/game/lib/ranking_record_manager.js index b7f0896..c2ca5d1 100644 --- a/src/game/lib/ranking_record_manager.js +++ b/src/game/lib/ranking_record_manager.js @@ -1,9 +1,9 @@ class RankingRecord { - constructor(rank, userID, userName, bestRecord) { + constructor(rank, playerID, playerName, bestRecord) { this.rank = rank; - this.userID = userID; - this.userName = userName; + this.playerID = playerID; + this.playerName = playerName; this.bestRecord = bestRecord; } } @@ -36,12 +36,12 @@ class RankingRecordManager { return this.rankingRecords[index].rank; } - getUserIDAt(index) { - return this.rankingRecords[index].userID; + getPlayerIDAt(index) { + return this.rankingRecords[index].playerID; } - getUserNameAt(index) { - return this.rankingRecords[index].userName; + getPlayerNameAt(index) { + return this.rankingRecords[index].playerName; } getBestRecordAt(index) { diff --git a/src/game/lib/session_storage_manager.js b/src/game/lib/session_storage_manager.js index e09256d..4b43083 100644 --- a/src/game/lib/session_storage_manager.js +++ b/src/game/lib/session_storage_manager.js @@ -11,7 +11,7 @@ class SessionStorageManager { return sessionStorage.removeItem(key); } - // maestro user ID + // maestro ID set maestroID(value) { sessionStorage.setItem("maestroID", value); } @@ -27,12 +27,12 @@ class SessionStorageManager { return sessionStorage.getItem("playerName"); } - // player user ID - set playerUserID(value) { - sessionStorage.setItem("playerUserID", value); + // player player ID + set playerID(value) { + sessionStorage.setItem("playerID", value); } - get playerUserID() { - return sessionStorage.getItem("playerUserID"); + get playerID() { + return sessionStorage.getItem("playerID"); } // playing app id diff --git a/src/game/login/login.js b/src/game/login/login.js index fa78c57..7370523 100644 --- a/src/game/login/login.js +++ b/src/game/login/login.js @@ -90,7 +90,7 @@ class Login { let enterCode = self.inputTextEnterCode.canvasInput._value; let dbConnectManager = new DBConnectManager(); - dbConnectManager.requestCheckUserLogin( + dbConnectManager.requestCheckPlayerLogin( maestroName, sessionStorageManager.playerName, enterCode, @@ -101,10 +101,13 @@ class Login { loginSucceeded(jsonData) { sessionStorageManager.maestroID = jsonData['MaestroID']; - sessionStorageManager.playerUserID = jsonData['UserID']; + sessionStorageManager.playerID = jsonData['PlayerID']; sessionStorageManager.playingAppName = "menu"; location.href = '../../web/client/menu_app.html'; + + // console.log("===== after login ====="); + // console.log(sessionStorageManager.playerID); } loginFailed(jsonData) { diff --git a/src/game/result/ranking_board.js b/src/game/result/ranking_board.js index 3ed4212..f89ab47 100644 --- a/src/game/result/ranking_board.js +++ b/src/game/result/ranking_board.js @@ -37,12 +37,12 @@ class RankingBoard { } getMyRank(rankingRecordManager) { - let playerUserID = Number(sessionStorageManager.playerUserID); + let playerID = Number(sessionStorageManager.playerID); for(let i = 0; i < rankingRecordManager.count; i++) { let data = rankingRecordManager.getAt(i); - let userID = Number(data["userID"]); - if(userID === playerUserID) + let playerIDNo = Number(data["playerID"]); + if(playerIDNo === playerID) return i + 1; } @@ -109,8 +109,8 @@ class RankingBoard { .setTextBounds(0, 0, 40, 40) .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); - // user name - game.add.text(this.getPosX(type) + 60, this.getPosY(index), data.userName, style) + // player name + game.add.text(this.getPosX(type) + 60, this.getPosY(index), data.playerName, style) .setTextBounds(0, 0, 60, 60) .setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2); diff --git a/src/game/result/result.js b/src/game/result/result.js index 327cd73..9089a41 100644 --- a/src/game/result/result.js +++ b/src/game/result/result.js @@ -86,7 +86,7 @@ class Result { uploadRecord() { this.dbConnectManager.updateTodayBestRecord( sessionStorageManager.maestroID, - sessionStorageManager.playerUserID, + sessionStorageManager.playerID, sessionStorageManager.playingAppID, sessionStorageManager.record ); diff --git a/src/game/start/start.js b/src/game/start/start.js index b2af60b..7c552fc 100644 --- a/src/game/start/start.js +++ b/src/game/start/start.js @@ -73,7 +73,7 @@ class Start { this.dbConnectManager.requestTodayBestRecord( sessionStorageManager.maestroID, - sessionStorageManager.playerUserID, + sessionStorageManager.playerID, sessionStorageManager.playingAppID, replyJSON => { sessionStorageManager.bestRecord = Number(replyJSON["BestRecord"]); diff --git a/src/web/js/player_list.js b/src/web/js/player_list.js index b43f7a4..7dba2d0 100644 --- a/src/web/js/player_list.js +++ b/src/web/js/player_list.js @@ -69,7 +69,7 @@ class PlayerList { $(this.listRows[i].playerID).empty(); if(i < jsonData.length) { - $(this.listRows[i].playerID).append(jsonData[i]["UserID"]); + $(this.listRows[i].playerID).append(jsonData[i]["PlayerID"]); $(this.listRows[i].playerName).val(jsonData[i]["Name"]); $(this.listRows[i].enterCode).val(jsonData[i]["EnterCode"]); diff --git a/src/web/js/player_list_manager.js b/src/web/js/player_list_manager.js index fd5860c..48d289c 100644 --- a/src/web/js/player_list_manager.js +++ b/src/web/js/player_list_manager.js @@ -21,7 +21,7 @@ let self = this; let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/registered_player_count.php', true); + xhr.open('POST', './../server/player/registered_player_count.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID); xhr.onload = function() { @@ -70,7 +70,7 @@ let endNo = pageIndex * 10 + 9; let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/registered_player_list.php', true); + xhr.open('POST', './../server/player/registered_player_list.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo); xhr.onload = function() { @@ -119,7 +119,7 @@ let endNo = pageIndex * 10 + 9; let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/registered_player_list.php', true); + xhr.open('POST', './../server/player/registered_player_list.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID + "&start_no=" + startNo + "&end_no=" + endNo); xhr.onload = function() { @@ -153,7 +153,7 @@ self.list.updatePlayerList(replyJSON["PlayerList"]); self.playerCount = replyJSON["PlayerList"].length; - console.log(self.playerCount); + // console.log(self.playerCount); // self.lastPageNo = Math.ceil( (self.playerCount + 1) / 10 ); // self.activePageNo = 1; @@ -168,7 +168,7 @@ let self = this; let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/search_player_count.php', true); + xhr.open('POST', './../server/player/search_player_count.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName); xhr.onload = function() { @@ -216,7 +216,7 @@ let endNo = pageIndex * 10 + 9; let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/search_player_list.php', true); + xhr.open('POST', './../server/player/search_player_list.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&start_no=" + startNo + "&end_no=" + endNo); xhr.onload = function() { @@ -306,7 +306,7 @@ // console.log(playerEnterCode); let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/edit_player.php', true); + xhr.open('POST', './../server/player/edit_player.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID + "&player_name=" + playerName + "&enter_code=" + playerEnterCode); xhr.onload = function() { @@ -359,7 +359,7 @@ return; let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/delete_player.php', true); + xhr.open('POST', './../server/player/delete_player.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID); xhr.onload = function() { diff --git a/src/web/module/maestro_section_add_player.html b/src/web/module/maestro_section_add_player.html index 59cae42..82e55da 100644 --- a/src/web/module/maestro_section_add_player.html +++ b/src/web/module/maestro_section_add_player.html @@ -25,7 +25,7 @@ function addPlayer() { } let xhr = new XMLHttpRequest(); //new로 생성. - xhr.open('POST', './../server/user/add_player.php', true); + xhr.open('POST', './../server/player/add_player.php', true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.send("maestro_id=" + maestroID + "&player_name=" + playerName + "&enter_code=" + enterCode); xhr.onload = function() { @@ -84,14 +84,14 @@ function addPlayer() {