Add: active_app.php
This commit is contained in:
@@ -53,17 +53,34 @@ class DBConnectManager {
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(jsonData != null && jsonData["UserID"] != null)
|
||||
onSucceededListener(jsonData);
|
||||
if(replyJSON != null && replyJSON["UserID"] != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(jsonData);
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
};
|
||||
xhr.send("maestro_name=" + maestroName + "&name=" + userName + "&enter_code=" + enterCode);
|
||||
}
|
||||
|
||||
requestActiveAppList(maestroID, onSucceededListener, onFailedListener) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", this.phpPath + "server/app/active_app.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.length > 0)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
};
|
||||
xhr.send("maestro_id=" + maestroID);
|
||||
}
|
||||
|
||||
requestPlayerHistory(date, listener) {
|
||||
let historyRecordManager = new HistoryRecordManager();
|
||||
|
||||
@@ -85,13 +102,13 @@ class DBConnectManager {
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(jsonData != null) {
|
||||
listener(self.parseJSONtoHistoryRecord(jsonData));
|
||||
if(replyJSON != null) {
|
||||
listener(self.parseJSONtoHistoryRecord(replyJSON));
|
||||
}
|
||||
else
|
||||
onFailedListener(jsonData);
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
};
|
||||
let params = "UserID=" + sessionStorageManager.playerUserID
|
||||
@@ -164,13 +181,13 @@ class DBConnectManager {
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(jsonData != null) {
|
||||
listener(type, self.parseJSONtoRankingRecord(type, jsonData));
|
||||
if(replyJSON != null) {
|
||||
listener(type, self.parseJSONtoRankingRecord(type, replyJSON));
|
||||
}
|
||||
else
|
||||
onFailedListener(jsonData);
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
};
|
||||
let params = "UserID=" + sessionStorageManager.playerUserID
|
||||
@@ -209,34 +226,34 @@ class DBConnectManager {
|
||||
if(typeof json === "undefined")
|
||||
return rankingRecordManager;
|
||||
|
||||
let jsonData = null;
|
||||
let replyJSON = null;
|
||||
switch(type) {
|
||||
case DBConnectManager.TYPE_MY_RANKING_HOUR:
|
||||
case DBConnectManager.TYPE_ALL_RANKING_HOUR:
|
||||
jsonData = json.rankingHour;
|
||||
replyJSON = json.rankingHour;
|
||||
break;
|
||||
|
||||
case DBConnectManager.TYPE_MY_RANKING_DAY:
|
||||
case DBConnectManager.TYPE_ALL_RANKING_DAY:
|
||||
jsonData = json.rankingDay;
|
||||
replyJSON = json.rankingDay;
|
||||
break;
|
||||
|
||||
case DBConnectManager.TYPE_MY_RANKING_MONTH:
|
||||
case DBConnectManager.TYPE_ALL_RANKING_MONTH:
|
||||
jsonData = json.rankingMonth;
|
||||
replyJSON = json.rankingMonth;
|
||||
break;
|
||||
}
|
||||
|
||||
if(jsonData === null)
|
||||
if(replyJSON === null)
|
||||
return rankingRecordManager;
|
||||
|
||||
let count = jsonData.length;
|
||||
let count = replyJSON.length;
|
||||
for(let i = 0; i < count; i++) {
|
||||
let record = new RankingRecord(
|
||||
i + 1,
|
||||
jsonData[i]["UserID"],
|
||||
jsonData[i]["Name"],
|
||||
jsonData[i]["HighScore"]
|
||||
replyJSON[i]["UserID"],
|
||||
replyJSON[i]["Name"],
|
||||
replyJSON[i]["HighScore"]
|
||||
);
|
||||
rankingRecordManager.push(record);
|
||||
}
|
||||
@@ -253,12 +270,12 @@ class DBConnectManager {
|
||||
makeXHRWithParam(url, param, onSucceededListener, onFailedListener) {
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
let jsonData = JSON.parse(xhr.responseText);
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(jsonData != null && jsonData["UserID"] != null)
|
||||
onSucceededListener(jsonData);
|
||||
if(replyJSON != null && replyJSON["UserID"] != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(jsonData);
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user