Add: register_maestro
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestro_id = $_POST["maestro_id"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
$query = "UPDATE moty_maestro SET ActivateStatus=1 WHERE MaestroID=?";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('i', $maestro_id);
|
||||
$stmt->execute();
|
||||
|
||||
if($stmt->affected_rows <= 0) {
|
||||
send_error_message($replyJSON, "마에스트로 계정 활성화 실패");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$maestroName = $_POST["maestro_name"];
|
||||
|
||||
include "./../setup/connect_db.php";
|
||||
|
||||
|
||||
$replyJSON = null;
|
||||
|
||||
|
||||
if(strlen($maestroName) === 0)
|
||||
$replyJSON = get_maestro_list();
|
||||
else
|
||||
$replyJSON = get_maestro_list_by_name($maestroName);
|
||||
|
||||
if(strlen($replyJSON) === 0) {
|
||||
send_error_message($replyJSON, "오늘의 랭킹 기록 없음");
|
||||
$db_conn->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$replyJSON["RESULT"] = "ok";
|
||||
echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE);
|
||||
$db_conn->close();
|
||||
|
||||
|
||||
function get_maestro_list() {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT MaestroID, Name, AccountType FROM moty_maestro
|
||||
WHERE ActivateStatus=0
|
||||
ORDER BY MaestroID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
// $stmt->bind_param('ii', $maestroName, $startNo);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroID, $name, $accountType);
|
||||
|
||||
$maestroList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro['MaestroID'] = $maestroID;
|
||||
$maestro['Name'] = $name;
|
||||
$maestro['AccountType'] = $accountType;
|
||||
array_push($maestroList, $maestro);
|
||||
}
|
||||
|
||||
$return_array['MaestroList'] = $maestroList;
|
||||
return $return_array;
|
||||
}
|
||||
|
||||
function get_maestro_list_by_name($maestroName) {
|
||||
global $db_conn;
|
||||
|
||||
$query = "
|
||||
SELECT MaestroID, Name, AccountType FROM moty_maestro
|
||||
WHERE Name=? AND ActivateStatus=0
|
||||
ORDER BY MaestroID DESC
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
// $stmt->bind_param('iii', $maestroID, $startNo, $endNo);
|
||||
$stmt->bind_param('s', $maestroName);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($maestroID, $name, $accountType);
|
||||
|
||||
$maestroList = array();
|
||||
while($stmt->fetch()) {
|
||||
$maestro['MaestroID'] = $maestroID;
|
||||
$maestro['Name'] = $name;
|
||||
$maestro['AccountType'] = $accountType;
|
||||
array_push($maestroList, $maestro);
|
||||
}
|
||||
|
||||
$return_array['MaestroList'] = $maestroList;
|
||||
return $return_array;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user