diff --git a/src/game/global/global_variables.js b/src/game/global/global_variables.js index b749ede..c92d1ac 100644 --- a/src/game/global/global_variables.js +++ b/src/game/global/global_variables.js @@ -3,7 +3,7 @@ const LANGUAGE_ENGLISH = "english"; const MODE_RELEASE = "release"; const MODE_DEBUG = "debug"; -const runMode = MODE_RELEASE; +const runMode = MODE_DEBUG; function isDebugMode() { // console.log("debug mode ? " + runMode); diff --git a/src/web/server/admin/register_maestro.php b/src/web/server/admin/register_maestro.php index b666d4f..471f69f 100644 --- a/src/web/server/admin/register_maestro.php +++ b/src/web/server/admin/register_maestro.php @@ -31,6 +31,11 @@ if($result === null || $result === 0) { add_default_activated_apps($maestroID); +add_maestro_sample_player_data($maestroID); +$count = count_registered_player($maestroID); +update_count_registered_player($maestroID, $count); + + send_result_success(); exit; @@ -129,4 +134,88 @@ function add_default_activated_apps($maestroID) { } } +function add_maestro_sample_player_data($maestro_id) { + $samplePlayerList = make_sample_player_list($maestro_id); + for($i = 0; $i < count($samplePlayerList); $i++) { + insert_maestro_sample_player_data($maestro_id, $samplePlayerList[$i]); + } +} + + +function insert_maestro_sample_player_data($maestro_id, $player) { + global $db_conn; + + $query = " + INSERT INTO player (MaestroID, Name, EnterCode, AccountType) + VALUES (?, ?, ?, ?) + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("issi", + $maestro_id, + $player["Name"], + $player["EnterCode"], + $player["AccountType"] + ); + $stmt->execute(); + $stmt->close(); +} + +function make_sample_player_list() { + $samplePlayerList = array(); + + $player["Name"] = "050215"; + $player["EnterCode"] = "050215"; + $player["AccountType"] = 0; + array_push($samplePlayerList, $player); + + $player["Name"] = "6-3_이철수"; + $player["EnterCode"] = "1111"; + $player["AccountType"] = 0; + array_push($samplePlayerList, $player); + + $player["Name"] = "3-1김영희"; + $player["EnterCode"] = "0301"; + $player["AccountType"] = 0; + array_push($samplePlayerList, $player); + + $player["Name"] = "홍길동"; + $player["EnterCode"] = "181231"; + $player["AccountType"] = 0; + array_push($samplePlayerList, $player); + + return $samplePlayerList; +} + +function count_registered_player($maestroID) { + global $db_conn; + + $query = " + SELECT COUNT(PlayerID) + FROM player + WHERE MaestroID = ? AND AccountType = 0 + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("i", $maestroID); + $stmt->execute(); + $stmt->bind_result($countPlayer); + // while($stmt->fetch()) + $stmt->fetch(); + $stmt->close(); + + return $countPlayer; +} + +function update_count_registered_player($maestroID, $countPlayer) { + global $db_conn; + + $query = " + UPDATE maestro + SET PlayerCount = ? + WHERE MaestroID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("ii", $countPlayer, $maestroID); + $stmt->execute(); +} + ?> \ No newline at end of file diff --git a/src/web/server/maestro/maestro_experience_account.php b/src/web/server/maestro/maestro_experience_account.php index 387e088..56e0b69 100644 --- a/src/web/server/maestro/maestro_experience_account.php +++ b/src/web/server/maestro/maestro_experience_account.php @@ -155,12 +155,12 @@ function remove_maestro_sample_player_data($maestro_id) { function add_maestro_sample_player_data($maestro_id) { $samplePlayerList = make_sample_player_list($maestro_id); for($i = 0; $i < count($samplePlayerList); $i++) { - insert_maestro_sample_player_data($i, $maestro_id, $samplePlayerList[$i]); + insert_maestro_sample_player_data($maestro_id, $samplePlayerList[$i]); } } -function insert_maestro_sample_player_data($i, $maestro_id, $player) { +function insert_maestro_sample_player_data($maestro_id, $player) { global $db_conn; $query = "