Add: reset active app for maestro experience

This commit is contained in:
2018-08-23 23:55:31 +09:00
parent 9963a28d17
commit efe101babc
2 changed files with 38 additions and 0 deletions
@@ -26,6 +26,8 @@ reset_maestro_sample_player_data($maestro_experience_id);
$count = count_registered_player($maestro_experience_id);
update_count_registered_player($maestro_experience_id, $count);
reset_maestro_active_app_data($maestro_experience_id);
set_data("maestroID", $maestro_experience_id);
set_data("playerID", $maestro_test_player_id);
set_data("playerName", $maestro_test_player_name);
@@ -96,6 +98,41 @@ function get_maestro_test_player_name($player_id) {
return $maestro_test_player_name;
}
function reset_maestro_active_app_data($maestro_id) {
remove_maestro_active_app_data($maestro_id);
add_maestro_active_app_data($maestro_id);
}
function remove_maestro_active_app_data($maestro_id) {
global $db_conn;
$query = "
DELETE
FROM active_app
WHERE MaestroID = ?
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->close();
}
function add_maestro_active_app_data($maestro_id) {
global $db_conn;
$query = "
INSERT INTO active_app (MaestroID, AppID)
SELECT ?, app.AppID
FROM app
WHERE app.Status = 1;
";
$stmt = $db_conn->prepare($query);
$stmt->bind_param("i", $maestro_id);
$stmt->execute();
$stmt->close();
}
function reset_maestro_sample_player_data($maestro_id) {
remove_maestro_sample_player_data($maestro_id);
add_maestro_sample_player_data($maestro_id);
+1
View File
@@ -48,6 +48,7 @@ CREATE TABLE app (
AppName CHAR(40) NOT NULL,
KoreanName CHAR(40) NOT NULL,
AppType INT UNSIGNED NOT NULL,
Status INT UNSIGNED NOT NULL,
HowToPlay TEXT NOT NULL
);