Fix: ranking record
This commit is contained in:
@@ -111,8 +111,8 @@ class DBConnectManager {
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
};
|
||||
let params = "UserID=" + sessionStorageManager.playerUserID
|
||||
+ "&AppName=" + sessionStorageManager.playingAppName
|
||||
let params = "AppID=" + sessionStorageManager.playingAppID
|
||||
+ "&UserID=" + sessionStorageManager.playerUserID
|
||||
+ "&Date=" + date;
|
||||
xhr.send(params);
|
||||
}
|
||||
@@ -190,8 +190,7 @@ class DBConnectManager {
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
};
|
||||
let params = "UserID=" + sessionStorageManager.playerUserID
|
||||
+ "&AppName=" + sessionStorageManager.playingAppName
|
||||
let params = "AppID=" + sessionStorageManager.playingAppID
|
||||
+ "&Date=" + date
|
||||
+ "&Time=" + time;
|
||||
xhr.send(params);
|
||||
|
||||
@@ -9,8 +9,11 @@ include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$replyJSON = get_active_app_list($maestro_id);
|
||||
$db_conn->close();
|
||||
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "앱 목록 가져오기 실패");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -22,8 +25,6 @@ $db_conn->close();
|
||||
function get_active_app_list($maestro_id) {
|
||||
global $db_conn;
|
||||
|
||||
$return_array = array();
|
||||
|
||||
$query = "
|
||||
SELECT A.AppID, A.AppName, A.AppType
|
||||
FROM moty_app AS A
|
||||
@@ -33,41 +34,16 @@ function get_active_app_list($maestro_id) {
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($app_id, $app_name, $app_type);
|
||||
|
||||
$return_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$row_array['AppID'] = $app_id;
|
||||
$row_array['AppName'] = $app_name;
|
||||
$row_array['AppType'] = $app_type;
|
||||
array_push($return_array, $row_array);
|
||||
}
|
||||
|
||||
$stmt->close();
|
||||
|
||||
return $return_array;
|
||||
|
||||
/*
|
||||
$result = mysqli_query($db_conn, $query);
|
||||
|
||||
if ( $result ) {
|
||||
// echo "조회된 행의 수 : ".mysqli_num_rows($result)."<br />";
|
||||
|
||||
if($result) {
|
||||
$rows = array();
|
||||
while($row = mysqli_fetch_assoc($result)) {
|
||||
// $row_array['Language'] = $row['Language'];
|
||||
$row_array['AppName'] = $row['AppName'];
|
||||
$row_array['AppType'] = $row['AppType'];
|
||||
array_push($return_array, $row_array);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
send_error_code("Error : ".mysqli_error($db_conn));
|
||||
}
|
||||
|
||||
$db_conn->close();
|
||||
mysqli_free_result($result);
|
||||
|
||||
return $return_array;
|
||||
*/
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,43 +1,54 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
include "./../lib/send_error_code.php";
|
||||
include "./../send_error_code.php";
|
||||
|
||||
$app_id = $_POST["AppID"];
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
$date = $_POST["Date"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
// my ranking
|
||||
$query = "
|
||||
SELECT DATE(RecordDateTime) AS Date, MAX(BestRecord) AS HighScore, AppName AS AppName
|
||||
FROM moty_record D
|
||||
WHERE UserID = ? AND DATE(D.DateTime) < DATE(?) AND AppName = ?
|
||||
GROUP BY DATE(DateTime)
|
||||
ORDER BY DateTime ASC
|
||||
LIMIT 7;
|
||||
";
|
||||
$replyJSON = get_history_record($app_id, $user_id, $date);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "히스토리 기록 없음");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('sss', $user_id, $date, $app_name);
|
||||
$stmt->execute();
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
$stmt->bind_result($date, $score, $app_name);
|
||||
|
||||
$history_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
function get_history_record($app_id, $user_id, $date) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName
|
||||
FROM moty_best_record BR
|
||||
INNER JOIN moty_app AS AA
|
||||
ON BR.UserID = ? AND DATE(BR.RecordDateTime) < DATE(?) AND BR.AppID = ? AND BR.AppID = AA.AppID
|
||||
GROUP BY DATE(BR.RecordDateTime)
|
||||
ORDER BY BR.RecordDateTime ASC
|
||||
LIMIT 7
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('isi', $user_id, $date, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($date, $score, $app_name);
|
||||
|
||||
$history_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$history_record['Date'] = $date;
|
||||
$history_record['HighScore'] = $score;
|
||||
$history_record['AppName'] = $app_name;
|
||||
array_push($history_record_array, $history_record);
|
||||
array_push($return_array, $history_record);
|
||||
}
|
||||
$return_array['history'] = $history_record_array;
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
$return_array['history'] = $history_record_array;
|
||||
|
||||
echo json_encode($return_array, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
$db_conn->close();
|
||||
|
||||
?>
|
||||
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
// ranking month
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND MONTH(D.DateTime) = MONTH(NOW()) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND MONTH(D.DateTime) = MONTH('2018-05-18') AND AppName = 'korean_word'
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$score_record['UserID'] = $userID;
|
||||
$score_record['Name'] = $name;
|
||||
$score_record['HighScore'] = $high_score;
|
||||
array_push($score_record_array, $score_record);
|
||||
}
|
||||
$return_array['rankingMonth'] = $score_record_array;
|
||||
|
||||
echo json_encode($return_array, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
|
||||
$db_conn->close();
|
||||
|
||||
?>
|
||||
@@ -1,88 +0,0 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
// ranking hour
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.score) AS HighScore
|
||||
FROM afterschool_record D, afterschool_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(NOW()) AND HOUR(D.DateTime) = HOUR(NOW()) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Record) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $record);
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$score_record['UserID'] = $userID;
|
||||
$score_record['Name'] = $name;
|
||||
$score_record['HighScore'] = $record;
|
||||
array_push($score_record_array, $score_record);
|
||||
}
|
||||
$return_array['rankingHour'] = $score_record_array;
|
||||
|
||||
|
||||
// ranking day
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.record) AS HighScore
|
||||
FROM afterschool_record D, afterschool_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(NOW()) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Record) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $record);
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$score_record['UserID'] = $userID;
|
||||
$score_record['Name'] = $name;
|
||||
$score_record['HighScore'] = $record;
|
||||
array_push($score_record_array, $score_record);
|
||||
}
|
||||
$return_array['rankingDay'] = $score_record_array;
|
||||
|
||||
|
||||
// ranking month
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.record) AS HighScore
|
||||
FROM afterschool_record D, afterschool_user U
|
||||
WHERE D.userID = U.userID AND MONTH(D.DateTime) = MONTH(NOW()) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Record) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('s', $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $record);
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$score_record['UserID'] = $userID;
|
||||
$score_record['Name'] = $name;
|
||||
$score_record['HighScore'] = $record;
|
||||
array_push($score_record_array, $score_record);
|
||||
}
|
||||
$return_array['rankingMonth'] = $score_record_array;
|
||||
|
||||
echo json_encode($return_array, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
|
||||
$db_conn->close();
|
||||
|
||||
?>
|
||||
@@ -3,58 +3,49 @@ header('Content-Type: application/json');
|
||||
|
||||
include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
$app_id = $_POST["AppID"];
|
||||
$date = $_POST["Date"];
|
||||
$time = $_POST["Time"];
|
||||
// $time = $_POST["Time"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
// ranking day
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(NOW()) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE('2018-05-16') AND AppName = 'korean_word'
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(?) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ss', $date, $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$score_record['UserID'] = $userID;
|
||||
$score_record['Name'] = $name;
|
||||
$score_record['HighScore'] = $high_score;
|
||||
array_push($score_record_array, $score_record);
|
||||
$replyJSON = get_ranking_record_day($date, $app_id);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "히스토리 기록 없음");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
$return_array['rankingDay'] = $score_record_array;
|
||||
|
||||
echo json_encode($return_array, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function get_ranking_record_day($date, $app_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_user U
|
||||
WHERE BR.userID = U.userID AND DATE(BR.RecordDateTime) = DATE(?) AND AppID = ?
|
||||
GROUP BY BR.userID
|
||||
ORDER BY max(BR.BestRecord) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('si', $date, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
$ranking_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$ranking_record['UserID'] = $userID;
|
||||
$ranking_record['Name'] = $name;
|
||||
$ranking_record['HighScore'] = $high_score;
|
||||
array_push($ranking_record_array, $ranking_record);
|
||||
}
|
||||
$return_array['rankingDay'] = $ranking_record_array;
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -3,58 +3,50 @@ header('Content-Type: application/json');
|
||||
|
||||
include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
$app_id = $_POST["AppID"];
|
||||
$date = $_POST["Date"];
|
||||
$time = $_POST["Time"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
// ranking hour
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(NOW()) AND HOUR(D.DateTime) = HOUR(NOW()) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE('?') AND HOUR(D.DateTime) = HOUR('?') AND AppName = '?'
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND DATE(D.DateTime) = DATE(?) AND HOUR(D.DateTime) = HOUR(?) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('sss', $date, $time, $app_name);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$score_record['UserID'] = $userID;
|
||||
$score_record['Name'] = $name;
|
||||
$score_record['HighScore'] = $high_score;
|
||||
array_push($score_record_array, $score_record);
|
||||
$replyJSON = get_ranking_record_hour($date, $time, $app_id);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "히스토리 기록 없음");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
$return_array['rankingHour'] = $score_record_array;
|
||||
|
||||
echo json_encode($return_array, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function get_ranking_record_hour($date, $time, $app_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_user U
|
||||
WHERE BR.userID = U.userID AND DATE(BR.RecordDateTime) = DATE(?) AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ?
|
||||
GROUP BY BR.userID
|
||||
ORDER BY max(BR.BestRecord) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ssi', $date, $time, $app_id);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
$ranking_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$ranking_record['UserID'] = $userID;
|
||||
$ranking_record['Name'] = $name;
|
||||
$ranking_record['HighScore'] = $high_score;
|
||||
array_push($ranking_record_array, $ranking_record);
|
||||
}
|
||||
$return_array['rankingHour'] = $ranking_record_array;
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -3,58 +3,50 @@ header('Content-Type: application/json');
|
||||
|
||||
include "./../lib/send_error_code.php";
|
||||
|
||||
$user_id = $_POST["UserID"];
|
||||
$app_name = $_POST["AppName"];
|
||||
$app_id = $_POST["AppID"];
|
||||
$date = $_POST["Date"];
|
||||
$time = $_POST["Time"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
// ranking month
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND MONTH(D.DateTime) = MONTH(NOW()) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
/*
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND MONTH(D.DateTime) = MONTH('2018-05-18') AND AppName = 'korean_word'
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
*/
|
||||
$query = "
|
||||
SELECT D.userID As UserID, U.Name AS Name, MAX(D.Score) AS HighScore
|
||||
FROM moty_record D, moty_user U
|
||||
WHERE D.userID = U.userID AND MONTH(D.DateTime) = MONTH(?) AND AppName = ?
|
||||
GROUP BY D.userID
|
||||
ORDER BY max(D.Score) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ss', $date, $app_name);
|
||||
$stmt->execute();
|
||||
$replyJSON = get_ranking_record_month($date, $time, $app_id);
|
||||
if($replyJSON.length === 0) {
|
||||
send_error_message($replyJSON, "히스토리 기록 없음");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
|
||||
function get_ranking_record_month($date, $time, $app_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT BR.userID As UserID, U.Name AS Name, MAX(BR.BestRecord) AS HighScore
|
||||
FROM moty_best_record BR, moty_user U
|
||||
WHERE BR.userID = U.userID AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ?
|
||||
GROUP BY BR.userID
|
||||
ORDER BY max(BR.BestRecord) DESC;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('si', $date, $app_id);
|
||||
$stmt->execute();
|
||||
|
||||
$stmt->bind_result($userID, $name, $high_score);
|
||||
|
||||
$score_record_array = array();
|
||||
while($stmt->fetch()) {
|
||||
$score_record['UserID'] = $userID;
|
||||
$score_record['Name'] = $name;
|
||||
$score_record['HighScore'] = $high_score;
|
||||
array_push($score_record_array, $score_record);
|
||||
}
|
||||
$return_array['rankingMonth'] = $score_record_array;
|
||||
|
||||
return $return_array;
|
||||
}
|
||||
$return_array['rankingMonth'] = $score_record_array;
|
||||
|
||||
echo json_encode($return_array, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
|
||||
$db_conn->close();
|
||||
|
||||
?>
|
||||
@@ -21,12 +21,14 @@ include "./../setup/connect_db.php";
|
||||
$maestro_id = get_maestro_id($maestro_name);
|
||||
if($maestro_id == null) {
|
||||
send_error_message($replyJSON, "입력한 마에스트로 계정이 없습니다");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON = get_login_data($maestro_id, $name, $enterCode);
|
||||
if($replyJSON["UserID"] == null) {
|
||||
send_error_message($replyJSON, "입력한 이름/입장번호와 일치하는 계정이 없습니다");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ QUnit.test( "User login", function( assert ) {
|
||||
let done = assert.async();
|
||||
setTimeout(function() {
|
||||
dbConnectManager.requestCheckUserLogin(
|
||||
"test", "111111",
|
||||
"jisangs", "test", "111111",
|
||||
(jsonData) => {
|
||||
returnPlayerID = jsonData["UserID"];
|
||||
assert.equal(returnPlayerID, 31);
|
||||
@@ -25,7 +25,7 @@ QUnit.test( "User login", function( assert ) {
|
||||
|
||||
QUnit.test( "Player history", function( assert ) {
|
||||
sessionStorageManager.playerUserID = "8"; // 부현율
|
||||
sessionStorageManager.playingAppName = "korean_word";
|
||||
sessionStorageManager.playingAppID = 9;
|
||||
let date = "2018-05-16";
|
||||
|
||||
let done = assert.async();
|
||||
@@ -33,6 +33,8 @@ QUnit.test( "Player history", function( assert ) {
|
||||
dbConnectManager.requestPlayerHistory(
|
||||
date,
|
||||
(historyRecordManager) => {
|
||||
console.log(historyRecordManager);
|
||||
|
||||
assert.equal(historyRecordManager.getAppNameAt(0), "korean_word");
|
||||
assert.equal(historyRecordManager.getDateAt(0), "2018-04-18");
|
||||
assert.equal(historyRecordManager.getScoreAt(0), 51.6102);
|
||||
@@ -48,7 +50,8 @@ QUnit.test( "Player history", function( assert ) {
|
||||
});
|
||||
|
||||
QUnit.test( "Player ranking", function( assert ) {
|
||||
sessionStorageManager.playingAppName = "korean_word";
|
||||
sessionStorageManager.playingAppID = 9;
|
||||
// sessionStorageManager.playingAppName = "korean_word";
|
||||
let date = "2018-05-16";
|
||||
let time = "14:50:00";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user