Add: maestro extension php, send e-mail
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../lib/db_maestro.php";
|
||||
include "./../lib/maestro_log.php";
|
||||
include "./../lib/maestro_account_info.php";
|
||||
include "./../mail/mail_setting.php";
|
||||
include "./../mail/send_mail.php";
|
||||
|
||||
$maestro_extension_id = $_POST["maestro_extension_id"];
|
||||
$maestro_id = $_POST["maestro_id"];
|
||||
$maestro_name = $_POST["maestro_name"];
|
||||
$registered_account_type = $_POST["registered_account_type"];
|
||||
|
||||
extension_maestro($maestro_id);
|
||||
|
||||
change_extension_request_status_to_close($maestro_id);
|
||||
change_extension_request_status_to_applied($maestro_extension_id);
|
||||
|
||||
$maestro_data = get_maestro_data($maestro_id);
|
||||
// sendMailExtensionDone($maestro_data["name"], $maestro_data["email"], $registered_account_type);
|
||||
insertMaestroLog("extension_maestro", $maestro_id, $maestro_name."(".$registered_account_type.")");
|
||||
|
||||
// set_data("maestro_extension_id", $maestro_extension_id);
|
||||
// set_data("maestro_id", $maestro_id);
|
||||
set_data("maestroName", $maestro_name);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
function extension_maestro($maestro_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
UPDATE maestro
|
||||
SET AccountType = ?, ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 1 YEAR)
|
||||
WHERE MaestroID = ?;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("i", $maestro_id);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
function change_extension_request_status_to_close($maestro_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
UPDATE maestro_extension
|
||||
SET Status = 2
|
||||
WHERE MaestroID = ? AND Status = 1;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("i", $maestro_id);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
function change_extension_request_status_to_applied($maestro_extension_id) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
UPDATE maestro_extension
|
||||
SET Status = 3
|
||||
WHERE MaestroExtensionID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("i", $maestro_extension_id);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroName = $_POST["maestro_name"];
|
||||
|
||||
|
||||
$maestroExtensionList = null;
|
||||
if(strlen($maestroName) === 0)
|
||||
$maestroExtensionList = get_maestro_extension_list();
|
||||
else
|
||||
$maestroExtensionList = get_maestro_extension_list_by_name($maestroName);
|
||||
|
||||
if(strlen($maestroExtensionList) === 0) {
|
||||
set_error_message("마에스트로 업그레이드 요청 목록 없음");
|
||||
send_result_fail();
|
||||
exit;
|
||||
}
|
||||
|
||||
set_data("maestroExtensionList", $maestroExtensionList);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
function get_maestro_extension_list() {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT E.MaestroExtensionID, E.MaestroID, M.Name, E.AccountType, E.RequestedDateTime, M.AvailableActivateDateTime, E.Status
|
||||
FROM maestro_extension E, maestro M
|
||||
WHERE E.Status < 2 AND E.MaestroID = M.MaestroID
|
||||
ORDER BY E.MaestroExtensionID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param("iii", $maestroID, $startNo, $endNo);
|
||||
// $stmt->bind_param("ii", $maestroName, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroExtensionID, $maestroID, $maestroName, $registeredAccountType, $requestedDateTime, $availableActivateDateTime, $status);
|
||||
|
||||
$maestroExtensionList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro["maestroExtensionID"] = $maestroExtensionID;
|
||||
$maestro["maestroID"] = $maestroID;
|
||||
$maestro["maestroName"] = $maestroName;
|
||||
$maestro["registeredAccountType"] = $registeredAccountType;
|
||||
$maestro["requestedDateTime"] = $requestedDateTime;
|
||||
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
|
||||
$maestro["status"] = $status;
|
||||
array_push($maestroExtensionList, $maestro);
|
||||
}
|
||||
|
||||
return $maestroExtensionList;
|
||||
}
|
||||
|
||||
function get_maestro_extension_list_by_name($searchMaestroName) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT E.MaestroExtensionID, E.MaestroID, M.Name, E.AccountType, E.RequestedDateTime, M.AvailableActivateDateTime, E.Status
|
||||
FROM maestro_extension E, maestro M
|
||||
WHERE M.Name LIKE CONCAT('%', ?, '%') AND E.MaestroID = M.MaestroID
|
||||
ORDER BY E.MaestroExtensionID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("s", $searchMaestroName);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroExtensionID, $maestroID, $maestroName, $registeredAccountType, $requestedDateTime, $availableActivateDateTime, $status);
|
||||
|
||||
$maestroExtensionList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro["maestroExtensionID"] = $maestroExtensionID;
|
||||
$maestro["maestroID"] = $maestroID;
|
||||
$maestro["maestroName"] = $maestroName;
|
||||
$maestro["registeredAccountType"] = $registeredAccountType;
|
||||
$maestro["requestedDateTime"] = $requestedDateTime;
|
||||
$maestro["availableActivateDateTime"] = $availableActivateDateTime;
|
||||
$maestro["status"] = $status;
|
||||
array_push($maestroExtensionList, $maestro);
|
||||
}
|
||||
|
||||
return $maestroExtensionList;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -141,6 +141,42 @@ function sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_emai
|
||||
}
|
||||
|
||||
|
||||
function sendMailExtensionBankInfo($maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type) {
|
||||
|
||||
// echo("$maestro_email : ".$maestro_email." / ");
|
||||
// echo("$available_date : ".$available_date);
|
||||
// return;
|
||||
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "335";
|
||||
$postParamData["parameters"] = array(
|
||||
"account_type" => get_accout_type($registered_account_type),
|
||||
"bank_account_no" => "3333-07-4977969",
|
||||
"bank_name" => "카카오뱅크",
|
||||
"bank_owner_name" => "박지상",
|
||||
"maestro_email" => $maestro_email,
|
||||
"maestro_name" => $maestro_name,
|
||||
"available_date" => $available_date,
|
||||
"new_available_date" => $new_available_date,
|
||||
"price" => number_format(get_price($registered_account_type))
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email) {
|
||||
$postParamData = makeDefaultPostParamData($maestro_name, $maestro_email);
|
||||
|
||||
$postParamData["templateSid"] = "336";
|
||||
$postParamData["parameters"] = array(
|
||||
"maestro_name" => $maestro_name,
|
||||
"new_available_date" => $new_available_date
|
||||
);
|
||||
|
||||
sendEmail($postParamData);
|
||||
}
|
||||
|
||||
function sendEmail($postParamData) {
|
||||
global $host_name_url, $request_url, $access_key, $secret_key, $api_key, $method, $request_id;
|
||||
global $sender_name, $sender_address;
|
||||
|
||||
@@ -12,9 +12,12 @@ $type = $_POST["type"];
|
||||
$maestro_id = $_POST["maestro_id"];
|
||||
$maestro_name = $_POST["maestro_name"];
|
||||
$password = $_POST["password"];
|
||||
$available_date = $_POST["available_date"];
|
||||
$new_available_date = $_POST["new_available_date"];
|
||||
$maestro_email = $_POST["email"];
|
||||
$account_type = $_POST["account_type"];
|
||||
$upgrade_account_type = $_POST["upgrade_account_type"];
|
||||
$registered_account_type = $_POST["registered_account_type"];
|
||||
$maestro_name_prev = $_POST["maestro_name_prev"];
|
||||
$maestro_email_prev = $_POST["email_prev"];
|
||||
|
||||
@@ -31,6 +34,10 @@ if($type == "sendMailRegisterBankInfo") {
|
||||
sendMailUpdateMaestroName($maestro_name, $maestro_name_prev, $maestro_email);
|
||||
} else if($type == "sendMailUpdateMaestroEmail") {
|
||||
sendMailUpdateMaestroEmail($maestro_name, $maestro_email, $maestro_email_prev);
|
||||
} else if($type == "sendMailExtensionBankInfo") {
|
||||
sendMailExtensionBankInfo($maestro_name, $available_date, $new_available_date, $maestro_email, $registered_account_type);
|
||||
} else if($type == "sendMailExtensionDone") {
|
||||
sendMailExtensionDone($maestro_name, $new_available_date, $maestro_email);
|
||||
} else if($type == "get_maestro_data") {
|
||||
// maestro data
|
||||
$maestro_data = get_maestro_data($maestro_id);
|
||||
|
||||
Reference in New Issue
Block a user