diff --git a/src/web/admin/admin_send_email.html b/src/web/admin/admin_send_email.html
index 1a18e5a..374b892 100644
--- a/src/web/admin/admin_send_email.html
+++ b/src/web/admin/admin_send_email.html
@@ -109,6 +109,53 @@
);
}
+ function sendMailUpdateMaestroName() {
+ var maestroNamePrev = "삼화초전전전";
+ var maestroName = "삼화초후후후";
+ var email = "jisangs@daum.net";
+
+ sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
+ // "./../server/mail/send_mail_bank_info.php",
+ "./../server/mail/send_mail_test.php",
+ "type=sendMailUpdateMaestroName" + "&maestro_name=" + maestroName + "&maestro_name_prev=" + maestroNamePrev + "&email=" + email,
+
+ function(jsonData) {
+ console.log(jsonData);
+ // showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
+ // loadMaestroList("");
+ },
+
+ function(errorMessage, errorCode) {
+ showErrorMessage(errorMessage, "error");
+ }
+
+ );
+ }
+
+ function sendMailUpdateMaestroEmail() {
+ var maestroName = "삼화초";
+ var emailPrev = "jisangs@daum.net";
+ var email = encodeURIComponent("support+chocomae.automail@jinaju.com"); // "jisangs@gmail.com";
+
+ sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
+ // "./../server/mail/send_mail_bank_info.php",
+ "./../server/mail/send_mail_test.php",
+ "type=sendMailUpdateMaestroEmail" + "&maestro_name=" + maestroName + "&email=" + email + "&email_prev=" + emailPrev,
+
+ function(jsonData) {
+ console.log(jsonData);
+ // showErrorMessage("마에스트로 계정이 정상적으로 등록되었습니다.", "success");
+ // loadMaestroList("");
+ },
+
+ function(errorMessage, errorCode) {
+ showErrorMessage(errorMessage, "error");
+ }
+
+ );
+ }
+
+
function getMaestroData() {
var maestroID = 1;
var maestroName = "삼화초";
@@ -162,6 +209,12 @@
+
+
+
+
+
+
diff --git a/src/web/module/maestro_section_register.html b/src/web/module/maestro_section_register.html
index 1ff4913..2941d19 100644
--- a/src/web/module/maestro_section_register.html
+++ b/src/web/module/maestro_section_register.html
@@ -164,7 +164,7 @@ function register_account() {
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/add_maestro.php",
- "maestro_name=" + maestroName + "&password=" + password + "&email=" + email + "&account_type=" + selectedAccountTypeValue,
+ "maestro_name=" + maestroName + "&password=" + password + "&email=" + encodeURIComponent(email) + "&account_type=" + selectedAccountTypeValue,
(function(jsonData) {
isAvailableID = true;
diff --git a/src/web/module/maestro_setup.html b/src/web/module/maestro_setup.html
index fe2823f..9aeb88d 100644
--- a/src/web/module/maestro_setup.html
+++ b/src/web/module/maestro_setup.html
@@ -117,7 +117,7 @@ function changeMaestroInfo() {
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/update_maestro_info.php",
- "maestro_id=" + maestroID + "&maestro_name=" + newMaestroIDName + "&email=" + newEmail,
+ "maestro_id=" + maestroID + "&maestro_name=" + newMaestroIDName + "&email=" + encodeURIComponent(newEmail),
(function(jsonData) {
alert(
diff --git a/src/web/server/maestro/update_maestro_info.php b/src/web/server/maestro/update_maestro_info.php
index 5cb1d18..a81d641 100644
--- a/src/web/server/maestro/update_maestro_info.php
+++ b/src/web/server/maestro/update_maestro_info.php
@@ -3,18 +3,64 @@ header("Content-Type: application/json");
include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";
+include "./../lib/maestro_account_info.php";
+include "./../lib/db_maestro.php";
+include "./../mail/mail_setting.php";
+include "./../mail/send_mail.php";
$maestroID = $_POST["maestro_id"];
$maestroName = $_POST["maestro_name"];
$email = $_POST["email"];
+$info = get_maestro_info($maestroID);
+if($info === null) {
+ set_error_message("마에스트로 계정 정보를 가져올 수 없습니다.");
+ send_result_fail();
+ exit;
+}
+$maestro_name_prev = $info["name"];
+$email_prev = $info["email"];
+
+
update_maestro_info($maestroID, $maestroName, $email);
+if($maestroName != $maestro_name_prev)
+ sendMailUpdateMaestroName($maestroName, $maestro_name_prev, $email);
+
+if($email != $email_prev)
+ sendMailUpdateMaestroEmail($maestroName, $email, $email_prev);
+
send_result_success();
exit;
+
+function get_maestro_info($maestroID) {
+ global $db_conn;
+
+ $query = "
+ SELECT Name, Email, AccountType, AvailableActivateDateTime, PlayerCount
+ FROM maestro
+ WHERE MaestroID = ?
+ ";
+ $stmt = $db_conn->prepare($query);
+ $stmt->bind_param("s", $maestroID);
+ $stmt->execute();
+ $stmt->bind_result($name, $email, $accountType, $availableActivateDateTime, $playerCount);
+ // while($stmt->fetch())
+ $stmt->fetch();
+ $stmt->close();
+
+ $info["name"] = $name;
+ $info["email"] = $email;
+ $info["accountType"] = $accountType;
+ $info["availableActivateDateTime"] = $availableActivateDateTime;
+ $info["playerCount"] = $playerCount;
+
+ return $info;
+}
+
function update_maestro_info($maestroID, $maestroName, $email) {
global $db_conn;
diff --git a/src/web/server/mail/send_mail.php b/src/web/server/mail/send_mail.php
index a999984..c6f568e 100644
--- a/src/web/server/mail/send_mail.php
+++ b/src/web/server/mail/send_mail.php
@@ -103,6 +103,44 @@ function sendMailUpgradeDone($maestro_name, $maestro_email, $account_type, $upgr
sendEmail($postParamData);
}
+function sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email) {
+ $postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
+
+ $postParamData["templateSid"] = "161";
+ $postParamData["parameters"] = array(
+ "maestro_name_prev" => $maestro_name_prev,
+ "maestro_name" => $maestro_name,
+ );
+
+ sendEmail($postParamData);
+}
+
+function sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev) {
+ // send to new email
+ $postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
+
+ $postParamData["templateSid"] = "137";
+ $postParamData["parameters"] = array(
+ "maestro_email_prev" => $maestro_email_prev,
+ "maestro_email" => $maestro_email,
+ );
+
+ sendEmail($postParamData);
+
+
+ // send to previous email
+ $postParamDataPrev = makeDefaultPostParamData($maestro_name, $maestro_email_prev);
+
+ $postParamDataPrev["templateSid"] = "137";
+ $postParamDataPrev["parameters"] = array(
+ "maestro_email_prev" => $maestro_email_prev,
+ "maestro_email" => $maestro_email,
+ );
+
+ sendEmail($postParamDataPrev);
+}
+
+
function sendEmail($postParamData) {
global $host_name_url, $request_url, $access_key, $secret_key, $api_key, $method, $request_id;
global $sender_name, $sender_address;
@@ -235,14 +273,18 @@ function cUrl($postParam, $timestamp, $signature) {
curl_close ($ch);
if($status_code == 200) {
set_data("sendmail_respond", $response);
+ set_data("sendmail_postParam", $postParam);
} else if($status_code == 201) {
set_data("sendmail_succeed", $response);
+ set_data("sendmail_postParam", $postParam);
} else {
set_data("sendmail_error", $response);
+ set_data("sendmail_error_postParam", $postParam);
}
} catch(Exception $E) {
set_data("sendmail_error", $E->lastResponse);
+ set_data("sendmail_error_postParam", $postParam);
}
}
diff --git a/src/web/server/mail/send_mail_test.php b/src/web/server/mail/send_mail_test.php
index 488be41..e950018 100644
--- a/src/web/server/mail/send_mail_test.php
+++ b/src/web/server/mail/send_mail_test.php
@@ -15,25 +15,22 @@ $password = $_POST["password"];
$maestro_email = $_POST["email"];
$account_type = $_POST["account_type"];
$upgrade_account_type = $_POST["upgrade_account_type"];
+$maestro_name_prev = $_POST["maestro_name_prev"];
+$maestro_email_prev = $_POST["email_prev"];
if($type == "sendMailRegisterBankInfo") {
-
sendMailRegisterBankInfo($maestro_name, $maestro_email, $account_type);
-
} else if($type == "sendMailRegistered") {
-
sendMailRegisterDone($maestro_name, $maestro_email);
-
} else if($type == "sendMailUpgradeBankInfo") {
-
sendMailUpgradeBankInfo($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
-
-
} else if($type == "sendMailUpgradeDone") {
-
sendMailUpgradeDone($maestro_name, $maestro_email, $account_type, $upgrade_account_type);
-
+} else if($type == "sendMailUpdateMaestroName") {
+ sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email);
+} else if($type == "sendMailUpdateMaestroEmail") {
+ sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev);
} else if($type == "get_maestro_data") {
// maestro data
$maestro_data = get_maestro_data($maestro_id);