Add: upgrade maestro account type
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include "./../lib/send_reply_json.php";
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$maestroUpgradeID = $_POST["maestro_upgrade_id"];
|
||||
$maestroID = $_POST["maestro_id"];
|
||||
$newAccountType = $_POST["new_account_type"];
|
||||
|
||||
|
||||
upgrade_maestro($maestroID, $newAccountType);
|
||||
|
||||
change_upgrade_request_status_to_close($maestroID);
|
||||
change_upgrade_request_status_to_applied($maestroUpgradeID);
|
||||
|
||||
// set_data("maestroUpgradeID", $maestroUpgradeID);
|
||||
// set_data("maestroID", $maestroID);
|
||||
// set_data("newAccountType", $newAccountType);
|
||||
send_result_success();
|
||||
exit;
|
||||
|
||||
|
||||
|
||||
function upgrade_maestro($maestroID, $newAccountType) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
UPDATE moty_maestro
|
||||
SET AccountType = ?, ActivateStatus = 1, AvailableActivateDateTime = DATE_ADD(NOW(), INTERVAL 1 YEAR)
|
||||
WHERE MaestroID = ?;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("ii", $newAccountType, $maestroID);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
function change_upgrade_request_status_to_close($maestroID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
UPDATE moty_maestro_upgrade
|
||||
SET Status = 2
|
||||
WHERE MaestroID = ? AND Status = 1;
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("i", $maestroID);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
function change_upgrade_request_status_to_applied($maestroUpgradeID) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
UPDATE moty_maestro_upgrade
|
||||
SET Status = 3
|
||||
WHERE MaestroUpgradeID = ?
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("i", $maestroUpgradeID);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user