Add: add sample player data for creating maestroID
This commit is contained in:
@@ -3,7 +3,7 @@ const LANGUAGE_ENGLISH = "english";
|
|||||||
|
|
||||||
const MODE_RELEASE = "release";
|
const MODE_RELEASE = "release";
|
||||||
const MODE_DEBUG = "debug";
|
const MODE_DEBUG = "debug";
|
||||||
const runMode = MODE_RELEASE;
|
const runMode = MODE_DEBUG;
|
||||||
|
|
||||||
function isDebugMode() {
|
function isDebugMode() {
|
||||||
// console.log("debug mode ? " + runMode);
|
// console.log("debug mode ? " + runMode);
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ if($result === null || $result === 0) {
|
|||||||
|
|
||||||
add_default_activated_apps($maestroID);
|
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();
|
send_result_success();
|
||||||
exit;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -155,12 +155,12 @@ function remove_maestro_sample_player_data($maestro_id) {
|
|||||||
function add_maestro_sample_player_data($maestro_id) {
|
function add_maestro_sample_player_data($maestro_id) {
|
||||||
$samplePlayerList = make_sample_player_list($maestro_id);
|
$samplePlayerList = make_sample_player_list($maestro_id);
|
||||||
for($i = 0; $i < count($samplePlayerList); $i++) {
|
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;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
|
|||||||
Reference in New Issue
Block a user