Add: edit player enter_code

This commit is contained in:
2019-03-15 12:31:44 +09:00
parent 703d381e79
commit 0cbf30481b
3 changed files with 73 additions and 4 deletions
+17
View File
@@ -79,6 +79,23 @@ DBConnectManager.prototype.requestPlayerEnterCode = function(maestroID, playerID
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
}
DBConnectManager.prototype.requestEditPlayerEnterCode = function(maestroID, playerID, enterCode, onSucceededListener, onFailedListener) {
var xhr = new XMLHttpRequest();
xhr.open("POST", this.phpPath + "server/player/edit_entercode.php", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
var replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null && replyJSON["result"] == "success")
onSucceededListener(replyJSON);
else
onFailedListener(replyJSON);
}
};
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID + "&enter_code=" + enterCode);
}
/*
DBConnectManager.prototype.requestAppList = function(maestroID, onSucceededListener, onFailedListener) {
var xhr = new XMLHttpRequest();
+19 -4
View File
@@ -154,13 +154,27 @@ var Setup = {
}
var accountValidator = new AccountValidator();
if(accountValidator.isValidPlayerPW(newEnterCode)) {
this.showInfoText("입장번호를 바꾸겠습니다.");
} else {
if(!accountValidator.isValidPlayerPW(newEnterCode)) {
var errorMessage = accountValidator.messageForInvalidPlayerPW(newEnterCode);
this.showInfoText(errorMessage);
}
this.showInfoText("입장번호를 바꾸겠습니다.");
var dbConnectManager = new DBConnectManager();
dbConnectManager.requestEditPlayerEnterCode(
sessionStorageManager.getMaestroID(),
sessionStorageManager.getPlayerID(),
newEnterCode,
(function(jsonData) {
// this.loginSucceeded(jsonData);
this.showInfoText("새로 입력하신 [ " + jsonData["EnterCode"] + " ]로 입장번호가 변경되었습니다.")
this.loadPrevEnterCode();
}).bind(this),
(function(jsonData) {
// this.loginFailed(jsonData);
this.showInfoText("입장번호 변경에 실패하였습니다.")
}).bind(this)
);
/*
var maestroName = this.inputTextMaestroName.canvasInput._value;
sessionStorageManager.setPlayerName(this.inputTextName.canvasInput._value);
@@ -204,7 +218,6 @@ var Setup = {
sessionStorageManager.getPlayerID(),
(function(jsonData) {
this.prevEnterCode = jsonData['EnterCode'];
console.log(this.prevEnterCode);
this.prevEnterCodeText.text = this.prevEnterCode;
}).bind(this),
(function(jsonData) {
@@ -214,6 +227,7 @@ var Setup = {
);
},
/*
loginSucceeded: function(jsonData) {
sessionStorageManager.setMaestroID(jsonData['MaestroID']);
sessionStorageManager.setMaestroAccountType(jsonData['MaestroAccountType']);
@@ -238,5 +252,6 @@ var Setup = {
this.infoText.text = jsonData["error"];
}
}
*/
}